Home | History | Annotate | Download | only in src
      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 signing helper APIs
     17 /*! \file */
     18 #ifndef EPID_MEMBER_SRC_SIGN_COMMITMENT_H_
     19 #define EPID_MEMBER_SRC_SIGN_COMMITMENT_H_
     20 
     21 #include <stddef.h>
     22 #include "epid/common/errors.h"
     23 #include "epid/common/types.h"  // HashAlg
     24 
     25 #pragma pack(1)
     26 /// Result of Sign Commit
     27 typedef struct SignCommitOutput {
     28   G1ElemStr B;   ///< B value for signature
     29   G1ElemStr K;   ///< K value for signature
     30   G1ElemStr T;   ///< T value for signature
     31   G1ElemStr R1;  ///< Serialized G1 element
     32   GtElemStr R2;  ///< Serialized GT element
     33 } SignCommitOutput;
     34 #pragma pack()
     35 
     36 typedef struct SignCommitOutput SignCommitOutput;
     37 
     38 /// \cond
     39 typedef struct FiniteField FiniteField;
     40 typedef struct FpElemStr FpElemStr;
     41 /// \endcond
     42 
     43 /// Calculates commitment hash of sign commit
     44 /*!
     45 
     46   \param[in] Fp
     47   The finite field.
     48 
     49   \param[in] hash_alg
     50   The hash algorithm.
     51 
     52   \param[in] commit_out
     53   The output from the sign commit.
     54 
     55   \param[in] msg
     56   The message.
     57 
     58   \param[in] msg_len
     59   The size of message in bytes.
     60 
     61   \param[out] c_str
     62   The resulting commitment hash.
     63 
     64   \returns ::EpidStatus
     65 
     66  */
     67 EpidStatus HashSignCommitment(FiniteField* Fp, HashAlg hash_alg,
     68                               GroupPubKey const* pub_key,
     69                               SignCommitOutput const* commit_out,
     70                               void const* msg, size_t msg_len,
     71                               FpElemStr* c_str);
     72 
     73 #endif  // EPID_MEMBER_SRC_SIGN_COMMITMENT_H_
     74