diff options
author | lloyd <[email protected]> | 2007-07-26 13:56:17 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2007-07-26 13:56:17 +0000 |
commit | 68a0f2fad07192a98369226216adee57ce0579b3 (patch) | |
tree | 7089e81bbc16caa821cf3f5cf28799f935b1c05c /src | |
parent | b40cf2090e7834ee7df85ffc18c3a8c3219fcd14 (diff) |
If counter overflows, truncate the output of KDF2. That effectively
limits the output to just a bit under 2^32 bytes, which is the maximum
you can request anyway.
Diffstat (limited to 'src')
-rw-r--r-- | src/kdf.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/kdf.cpp b/src/kdf.cpp index 3a7a2e025..b35fcd20a 100644 --- a/src/kdf.cpp +++ b/src/kdf.cpp @@ -101,7 +101,7 @@ SecureVector<byte> KDF2::derive(u32bit out_len, u32bit counter = 1; std::auto_ptr<HashFunction> hash(get_hash(hash_name)); - while(out_len) + while(out_len && counter) { hash->update(secret, secret_len); for(u32bit j = 0; j != 4; ++j) |