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 87a83e4..3a734a3 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 6a6f5c3..d67cda9 100644 (file)
@@ -33,6 +33,7 @@ SET(DEPENDENCY        klay
                                libtzplatform-config
                                cynara-client
                                cynara-session
+                               openssl
 )
 
 SET(SERVER_NAME ${PROJECT_NAME}d)
index aad4128..f13723c 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 b5b0d1a..e6ab147 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;