Interfaces for the Confidentiality Algorithm

This patch defines the interfaces for the confidentaility
algorithm. It provides API to decrypt the cipher payload
and encrypt the plain text payload.

Change-Id: I0c47ee14d5d5574c4d4996e437dffcaa2aa62f9a
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/crypt_algo.cpp b/crypt_algo.cpp
new file mode 100644
index 0000000..6bd5d94
--- /dev/null
+++ b/crypt_algo.cpp
@@ -0,0 +1,32 @@
+#include <openssl/evp.h>
+#include <openssl/hmac.h>
+#include <openssl/rand.h>
+#include <numeric>
+#include "crypt_algo.hpp"
+#include "message_parsers.hpp"
+
+namespace cipher
+{
+
+namespace crypt
+{
+
+Interface::Interface(const buffer& sik, const key& addKey)
+{
+    unsigned int mdLen = 0;
+
+    // Generated K2 for the confidentiality algorithm with the additional key
+    // keyed with SIK.
+    if (HMAC(EVP_sha1(), sik.data(), sik.size(), addKey.data(),
+             addKey.size(), k2.data(), &mdLen) == NULL)
+    {
+        throw std::runtime_error("Generating K2 for confidentiality algorithm"
+                                 "failed");
+    }
+}
+
+}// namespace crypt
+
+}// namespace cipher
+
+