aboutsummaryrefslogtreecommitdiff
path: root/epid/common-testhelper/1.1/verifier_wrapper-testhelper.h
diff options
context:
space:
mode:
Diffstat (limited to 'epid/common-testhelper/1.1/verifier_wrapper-testhelper.h')
-rw-r--r--epid/common-testhelper/1.1/verifier_wrapper-testhelper.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/epid/common-testhelper/1.1/verifier_wrapper-testhelper.h b/epid/common-testhelper/1.1/verifier_wrapper-testhelper.h
new file mode 100644
index 0000000..f3c351a
--- /dev/null
+++ b/epid/common-testhelper/1.1/verifier_wrapper-testhelper.h
@@ -0,0 +1,56 @@
+/*############################################################################
+ # Copyright 2016 Intel Corporation
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ ############################################################################*/
+
+/*!
+ * \file
+ * \brief Verifier C++ wrapper interface.
+ */
+#ifndef EPID_COMMON_TESTHELPER_1_1_VERIFIER_WRAPPER_TESTHELPER_H_
+#define EPID_COMMON_TESTHELPER_1_1_VERIFIER_WRAPPER_TESTHELPER_H_
+
+extern "C" {
+#include "epid/verifier/1.1/api.h"
+}
+
+/// C++ Wrapper to manage memory for VerifierCtx via RAII
+class Epid11VerifierCtxObj {
+ public:
+ /// Create an Epid11VerifierCtx
+ explicit Epid11VerifierCtxObj(Epid11GroupPubKey const& pub_key);
+ /// Create an Epid11VerifierCtx given precomputation blob
+ Epid11VerifierCtxObj(Epid11GroupPubKey const& pub_key,
+ Epid11VerifierPrecomp const& precomp);
+
+ // This class instances are not meant to be copied.
+ // Explicitly delete copy constructor and assignment operator.
+ Epid11VerifierCtxObj(const Epid11VerifierCtxObj&) = delete;
+ Epid11VerifierCtxObj& operator=(const Epid11VerifierCtxObj&) = delete;
+
+ /// Destroy the Epid11VerifierCtx
+ ~Epid11VerifierCtxObj();
+ /// get a pointer to the stored Epid11VerifierCtx
+ Epid11VerifierCtx* ctx() const;
+ /// cast operator to get the pointer to the stored Epid11VerifierCtx
+ operator Epid11VerifierCtx*() const;
+ /// const cast operator to get the pointer to the stored Epid11VerifierCtx
+ operator const Epid11VerifierCtx*() const;
+
+ private:
+ /// The stored VerifierCtx
+ Epid11VerifierCtx* ctx_;
+};
+
+#endif // EPID_COMMON_TESTHELPER_1_1_VERIFIER_WRAPPER_TESTHELPER_H_