Add phnxdeco with debian patch set (version 0.33-3).
[delutions.git] / tc / crypto / Twofish.h
blobe5dedd836b1a18cb89a7af7cc9ee378683087e2b
1 #ifndef TWOFISH_H
2 #define TWOFISH_H
4 #if defined(__cplusplus)
5 extern "C"
7 #endif
9 #ifndef u4byte
10 #define u4byte unsigned __int32
11 #endif
12 #ifndef u1byte
13 #define u1byte unsigned char
14 #endif
16 #ifndef extract_byte
17 #define extract_byte(x,n) ((u1byte)((x) >> (8 * n)))
18 #endif
20 #ifndef rotl
22 #ifdef _WIN32
23 #include <stdlib.h>
24 #pragma intrinsic(_lrotr,_lrotl)
25 #define rotr(x,n) _lrotr(x,n)
26 #define rotl(x,n) _lrotl(x,n)
27 #else
28 #define rotr(x,n) (((x)>>(n))|((x)<<(32-(n))))
29 #define rotl(x,n) (((x)<<(n))|((x)>>(32-(n))))
30 #endif
32 #endif
33 typedef struct
35 u4byte l_key[40];
36 u4byte s_key[4];
37 #if !defined (TC_MINIMIZE_CODE_SIZE) || defined (TC_WINDOWS_BOOT_TWOFISH)
38 u4byte mk_tab[4 * 256];
39 #endif
40 u4byte k_len;
41 } TwofishInstance;
43 #define TWOFISH_KS sizeof(TwofishInstance)
45 u4byte * twofish_set_key(TwofishInstance *instance, const u4byte in_key[], const u4byte key_len);
46 void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[]);
47 void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[4]);
49 #if defined(__cplusplus)
51 #endif
53 #endif // TWOFISH_H