• 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 /// Epid2Params C++ wrapper implementation.
17 /*! \file */
18 
19 #include "epid/common-testhelper/epid2params_wrapper-testhelper.h"
20 
21 #include <cstdio>
22 #include <stdexcept>
23 #include <string>
24 
25 extern "C" {
26 #include "epid/common/src/epid2params.h"
27 }
28 
Epid2ParamsObj()29 Epid2ParamsObj::Epid2ParamsObj() : params_(nullptr) {
30   EpidStatus sts = kEpidNoErr;
31   sts = CreateEpid2Params(&params_);
32   if (kEpidNoErr != sts) {
33     printf("%s(%d): %s\n", __FILE__, __LINE__, "test defect:");
34     throw std::logic_error(std::string("Failed to call: ") +
35                            "CreateEpid2Params()");
36   }
37 }
38 
~Epid2ParamsObj()39 Epid2ParamsObj::~Epid2ParamsObj() { DeleteEpid2Params(&params_); }
40 
ctx() const41 Epid2Params_* Epid2ParamsObj::ctx() const { return params_; }
42 
operator Epid2Params_*() const43 Epid2ParamsObj::operator Epid2Params_*() const { return params_; }
44 
operator const Epid2Params_*() const45 Epid2ParamsObj::operator const Epid2Params_*() const { return params_; }
46 
Fp() const47 FiniteField* Epid2ParamsObj::Fp() const { return params_->Fp; }
48 
G1() const49 EcGroup* Epid2ParamsObj::G1() const { return params_->G1; }
50