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 hashing helper API
17 /*! \file */
18 #ifndef EPID_MEMBER_SRC_HASH_BASENAME_H_
19 #define EPID_MEMBER_SRC_HASH_BASENAME_H_
20 
21 #include <stddef.h>
22 #include <stdint.h>
23 #include "epid/common/errors.h"
24 #include "epid/common/types.h"  // HashAlg
25 
26 /// \cond
27 typedef struct EcGroup EcGroup;
28 typedef struct G1ElemStr G1ElemStr;
29 /// \endcond
30 
31 /// Calculates hash of basename
32 /*!
33 
34   \param[in] G1
35   The elliptic curve group.
36 
37   \param[in] hash_alg
38   The hash algorithm.
39 
40   \param[in] basename
41   The basename.
42 
43   \param[in] basename_len
44   The size of the basename in bytes.
45 
46   \param[out] B_str
47   The resulting hashed basename.
48 
49   \param[out] iterations
50   The number of hash iterations needed to find a valid hash. Can be NULL.
51 
52   \returns ::EpidStatus
53 
54 */
55 EpidStatus HashBaseName(EcGroup* G1, HashAlg hash_alg, void const* basename,
56                         size_t basename_len, G1ElemStr* B_str,
57                         uint32_t* iterations);
58 
59 #endif  // EPID_MEMBER_SRC_HASH_BASENAME_H_
60