epid2params_wrapper-testhelper.cc 1.7 KB

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