blob: 6bd5d948a6dc411e4421bcdd312a971b8011348d [file] [log] [blame]
Tom Josephd08b5232017-01-24 18:15:39 +05301#include <openssl/evp.h>
2#include <openssl/hmac.h>
3#include <openssl/rand.h>
4#include <numeric>
5#include "crypt_algo.hpp"
6#include "message_parsers.hpp"
7
8namespace cipher
9{
10
11namespace crypt
12{
13
14Interface::Interface(const buffer& sik, const key& addKey)
15{
16 unsigned int mdLen = 0;
17
18 // Generated K2 for the confidentiality algorithm with the additional key
19 // keyed with SIK.
20 if (HMAC(EVP_sha1(), sik.data(), sik.size(), addKey.data(),
21 addKey.size(), k2.data(), &mdLen) == NULL)
22 {
23 throw std::runtime_error("Generating K2 for confidentiality algorithm"
24 "failed");
25 }
26}
27
28}// namespace crypt
29
30}// namespace cipher
31
32