epid2params_wrapper-testhelper.h 2.0 KB

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