verifier_wrapper-testhelper.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 Verifier C++ wrapper interface.
  19. */
  20. #ifndef EPID_COMMON_TESTHELPER_1_1_VERIFIER_WRAPPER_TESTHELPER_H_
  21. #define EPID_COMMON_TESTHELPER_1_1_VERIFIER_WRAPPER_TESTHELPER_H_
  22. extern "C" {
  23. #include "epid/verifier/1.1/api.h"
  24. }
  25. /// C++ Wrapper to manage memory for VerifierCtx via RAII
  26. class Epid11VerifierCtxObj {
  27. public:
  28. /// Create an Epid11VerifierCtx
  29. explicit Epid11VerifierCtxObj(Epid11GroupPubKey const& pub_key);
  30. /// Create an Epid11VerifierCtx given precomputation blob
  31. Epid11VerifierCtxObj(Epid11GroupPubKey const& pub_key,
  32. Epid11VerifierPrecomp const& precomp);
  33. // This class instances are not meant to be copied.
  34. // Explicitly delete copy constructor and assignment operator.
  35. Epid11VerifierCtxObj(const Epid11VerifierCtxObj&) = delete;
  36. Epid11VerifierCtxObj& operator=(const Epid11VerifierCtxObj&) = delete;
  37. /// Destroy the Epid11VerifierCtx
  38. ~Epid11VerifierCtxObj();
  39. /// get a pointer to the stored Epid11VerifierCtx
  40. Epid11VerifierCtx* ctx() const;
  41. /// cast operator to get the pointer to the stored Epid11VerifierCtx
  42. operator Epid11VerifierCtx*() const;
  43. /// const cast operator to get the pointer to the stored Epid11VerifierCtx
  44. operator const Epid11VerifierCtx*() const;
  45. private:
  46. /// The stored VerifierCtx
  47. Epid11VerifierCtx* ctx_;
  48. };
  49. #endif // EPID_COMMON_TESTHELPER_1_1_VERIFIER_WRAPPER_TESTHELPER_H_