Home | History | Annotate | Download | only in common-testhelper
      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 /// Epid2Params C++ wrapper interface.
     17 /*! \file */
     18 
     19 #ifndef EPID_COMMON_TESTHELPER_EPID2PARAMS_WRAPPER_TESTHELPER_H_
     20 #define EPID_COMMON_TESTHELPER_EPID2PARAMS_WRAPPER_TESTHELPER_H_
     21 
     22 typedef struct Epid2Params_ Epid2Params_;
     23 typedef struct FiniteField FiniteField;
     24 typedef struct EcGroup EcGroup;
     25 
     26 /// C++ Wrapper to manage memory for Epid2Params via RAII
     27 class Epid2ParamsObj {
     28  public:
     29   /// Create a Epid2Params
     30   Epid2ParamsObj();
     31 
     32   // This class instances are not meant to be copied.
     33   // Explicitly delete copy constructor and assignment operator.
     34   Epid2ParamsObj(const Epid2ParamsObj&) = delete;
     35   Epid2ParamsObj& operator=(const Epid2ParamsObj&) = delete;
     36 
     37   /// Destroy the Epid2Params
     38   ~Epid2ParamsObj();
     39   /// get a pointer to the stored Epid2Params
     40   Epid2Params_* ctx() const;
     41   /// cast operator to get the pointer to the stored Epid2Params
     42   operator Epid2Params_*() const;
     43   /// const cast operator to get the pointer to the stored Epid2Params
     44   operator const Epid2Params_*() const;
     45   /// get a pointer to the prime field Fp
     46   FiniteField* Fp() const;
     47   /// get a pointer to elliptic curve group G1
     48   EcGroup* G1() const;
     49 
     50  private:
     51   /// The stored parameters
     52   Epid2Params_* params_;
     53 };
     54 
     55 #endif  // EPID_COMMON_TESTHELPER_EPID2PARAMS_WRAPPER_TESTHELPER_H_
     56