Move mbedtls_wrapper.h to shared subdirectory 70/163270/1
authorJaroslaw Pelczar <j.pelczar@samsung.com>
Tue, 5 Dec 2017 05:05:46 +0000 (06:05 +0100)
committerJaroslaw Pelczar <j.pelczar@samsung.com>
Tue, 5 Dec 2017 05:05:46 +0000 (06:05 +0100)
Change-Id: I7de8872bb943429ae38618a20f4e7f85248a75d1
Signed-off-by: Jaroslaw Pelczar <j.pelczar@samsung.com>
dcm-daemon/mbedtls_wrapper.h [deleted file]
shared/mbedtls_wrapper.h [new file with mode: 0644]

diff --git a/dcm-daemon/mbedtls_wrapper.h b/dcm-daemon/mbedtls_wrapper.h
deleted file mode 100644 (file)
index ed2ebe3..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/******************************************************************
- *
- * Copyright 2017 Samsung Electronics All Rights Reserved.
- *
- * Author: Jaroslaw Pelczar <j.pelczar@samsung.com>
- *
- * 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.
- *
- ******************************************************************/
-
-#ifndef DCM_DAEMON_MBEDTLS_WRAPPER_H_
-#define DCM_DAEMON_MBEDTLS_WRAPPER_H_
-
-#include <mbedtls/x509_crt.h>
-#include <mbedtls/error.h>
-#include <mbedtls/bignum.h>
-#include <boost/noncopyable.hpp>
-#include <string>
-
-struct mbedtls_x509_crt_wrapper : public mbedtls_x509_crt, public boost::noncopyable {
-       mbedtls_x509_crt_wrapper() {
-               mbedtls_x509_crt_init(this);
-       }
-
-       ~mbedtls_x509_crt_wrapper() {
-               mbedtls_x509_crt_free(this);
-       }
-
-       int parse(const std::string& pem) {
-               return mbedtls_x509_crt_parse(this, reinterpret_cast<const unsigned char *>(pem.c_str()), pem.size() + 1);
-       }
-};
-
-static inline std::string mbedtls_error_to_string(int error) {
-       char buffer[256];
-       mbedtls_strerror(error, buffer, sizeof(buffer));
-       return std::string(buffer);
-}
-
-struct mbedtls_mpi_wrapper : public mbedtls_mpi, public boost::noncopyable {
-       mbedtls_mpi_wrapper() {
-               mbedtls_mpi_init(this);
-       }
-
-       ~mbedtls_mpi_wrapper() {
-               mbedtls_mpi_free(this);
-       }
-
-       int read_binary(const void * data, size_t length) {
-               return mbedtls_mpi_read_binary(this, (const unsigned char *)data, length);
-       }
-
-       int get_raw(const void * data, size_t length) {
-               const int ciL = sizeof(mbedtls_mpi_uint);
-               const int biL = ciL * 8;
-               int error = mbedtls_mpi_grow(this, (length * 8 + biL - 1) / biL);
-               if(error != 0)
-                       return error;
-               mbedtls_mpi_lset(this, 0);
-               memcpy(this->p, data, length);
-               return 0;
-       }
-};
-
-#endif /* DCM_DAEMON_MBEDTLS_WRAPPER_H_ */
diff --git a/shared/mbedtls_wrapper.h b/shared/mbedtls_wrapper.h
new file mode 100644 (file)
index 0000000..ed2ebe3
--- /dev/null
@@ -0,0 +1,75 @@
+/******************************************************************
+ *
+ * Copyright 2017 Samsung Electronics All Rights Reserved.
+ *
+ * Author: Jaroslaw Pelczar <j.pelczar@samsung.com>
+ *
+ * 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.
+ *
+ ******************************************************************/
+
+#ifndef DCM_DAEMON_MBEDTLS_WRAPPER_H_
+#define DCM_DAEMON_MBEDTLS_WRAPPER_H_
+
+#include <mbedtls/x509_crt.h>
+#include <mbedtls/error.h>
+#include <mbedtls/bignum.h>
+#include <boost/noncopyable.hpp>
+#include <string>
+
+struct mbedtls_x509_crt_wrapper : public mbedtls_x509_crt, public boost::noncopyable {
+       mbedtls_x509_crt_wrapper() {
+               mbedtls_x509_crt_init(this);
+       }
+
+       ~mbedtls_x509_crt_wrapper() {
+               mbedtls_x509_crt_free(this);
+       }
+
+       int parse(const std::string& pem) {
+               return mbedtls_x509_crt_parse(this, reinterpret_cast<const unsigned char *>(pem.c_str()), pem.size() + 1);
+       }
+};
+
+static inline std::string mbedtls_error_to_string(int error) {
+       char buffer[256];
+       mbedtls_strerror(error, buffer, sizeof(buffer));
+       return std::string(buffer);
+}
+
+struct mbedtls_mpi_wrapper : public mbedtls_mpi, public boost::noncopyable {
+       mbedtls_mpi_wrapper() {
+               mbedtls_mpi_init(this);
+       }
+
+       ~mbedtls_mpi_wrapper() {
+               mbedtls_mpi_free(this);
+       }
+
+       int read_binary(const void * data, size_t length) {
+               return mbedtls_mpi_read_binary(this, (const unsigned char *)data, length);
+       }
+
+       int get_raw(const void * data, size_t length) {
+               const int ciL = sizeof(mbedtls_mpi_uint);
+               const int biL = ciL * 8;
+               int error = mbedtls_mpi_grow(this, (length * 8 + biL - 1) / biL);
+               if(error != 0)
+                       return error;
+               mbedtls_mpi_lset(this, 0);
+               memcpy(this->p, data, length);
+               return 0;
+       }
+};
+
+#endif /* DCM_DAEMON_MBEDTLS_WRAPPER_H_ */