diff options
| author | Tom Joseph <tomjoseph@in.ibm.com> | 2017-01-19 12:55:11 +0530 |
|---|---|---|
| committer | Tom Joseph <tomjoseph@in.ibm.com> | 2017-02-10 11:47:02 +0530 |
| commit | ef02fb3d40ed1b88596313803c3ca7b31c2521cf (patch) | |
| tree | bb4b34d05424960da3579baddf97598142c7406f /command | |
| parent | beca5acea54cd742ce2e8661faa27c51e063a3fc (diff) | |
| download | phosphor-net-ipmid-ef02fb3d40ed1b88596313803c3ca7b31c2521cf.tar.gz phosphor-net-ipmid-ef02fb3d40ed1b88596313803c3ca7b31c2521cf.zip | |
Refactor the RAKP34 implementation
Refactor the code to apply integrity algorithm to a separate
function.
Change-Id: I438165dd6fb4962084b319bbdcd53c47e0fc659f
Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
Diffstat (limited to 'command')
| -rw-r--r-- | command/rakp34.cpp | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/command/rakp34.cpp b/command/rakp34.cpp index 8277195..398a1e7 100644 --- a/command/rakp34.cpp +++ b/command/rakp34.cpp @@ -12,6 +12,27 @@ namespace command { +void applyIntegrityAlgo(const uint32_t bmcSessionID) +{ + auto session = (std::get<session::Manager&>(singletonPool).getSession( + bmcSessionID)).lock(); + + auto authAlgo = session->getAuthAlgo(); + + switch (authAlgo->intAlgo) + { + case cipher::integrity::Algorithms::HMAC_SHA1_96: + { + session->setIntegrityAlgo( + std::make_unique<cipher::integrity::AlgoSHA1>( + authAlgo->sessionIntegrityKey)); + break; + } + default: + break; + } +} + std::vector<uint8_t> RAKP34(std::vector<uint8_t>& inPayload, const message::Handler& handler) { @@ -208,18 +229,8 @@ std::vector<uint8_t> RAKP34(std::vector<uint8_t>& inPayload, // Insert the HMAC output into the payload outPayload.insert(outPayload.end(), icv.begin(), icv.end()); - // Set the Authentication Algorithm to RAKP_HMAC_SHA1 - switch (authAlgo->intAlgo) - { - case cipher::integrity::Algorithms::HMAC_SHA1_96: - { - session->setIntegrityAlgo( - std::make_unique<cipher::integrity::AlgoSHA1>(sikOutput)); - break; - } - default: - break; - } + // Set the Integrity Algorithm + applyIntegrityAlgo(session->getBMCSessionID()); session->state = session::State::ACTIVE; |

