• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*############################################################################
2   # Copyright 2017 Intel Corporation
3   #
4   # Licensed under the Apache License, Version 2.0 (the "License");
5   # you may not use this file except in compliance with the License.
6   # You may obtain a copy of the License at
7   #
8   #     http://www.apache.org/licenses/LICENSE-2.0
9   #
10   # Unless required by applicable law or agreed to in writing, software
11   # distributed under the License is distributed on an "AS IS" BASIS,
12   # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   # See the License for the specific language governing permissions and
14   # limitations under the License.
15   ############################################################################*/
16 /// Basename management APIs
17 /*! \file */
18 
19 #ifndef EPID_MEMBER_TINY_SRC_ALLOWED_BASENAMES_H_
20 #define EPID_MEMBER_TINY_SRC_ALLOWED_BASENAMES_H_
21 
22 #include <stddef.h>
23 #include "epid/member/tiny/math/hashwrap.h"
24 
25 typedef struct AllowedBasenames {
26   size_t current_bsn_number;  ///< Number of basenames registered
27   size_t max_bsn_number;      ///< Maximum number of basenames to store
28   sha_digest
29       basename_digest[1];  ///< digest of registrered basenames (flexible array)
30 } AllowedBasenames;
31 
32 /// Get allowed basenames container size
33 size_t BasenamesGetSize(size_t num_basenames);
34 
35 /// Initilize allowed basenames container
36 void InitBasenames(AllowedBasenames* basename_container, size_t num_basenames);
37 
38 /// Checks if given basename is allowed
39 int IsBasenameAllowed(AllowedBasenames const* basename_container,
40                       void const* basename, size_t length);
41 
42 /// Adds a new allowed basename
43 int AllowBasename(AllowedBasenames* basename_container, void const* basename,
44                   size_t length);
45 
46 #endif  // EPID_MEMBER_TINY_SRC_ALLOWED_BASENAMES_H_
47