verifier_wrapper-testhelper.h 2.0 KB

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