diff options
author | Krzysztof Kwiatkowski <[email protected]> | 2017-05-04 00:20:33 +0100 |
---|---|---|
committer | Krzysztof Kwiatkowski <[email protected]> | 2017-05-04 00:20:33 +0100 |
commit | 6e088a36210f620352e07f6f52a047a813dab1a3 (patch) | |
tree | 9a95fb201ce7073e328b92449f0c923b0b46ea92 /src/lib/kdf | |
parent | 7278ed34d50c3288f93e5da550ba33361c075faa (diff) |
Align with comments from code review
Diffstat (limited to 'src/lib/kdf')
-rw-r--r-- | src/lib/kdf/sp800_56a/sp800_56a.cpp | 8 | ||||
-rw-r--r-- | src/lib/kdf/sp800_56a/sp800_56a.h | 3 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/kdf/sp800_56a/sp800_56a.cpp b/src/lib/kdf/sp800_56a/sp800_56a.cpp index 29249b99a..285cde193 100644 --- a/src/lib/kdf/sp800_56a/sp800_56a.cpp +++ b/src/lib/kdf/sp800_56a/sp800_56a.cpp @@ -1,8 +1,7 @@ /* * KDF defined in NIST SP 800-56a (Approved Alternative 1) * -* (C) 2017 Ribose Inc. -* Written by Krzysztof Kwiatkowski. +* (C) 2017 Ribose Inc. Written by Krzysztof Kwiatkowski. * * Botan is released under the Simplified BSD License (see license.txt) */ @@ -15,7 +14,8 @@ namespace Botan { namespace { -static const uint64_t MAX_REPS = (2ULL << 32); + +const uint64_t kRepsUpperBound = (1ULL << 32); // Option1: auxiliary function is a hash function template<typename T> @@ -69,7 +69,7 @@ size_t SP800_56A<AuxiliaryFunction_t>::kdf( const size_t digest_len = m_auxfunc->output_length(); size_t reps = key_len / digest_len + !!(key_len % digest_len); - if (reps >= MAX_REPS) { + if (reps >= kRepsUpperBound) { // See SP-800-56A, point 5.8.1 throw Invalid_Argument( "key_len / digest output size " diff --git a/src/lib/kdf/sp800_56a/sp800_56a.h b/src/lib/kdf/sp800_56a/sp800_56a.h index 57aeb1fd9..5f00ef0b8 100644 --- a/src/lib/kdf/sp800_56a/sp800_56a.h +++ b/src/lib/kdf/sp800_56a/sp800_56a.h @@ -1,8 +1,7 @@ /* * KDF defined in NIST SP 800-56a revision 2 (Single-step key-derivation function) * -* (C) 2017 Ribose Inc. -* Written by Krzysztof Kwiatkowski. +* (C) 2017 Ribose Inc. Written by Krzysztof Kwiatkowski. * * Botan is released under the Simplified BSD License (see license.txt) */ |