#include "openssl/e_os2.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Ir al código fuente de este archivo.
'defines' |
#define | GETU32(pt) |
#define | PUTU32(ct, st) |
#define | CAMELLIA_SWAP4(x) |
#define | COPY4WORD(dst, src) |
#define | SWAP4WORD(word) |
#define | XOR4WORD(a, b) |
#define | XOR4WORD2(a, b, c) |
'typedefs' |
typedef unsigned char | u8 |
typedef unsigned int | u32 |
Funciones |
void | camellia_setup128 (const u8 *key, u32 *subkey) |
void | camellia_setup192 (const u8 *key, u32 *subkey) |
void | camellia_setup256 (const u8 *key, u32 *subkey) |
void | camellia_encrypt128 (const u32 *subkey, u32 *io) |
void | camellia_decrypt128 (const u32 *subkey, u32 *io) |
void | camellia_encrypt256 (const u32 *subkey, u32 *io) |
void | camellia_decrypt256 (const u32 *subkey, u32 *io) |
Documentación de los 'defines'
#define CAMELLIA_SWAP4 |
( |
|
x | ) |
|
Valor:do{\
x = ((u32)x << 16) + ((u32)x >> 16);\
x = (((u32)x & 0xff00ff) << 8) + (((u32)x >> 8) & 0xff00ff);\
} while(0)
#define COPY4WORD |
( |
|
dst, |
|
|
|
src |
|
) |
| |
Valor:do \
{ \
(dst)[0]=(src)[0]; \
(dst)[1]=(src)[1]; \
(dst)[2]=(src)[2]; \
(dst)[3]=(src)[3]; \
}while(0)
Valor:(((u32)(pt)[0] << 24) \
^ ((u32)(pt)[1] << 16) \
^ ((u32)(pt)[2] << 8) \
^ ((u32)(pt)[3]))
#define PUTU32 |
( |
|
ct, |
|
|
|
st |
|
) |
| |
Valor:{ (ct)[0] = (u8)((st) >> 24); \
(ct)[1] = (u8)((st) >> 16); \
(ct)[2] = (u8)((st) >> 8); \
(ct)[3] = (u8)(st); }
#define SWAP4WORD |
( |
|
word | ) |
|
#define XOR4WORD |
( |
|
a, |
|
|
|
b |
|
) |
| |
Valor: \
do \
{ \
(a)[0]^=(b)[0]; \
(a)[1]^=(b)[1]; \
(a)[2]^=(b)[2]; \
(a)[3]^=(b)[3]; \
}while(0)
#define XOR4WORD2 |
( |
|
a, |
|
|
|
b, |
|
|
|
c |
|
) |
| |
Valor: \
do \
{ \
(a)[0]=(b)[0]^(c)[0]; \
(a)[1]=(b)[1]^(c)[1]; \
(a)[2]=(b)[2]^(c)[2]; \
(a)[3]=(b)[3]^(c)[3]; \
}while(0)
Documentación de los 'typedefs'
Documentación de las funciones
void camellia_decrypt128 |
( |
const u32 * |
subkey, |
|
|
u32 * |
io |
|
) |
| |
void camellia_decrypt256 |
( |
const u32 * |
subkey, |
|
|
u32 * |
io |
|
) |
| |
void camellia_encrypt128 |
( |
const u32 * |
subkey, |
|
|
u32 * |
io |
|
) |
| |
Stuff related to camellia encryption/decryption
void camellia_encrypt256 |
( |
const u32 * |
subkey, |
|
|
u32 * |
io |
|
) |
| |
stuff for 192 and 256bit encryption/decryption
void camellia_setup128 |
( |
const u8 * |
key, |
|
|
u32 * |
subkey |
|
) |
| |
k == kll || klr || krl || krr (|| is concatination)
generate KL dependent subkeys
void camellia_setup192 |
( |
const u8 * |
key, |
|
|
u32 * |
subkey |
|
) |
| |
void camellia_setup256 |
( |
const u8 * |
key, |
|
|
u32 * |
subkey |
|
) |
| |
key = (kll || klr || krl || krr || krll || krlr || krrl || krrr) (|| is concatination)