Add support for cipher suite 17
cipher suite 17 uses RAKP_HMAC_SHA256 for authentication and
RAKP_HMAC_SHA256_128 for integrity. This adds those in and fixes up the
lookups so the stack knows about the new algorithms.
Change-Id: Icdc66563d08060fc0e541ceaf3bee9dd5f89fdb2
Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
diff --git a/auth_algo.cpp b/auth_algo.cpp
index 0bc2555..94a8c91 100644
--- a/auth_algo.cpp
+++ b/auth_algo.cpp
@@ -45,6 +45,40 @@
return output;
}
+std::vector<uint8_t> AlgoSHA256::generateHMAC(
+ const std::vector<uint8_t>& input) const
+{
+ std::vector<uint8_t> output(SHA256_DIGEST_LENGTH);
+ unsigned int mdLen = 0;
+
+ if (HMAC(EVP_sha256(), userKey.data(), userKey.size(), input.data(),
+ input.size(), output.data(), &mdLen) == NULL)
+ {
+ std::cerr << "Generate HMAC_SHA256 failed\n";
+ output.resize(0);
+ }
+
+ return output;
+}
+
+std::vector<uint8_t> AlgoSHA256::generateICV(
+ const std::vector<uint8_t>& input) const
+{
+ std::vector<uint8_t> output(SHA256_DIGEST_LENGTH);
+ unsigned int mdLen = 0;
+
+ if (HMAC(EVP_sha256(),
+ sessionIntegrityKey.data(), sessionIntegrityKey.size(),
+ input.data(), input.size(), output.data(), &mdLen) == NULL)
+ {
+ std::cerr << "Generate HMAC_SHA256_128 Integrity Check Value failed\n";
+ output.resize(0);
+ }
+ output.resize(integrityCheckValueLength);
+
+ return output;
+}
+
} // namespace auth
} // namespace cipher