aboutsummaryrefslogtreecommitdiffstats
path: root/src/kdf/kdf2
diff options
context:
space:
mode:
authorlloyd <[email protected]>2010-10-12 16:43:24 +0000
committerlloyd <[email protected]>2010-10-12 16:43:24 +0000
commite7e3af16a3540e1d7a84e085aa1ea7c55f627930 (patch)
treece25c4e74b2696c017c78c8a9afe297d0f1fcb27 /src/kdf/kdf2
parente3e02712563e03fbfd6b474cfaa7c0dfdf08f267 (diff)
Add a simple update_be to BufferedComputation that takes an integer
and writes the bytes to the stream in big-endian order. Use it in KDF2, MGF1, and FPE.
Diffstat (limited to 'src/kdf/kdf2')
-rw-r--r--src/kdf/kdf2/kdf2.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/kdf/kdf2/kdf2.cpp b/src/kdf/kdf2/kdf2.cpp
index b10077e35..51b9e41ea 100644
--- a/src/kdf/kdf2/kdf2.cpp
+++ b/src/kdf/kdf2/kdf2.cpp
@@ -6,7 +6,6 @@
*/
#include <botan/kdf2.h>
-#include <botan/get_byte.h>
namespace Botan {
@@ -23,9 +22,9 @@ SecureVector<byte> KDF2::derive(size_t out_len,
while(out_len && counter)
{
hash->update(secret, secret_len);
- for(size_t i = 0; i != 4; ++i)
- hash->update(get_byte(i, counter));
+ hash->update_be(counter);
hash->update(P, P_len);
+
SecureVector<byte> hash_result = hash->final();
size_t added = std::min(hash_result.size(), out_len);