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
84 if(context == NULL || key == NULL)
96 c = (keyLen > 0) ? (keyLen + 3) / 4 : 1;
104 context->
s[i] = context->
s[i - 1] +
Q32;
117 for(
s = 0;
s < v;
s++)
119 context->
s[i] +=
a +
b;
120 context->
s[i] =
ROL32(context->
s[i], 3);
123 context->
l[j] +=
a +
b;
124 context->
l[j] =
ROL32(context->
l[j], (
a +
b) % 32);
170 t = (
b * (2 *
b + 1));
173 u = (d * (2 * d + 1));
177 a =
ROL32(
a,
u % 32) + context->
s[2 * i];
180 c =
ROL32(
c,
t % 32) + context->
s[2 * i + 1];
234 u = (d * (2 * d + 1));
237 t = (
b * (2 *
b + 1));
240 c -= context->
s[2 * i + 1];
243 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)