Add MD5 in KeyGenerator 12/97112/2
authorSeok Hong <seok85.hong@samsung.com>
Fri, 11 Nov 2016 07:12:27 +0000 (16:12 +0900)
committerSeok Hong <seok85.hong@samsung.com>
Fri, 11 Nov 2016 08:11:46 +0000 (17:11 +0900)
Change-Id: I68ec322e950b0d8112ffe0b7feccee745c0c9eae
Signed-off-by: Seok Hong <seok85.hong@samsung.com>
packaging/ode.spec
server/CMakeLists.txt
server/key-manager/key-generator.cpp
server/key-manager/key-generator.h

index 87a83e4d85e7b45547f0f4a4d5b74b970e43f6ad..3a734a311d467f9808902f463d0294e00b5321b9 100644 (file)
@@ -16,6 +16,7 @@ BuildRequires: pkgconfig(libtzplatform-config)
 BuildRequires: pkgconfig(key-manager)
 BuildRequires: pkgconfig(cynara-client)
 BuildRequires: pkgconfig(cynara-session)
+BuildRequires: pkgconfig(openssl)
 
 %description
 The ode package provides a daemon which is responsible for encrypting/decryption storages and secure erasing.
index 6a6f5c3b484e79a8cb741c742ce58aebc157461f..d67cda9b8123d7390fa77bfdd67c49bb89c84e50 100644 (file)
@@ -33,6 +33,7 @@ SET(DEPENDENCY        klay
                                libtzplatform-config
                                cynara-client
                                cynara-session
+                               openssl
 )
 
 SET(SERVER_NAME ${PROJECT_NAME}d)
index aad4128074209ddc78acd77c99bd2deb2ce74923..f13723c0422157ccd0f9fa3376febfac7e3cd813 100644 (file)
@@ -13,6 +13,8 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License
  */
+#include <openssl/md5.h>
+
 #include <klay/filesystem.h>
 #include <klay/audit/logger.h>
 
@@ -67,4 +69,13 @@ const KeyGenerator::data KeyGenerator::RNG()
        return ret;
 }
 
+const KeyGenerator::data KeyGenerator::MD5(const KeyGenerator::data& in)
+{
+       data ret(MD5_DIGEST_LENGTH);
+
+       ::MD5((unsigned char*)in.data(), in.size(), (unsigned char*)ret.data());
+
+       return ret;
+}
+
 } // namespace ode
index b5b0d1a5a14aa376edd19030a918940f072346ad..e6ab147ec9961c8d48cd23218961b25b1e50cdb1 100644 (file)
@@ -37,6 +37,7 @@ public:
        const data AES(const data& in1, const data& in2);
        const data HMAC(const data& original, const data& key);
        const data RNG();
+       const data MD5(const data& in);
 
 private:
        int keySize;