#include "camellia.h"
#include "cmll_locl.h"
#include <string.h>
#include <stdlib.h>
Go to the source code of this file.
|
#define | RightRotate(x, s) ( ((x) >> (s)) + ((x) << (32 - s)) ) |
|
#define | LeftRotate(x, s) ( ((x) << (s)) + ((x) >> (32 - s)) ) |
|
#define | GETU32(p) (((u32)(p)[0] << 24) ^ ((u32)(p)[1] << 16) ^ ((u32)(p)[2] << 8) ^ ((u32)(p)[3])) |
|
#define | PUTU32(p, v) ((p)[0] = (u8)((v) >> 24), (p)[1] = (u8)((v) >> 16), (p)[2] = (u8)((v) >> 8), (p)[3] = (u8)(v)) |
|
#define | SBOX1_1110 Camellia_SBOX[0] |
|
#define | SBOX4_4404 Camellia_SBOX[1] |
|
#define | SBOX2_0222 Camellia_SBOX[2] |
|
#define | SBOX3_3033 Camellia_SBOX[3] |
|
#define | Camellia_Feistel(_s0, _s1, _s2, _s3, _key) |
|
#define | RotLeft128(_s0, _s1, _s2, _s3, _n) |
|
|
int | Camellia_Ekeygen (int keyBitLength, const u8 *rawKey, KEY_TABLE_TYPE k) |
|
void | Camellia_EncryptBlock_Rounds (int grandRounds, const u8 plaintext[], const KEY_TABLE_TYPE keyTable, u8 ciphertext[]) |
|
void | Camellia_EncryptBlock (int keyBitLength, const u8 plaintext[], const KEY_TABLE_TYPE keyTable, u8 ciphertext[]) |
|
void | Camellia_DecryptBlock_Rounds (int grandRounds, const u8 ciphertext[], const KEY_TABLE_TYPE keyTable, u8 plaintext[]) |
|
void | Camellia_DecryptBlock (int keyBitLength, const u8 plaintext[], const KEY_TABLE_TYPE keyTable, u8 ciphertext[]) |
|
#define Camellia_Feistel |
( |
|
_s0, |
|
|
|
_s1, |
|
|
|
_s2, |
|
|
|
_s3, |
|
|
|
_key |
|
) |
| |
Value:do {\
register
u32 _t0,_t1,_t2,_t3;\
\
_t0 = _s0 ^ (_key)[0];\
_t1 = _s1 ^ (_key)[1];\
_t2 ^= _t3;\
_s3 ^= _t3;\
_s2 ^= _t2; \
_s3 ^= _t2;\
} while(0)
Definition at line 329 of file camellia.c.
#define GETU32 |
( |
|
p | ) |
(((u32)(p)[0] << 24) ^ ((u32)(p)[1] << 16) ^ ((u32)(p)[2] << 8) ^ ((u32)(p)[3])) |
#define LeftRotate |
( |
|
x, |
|
|
|
s |
|
) |
| ( ((x) << (s)) + ((x) >> (32 - s)) ) |
#define PUTU32 |
( |
|
p, |
|
|
|
v |
|
) |
| ((p)[0] = (u8)((v) >> 24), (p)[1] = (u8)((v) >> 16), (p)[2] = (u8)((v) >> 8), (p)[3] = (u8)(v)) |
#define RightRotate |
( |
|
x, |
|
|
|
s |
|
) |
| ( ((x) >> (s)) + ((x) << (32 - s)) ) |
#define RotLeft128 |
( |
|
_s0, |
|
|
|
_s1, |
|
|
|
_s2, |
|
|
|
_s3, |
|
|
|
_n |
|
) |
| |
Value:
_s0 = (_s0<<_n) | (_s1>>(32-_n));\
_s1 = (_s1<<_n) | (_s2>>(32-_n));\
_s2 = (_s2<<_n) | (_s3>>(32-_n));\
_s3 = (_s3<<_n) | _t0;\
} while (0)
Definition at line 354 of file camellia.c.
#define SBOX1_1110 Camellia_SBOX[0] |
#define SBOX2_0222 Camellia_SBOX[2] |
#define SBOX3_3033 Camellia_SBOX[3] |
#define SBOX4_4404 Camellia_SBOX[1] |
void Camellia_DecryptBlock |
( |
int |
keyBitLength, |
|
|
const u8 |
plaintext[], |
|
|
const KEY_TABLE_TYPE |
keyTable, |
|
|
u8 |
ciphertext[] |
|
) |
| |
void Camellia_DecryptBlock_Rounds |
( |
int |
grandRounds, |
|
|
const u8 |
ciphertext[], |
|
|
const KEY_TABLE_TYPE |
keyTable, |
|
|
u8 |
plaintext[] |
|
) |
| |
void Camellia_EncryptBlock |
( |
int |
keyBitLength, |
|
|
const u8 |
plaintext[], |
|
|
const KEY_TABLE_TYPE |
keyTable, |
|
|
u8 |
ciphertext[] |
|
) |
| |
void Camellia_EncryptBlock_Rounds |
( |
int |
grandRounds, |
|
|
const u8 |
plaintext[], |
|
|
const KEY_TABLE_TYPE |
keyTable, |
|
|
u8 |
ciphertext[] |
|
) |
| |