Skip to content

Commit a1f6312

Browse files
authored
Merge pull request #493 from jbech-linaro/rijndael_range
check range in _rijndael_ecb_ functions
2 parents e01e4c5 + 7b4a5c1 commit a1f6312

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/ciphers/aes/aes.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,10 @@ int ECB_ENC(const unsigned char *pt, unsigned char *ct, const symmetric_key *ske
295295
LTC_ARGCHK(skey != NULL);
296296

297297
Nr = skey->rijndael.Nr;
298+
299+
if (Nr < 2 || Nr > 16)
300+
return CRYPT_INVALID_ROUNDS;
301+
298302
rk = skey->rijndael.eK;
299303

300304
/*
@@ -475,6 +479,10 @@ int ECB_DEC(const unsigned char *ct, unsigned char *pt, const symmetric_key *ske
475479
LTC_ARGCHK(skey != NULL);
476480

477481
Nr = skey->rijndael.Nr;
482+
483+
if (Nr < 2 || Nr > 16)
484+
return CRYPT_INVALID_ROUNDS;
485+
478486
rk = skey->rijndael.dK;
479487

480488
/*

0 commit comments

Comments
 (0)