Authentication Algorithm keeps record of the Integrity algo
The Integrity algorithm negotiated during Open Session Request
would be stored in the Authentication algorithm and is
activated once the session setup is successful.
Change-Id: I780680c8991487f8fd9030217793f2b0d0fa8a25
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
diff --git a/auth_algo.hpp b/auth_algo.hpp
index a905778..73e2c2b 100644
--- a/auth_algo.hpp
+++ b/auth_algo.hpp
@@ -2,6 +2,7 @@
#include <array>
#include <vector>
+#include "integrity_algo.hpp"
namespace cipher
{
@@ -45,7 +46,8 @@
class Interface
{
public:
- Interface() = default;
+ explicit Interface(integrity::Algorithms intAlgo) : intAlgo(intAlgo) {}
+ Interface() = delete;
virtual ~Interface() = default;
Interface(const Interface&) = default;
Interface& operator=(const Interface&) = default;
@@ -97,6 +99,15 @@
// Session Integrity Key
std::vector<uint8_t> sessionIntegrityKey;
+
+ /*
+ * Integrity Algorithm is activated and set in the session data only
+ * once the session setup is succeeded in the RAKP34 command. But the
+ * integrity algorithm is negotiated in the Open Session Request command
+ * . So the authentication algorithm successfully negotiated is stored
+ * in the authentication algorithm.
+ */
+ integrity::Algorithms intAlgo;
};
/*
@@ -112,7 +123,8 @@
class AlgoSHA1 : public Interface
{
public:
- AlgoSHA1() = default;
+ explicit AlgoSHA1(integrity::Algorithms intAlgo) : Interface(intAlgo) {}
+ AlgoSHA1() = delete;
~AlgoSHA1() = default;
AlgoSHA1(const AlgoSHA1&) = default;
AlgoSHA1& operator=(const AlgoSHA1&) = default;