Home | History | Annotate | Download | only in src
      1 /*############################################################################
      2   # Copyright 2016-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 #ifndef EPID_COMMON_1_1_SRC_GROUPPUBKEY_H_
     17 #define EPID_COMMON_1_1_SRC_GROUPPUBKEY_H_
     18 /*!
     19  * \file
     20  * \brief Intel(R) EPID 1.1 group public key interface.
     21  * \addtogroup EpidCommon
     22  * @{
     23  */
     24 #include "epid/common/1.1/types.h"
     25 #include "epid/common/errors.h"
     26 #include "epid/common/math/ecgroup.h"
     27 
     28 /// Internal representation of Epid11GroupPubKey
     29 typedef struct Epid11GroupPubKey_ {
     30   Epid11GroupId gid;  ///< group ID
     31   EcPoint* h1;        ///< an element in G1
     32   EcPoint* h2;        ///< an element in G1
     33   EcPoint* w;         ///< an element in G2
     34 } Epid11GroupPubKey_;
     35 
     36 /// Constructs internal representation of Intel(R) EPID 1.1 group public key
     37 /*!
     38   Allocates memory and initializes gid, h1, h2, w parameters. Use
     39   DeleteEpid11GroupPubKey() to deallocate memory
     40 
     41   \param[in] pub_key_str
     42   Oct string representation of group public key
     43   \param[in] G1
     44   EcGroup containing elements h1 and h2
     45   \param[in] G2
     46   EcGroup containing element w
     47   \param[out] pub_key
     48   Group public key: (gid, h1, h2, w)
     49 
     50   \returns ::EpidStatus
     51   \see DeleteEpid11GroupPubKey
     52 */
     53 EpidStatus CreateEpid11GroupPubKey(Epid11GroupPubKey const* pub_key_str,
     54                                    EcGroup* G1, EcGroup* G2,
     55                                    Epid11GroupPubKey_** pub_key);
     56 
     57 /// Deallocates storage for internal representation Intel(R) EPID 1.1 group
     58 /// public key
     59 /*!
     60   Frees memory pointed to by Epid11GroupPubKey. Nulls the pointer.
     61 
     62   \param[in] pub_key
     63   Epid11GroupPubKey to be freed
     64 
     65   \see CreateEpid11GroupPubKey
     66 */
     67 void DeleteEpid11GroupPubKey(Epid11GroupPubKey_** pub_key);
     68 /*! @} */
     69 #endif  // EPID_COMMON_1_1_SRC_GROUPPUBKEY_H_
     70