diff options
author | Matt Caswell <matt@openssl.org> | 2019-06-28 17:29:42 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2019-07-01 11:18:37 +0200 |
commit | 9a131ad7477f85d40ee96853e60d0de86f5f4e09 (patch) | |
tree | b6fad564674f3cd12da7f9c617fa4c78ed943f48 /crypto/rc5 | |
parent | Ensure that rc5 doesn't try to use a key longer than 2040 bits (diff) | |
download | openssl-9a131ad7477f85d40ee96853e60d0de86f5f4e09.tar.xz openssl-9a131ad7477f85d40ee96853e60d0de86f5f4e09.zip |
Change RC5_32_set_key to return an int type
If the key is too long we now return an error.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/8834)
Diffstat (limited to 'crypto/rc5')
-rw-r--r-- | crypto/rc5/rc5_skey.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/rc5/rc5_skey.c b/crypto/rc5/rc5_skey.c index 1746406c67..43dc9320da 100644 --- a/crypto/rc5/rc5_skey.c +++ b/crypto/rc5/rc5_skey.c @@ -10,12 +10,15 @@ #include <openssl/rc5.h> #include "rc5_locl.h" -void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, - int rounds) +int RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, + int rounds) { RC5_32_INT L[64], l, ll, A, B, *S, k; int i, j, m, c, t, ii, jj; + if (len > 255) + return 0; + if ((rounds != RC5_16_ROUNDS) && (rounds != RC5_12_ROUNDS) && (rounds != RC5_8_ROUNDS)) rounds = RC5_16_ROUNDS; @@ -58,4 +61,6 @@ void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data, if (++jj >= c) jj = 0; } + + return 1; } |