• 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 /// Host non-revoked proof helper APIs
17 /*! \file */
18 #ifndef EPID_MEMBER_SRC_NRPROVE_COMMITMENT_H_
19 #define EPID_MEMBER_SRC_NRPROVE_COMMITMENT_H_
20 
21 #include <stddef.h>
22 #include "epid/common/errors.h"
23 #include "epid/common/types.h"  // HashAlg, G1ElemStr
24 
25 /// \cond
26 typedef struct FiniteField FiniteField;
27 typedef struct FpElemStr FpElemStr;
28 typedef struct SigRlEntry SigRlEntry;
29 typedef struct NrProveCommitOutput NrProveCommitOutput;
30 /// \endcond
31 
32 #pragma pack(1)
33 /// Result of NrProve Commit
34 typedef struct NrProveCommitOutput {
35   G1ElemStr T;   ///< T value for NrProof
36   G1ElemStr R1;  ///< Serialized G1 element
37   G1ElemStr R2;  ///< Serialized G1 element
38 } NrProveCommitOutput;
39 #pragma pack()
40 
41 /// Calculates commitment hash of NrProve commit
42 /*!
43 
44   \param[in] Fp
45   The finite field.
46 
47   \param[in] hash_alg
48   The hash algorithm.
49 
50   \param[in] B_str
51   The B value from the ::BasicSignature.
52 
53   \param[in] K_str
54   The K value from the ::BasicSignature.
55 
56   \param[in] sigrl_entry
57   The signature based revocation list entry corresponding to this
58   proof.
59 
60   \param[in] commit_out
61   The output from the NrProve commit.
62 
63   \param[in] msg
64   The message.
65 
66   \param[in] msg_len
67   The size of message in bytes.
68 
69   \param[out] c_str
70   The resulting commitment hash.
71 
72   \returns ::EpidStatus
73 
74  */
75 EpidStatus HashNrProveCommitment(FiniteField* Fp, HashAlg hash_alg,
76                                  G1ElemStr const* B_str, G1ElemStr const* K_str,
77                                  SigRlEntry const* sigrl_entry,
78                                  NrProveCommitOutput const* commit_out,
79                                  void const* msg, size_t msg_len,
80                                  FpElemStr* c_str);
81 
82 #endif  // EPID_MEMBER_SRC_NRPROVE_COMMITMENT_H_
83