1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
/*############################################################################
# Copyright 2016 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
############################################################################*/
#ifndef EPID_MEMBER_PRIVKEY_H_
#define EPID_MEMBER_PRIVKEY_H_
/*!
* \file
* \brief Private key private interface.
* \addtogroup EpidCommon
* @{
*/
#include "epid/common/errors.h"
#include "epid/common/math/ecgroup.h"
#include "epid/common/types.h"
/*!
* \brief
* Internal implementation of PrivKey
*/
typedef struct PrivKey_ {
GroupId gid; ///< group ID
EcPoint* A; ///< an element in G1
FfElement* x; ///< an integer between [0, p-1]
FfElement* f; ///< an integer between [0, p-1]
} PrivKey_;
/// Constructs internal representation of PrivKey
/*!
This function allocates memory and initializes gid, A, x, f parameters.
\param[in] priv_key_str
Serialized representation of private key
\param[in] G1
EcGroup containing element A
\param[in] Fp
FiniteField containing elements x and f
\param[out] priv_key
Newly created private key: (gid, A, x, f)
\returns ::EpidStatus
*/
EpidStatus CreatePrivKey(PrivKey const* priv_key_str, EcGroup* G1,
FiniteField* Fp, PrivKey_** priv_key);
/// Deallocate storage for internal representation of PrivKey
/*!
Frees memory pointed to by Member private key. Nulls the pointer.
\param[in] priv_key
Member private key to be freed
*/
void DeletePrivKey(PrivKey_** priv_key);
/*! @} */
#endif // EPID_MEMBER_PRIVKEY_H_
|