aboutsummaryrefslogtreecommitdiff
path: root/crypto/rc5/rc5_skey.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/rc5/rc5_skey.c')
-rw-r--r--crypto/rc5/rc5_skey.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/crypto/rc5/rc5_skey.c b/crypto/rc5/rc5_skey.c
index b2e6bbb1af24..a08b940badf6 100644
--- a/crypto/rc5/rc5_skey.c
+++ b/crypto/rc5/rc5_skey.c
@@ -1,21 +1,30 @@
/*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
*
- * Licensed under the OpenSSL license (the "License"). You may not use
+ * Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
+/*
+ * RC5 low level APIs are deprecated for public use, but still ok for internal
+ * use.
+ */
+#include "internal/deprecated.h"
+
#include <openssl/rc5.h>
#include "rc5_local.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 +67,6 @@ void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
if (++jj >= c)
jj = 0;
}
+
+ return 1;
}