diff options
Diffstat (limited to 'idea.c')
-rw-r--r-- | idea.c | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -11,6 +11,36 @@ ** */ +/* +** DEFINES +*/ +#define IDEAKEYSIZE 16 +#define IDEABLOCKSIZE 8 +#define ROUNDS 8 +#define KEYLEN (6*ROUNDS+4) + +/* +** MACROS +*/ +#define low16(x) ((x) & 0x0FFFF) +#define MUL(x,y) (x=mul(low16(x),y)) + + +typedef uint16_t IDEAkey[KEYLEN]; + +/* +** PROTOTYPES +*/ +static unsigned long DoIDEAIteration(unsigned char *plain1, + unsigned char *crypt1, unsigned char *plain2, + unsigned long arraysize, unsigned long nloops, + IDEAkey Z, IDEAkey DK); +static uint16_t mul(register uint16_t a, register uint16_t b); +static uint16_t inv(uint16_t x); +static void en_key_idea(uint16_t userkey[8], IDEAkey Z); +static void de_key_idea(IDEAkey Z, IDEAkey DK); +static void cipher_idea(uint16_t in[4], uint16_t out[4], IDEAkey Z); + /*********** ** DoIDEA ** ************ |