Go to the documentation of this file.
36 #define TRACE_LEVEL CRYPTO_TRACE_LEVEL
43 #if (RC6_SUPPORT == ENABLED)
46 #define P32 0xB7E15163
47 #define Q32 0x9E3779B9
85 if(context == NULL || key == NULL)
100 context->
l[i] =
LOAD32LE(buffer + i * 4);
104 c = (keyLen > 0) ? (keyLen + 3) / 4 : 1;
112 context->
s[i] = context->
s[i - 1] +
Q32;
125 for(
s = 0;
s < v;
s++)
127 context->
s[i] +=
a +
b;
128 context->
s[i] =
ROL32(context->
s[i], 3);
131 context->
l[j] +=
a +
b;
132 context->
l[j] =
ROL32(context->
l[j], (
a +
b) % 32);
178 t = (
b * (2 *
b + 1));
181 u = (d * (2 * d + 1));
185 a =
ROL32(
a,
u % 32) + context->
s[2 * i];
188 c =
ROL32(
c,
t % 32) + context->
s[2 * i + 1];
242 u = (d * (2 * d + 1));
245 t = (
b * (2 *
b + 1));
248 c -= context->
s[2 * i + 1];
251 a -= context->
s[2 * i];
void(* CipherAlgoEncryptBlock)(void *context, const uint8_t *input, uint8_t *output)
void rc6Deinit(Rc6Context *context)
Release RC6 context.
void rc6EncryptBlock(Rc6Context *context, const uint8_t *input, uint8_t *output)
Encrypt a 16-byte block using RC6 algorithm.
void rc6DecryptBlock(Rc6Context *context, const uint8_t *input, uint8_t *output)
Decrypt a 16-byte block using RC6 algorithm.
@ ERROR_INVALID_PARAMETER
Invalid parameter.
#define osMemcpy(dest, src, length)
error_t rc6Init(Rc6Context *context, const uint8_t *key, size_t keyLen)
Initialize a RC6 context using the supplied key.
void(* CipherAlgoDecryptBlock)(void *context, const uint8_t *input, uint8_t *output)
const CipherAlgo rc6CipherAlgo
@ ERROR_INVALID_KEY_LENGTH
General definitions for cryptographic algorithms.
uint32_t l[RC6_MAX_KEY_SIZE/4]
error_t(* CipherAlgoInit)(void *context, const uint8_t *key, size_t keyLen)
uint32_t s[2 *RC6_NB_ROUNDS+4]
Common interface for encryption algorithms.
#define osMemset(p, value, length)
void(* CipherAlgoDeinit)(void *context)