Validate Integrity Algo in Open Session request
Change-Id: I75de159fafd42a677b646ae6e2c5605872ebc8f3
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/command/open_session.cpp b/command/open_session.cpp
index 0c17d3d..eb98a26 100644
--- a/command/open_session.cpp
+++ b/command/open_session.cpp
@@ -28,7 +28,10 @@
}
// Check for valid Integrity Algorithms
- if (request->intAlgo != 0)
+ if ((request->intAlgo !=
+ static_cast<uint8_t>(cipher::integrity::Algorithms::NONE)) &&
+ (request->intAlgo !=
+ static_cast<uint8_t>(cipher::integrity::Algorithms::HMAC_SHA1_96)))
{
response->status_code =
static_cast<uint8_t>(RAKP_ReturnCode::INVALID_INTEGRITY_ALGO);
@@ -50,7 +53,8 @@
session = (std::get<session::Manager&>(singletonPool).startSession(
endian::from_ipmi<>(request->remoteConsoleSessionID),
static_cast<session::Privilege>(request->maxPrivLevel),
- static_cast<cipher::rakp_auth::Algorithms>(request->authAlgo)
+ static_cast<cipher::rakp_auth::Algorithms>(request->authAlgo),
+ static_cast<cipher::integrity::Algorithms>(request->intAlgo)
)).lock();
}
catch (std::exception& e)