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