summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/crypto/des/random_key.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/crypto/des/random_key.c b/src/lib/crypto/des/random_key.c
index b24ec51ef..1dc4600b4 100644
--- a/src/lib/crypto/des/random_key.c
+++ b/src/lib/crypto/des/random_key.c
@@ -80,10 +80,11 @@ mit_des_generate_random_key(state, randkey)
(* state->eblock.crypto_entry->encrypt_func)
(state->sequence.data /*in*/, randkey->contents /*out*/,
state->sequence.length, eblock, zero_ivec);
- (* state->eblock.crypto_entry->encrypt_func)
- (randkey->contents /*in*/, randkey->contents /*out*/,
- randkey->length, eblock,
- randkey->contents + randkey->length - sizeof(mit_des_cblock));
+ if (state->sequence.length > sizeof(mit_des_cblock))
+ (* state->eblock.crypto_entry->encrypt_func)
+ (randkey->contents /*in*/, randkey->contents /*out*/,
+ randkey->length, eblock,
+ randkey->contents + randkey->length - sizeof(mit_des_cblock));
/* Increment the sequence number, with wraparound (LSB) */
for (i = 0; i < state->sequence.length; i++) {