ecgroup_wrapper-testhelper.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. /*############################################################################
  2. # Copyright 2016 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. /*!
  17. * \file
  18. * \brief EcGroup C++ wrapper interface.
  19. */
  20. #ifndef EPID_COMMON_TESTHELPER_ECGROUP_WRAPPER_TESTHELPER_H_
  21. #define EPID_COMMON_TESTHELPER_ECGROUP_WRAPPER_TESTHELPER_H_
  22. #include <memory>
  23. #include <vector>
  24. extern "C" {
  25. #include "epid/common/math/ecgroup.h"
  26. }
  27. #include "epid/common-testhelper/finite_field_wrapper-testhelper.h"
  28. /*!
  29. Wrapper class to provide Resource Allocation is Initialization handling
  30. for EcGroup
  31. */
  32. class EcGroupObj {
  33. public:
  34. /// constructor
  35. EcGroupObj();
  36. /// copy constructor
  37. EcGroupObj(EcGroupObj const& other);
  38. /// assignment operator
  39. EcGroupObj& operator=(EcGroupObj const& other);
  40. /// Create a EcGroup
  41. explicit EcGroupObj(FiniteFieldObj* ff, FfElement const* a,
  42. FfElement const* b, FfElement const* x,
  43. FfElement const* y, BigNum const* order,
  44. BigNum const* cofactor);
  45. /// Destroy the EcGroup
  46. ~EcGroupObj();
  47. /// cast operator to get the pointer to the stored EcGroup
  48. operator EcGroup*();
  49. /// const cast operator to get the pointer to the stored EcGroup
  50. operator const EcGroup*() const;
  51. /// Get the underlying pointer
  52. EcGroup* get();
  53. /// Get the underlying pointer
  54. EcGroup const* getc() const;
  55. /// Get maximum size of group element
  56. size_t GetElementMaxSize() const;
  57. private:
  58. struct State;
  59. std::unique_ptr<State> state_;
  60. };
  61. #endif // EPID_COMMON_TESTHELPER_ECGROUP_WRAPPER_TESTHELPER_H_