2 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
10 #include <openssl/rc5.h>
13 void RC5_32_set_key(RC5_32_KEY *key, int len, const unsigned char *data,
16 RC5_32_INT L[64], l, ll, A, B, *S, k;
17 int i, j, m, c, t, ii, jj;
19 if ((rounds != RC5_16_ROUNDS) &&
20 (rounds != RC5_12_ROUNDS) && (rounds != RC5_8_ROUNDS))
21 rounds = RC5_16_ROUNDS;
26 for (i = 0; i <= (len - 8); i += 8) {
43 for (i = 1; i < t; i++)
44 S[i] = (S[i - 1] + RC5_32_Q) & RC5_32_MASK;
50 for (i = 0; i < j; i++) {
51 k = (S[ii] + A + B) & RC5_32_MASK;
52 A = S[ii] = ROTATE_l32(k, 3);
54 k = (L[jj] + A + B) & RC5_32_MASK;
55 B = L[jj] = ROTATE_l32(k, m);