|
|
1.1.1.4 root 1: #ifndef TWOFISH_H
2: #define TWOFISH_H
3:
1.1.1.7 ! root 4: #include "Common/Tcdefs.h"
! 5:
1.1.1.4 root 6: #if defined(__cplusplus)
7: extern "C"
8: {
9: #endif
10:
1.1 root 11: #ifndef u4byte
1.1.1.2 root 12: #define u4byte unsigned __int32
1.1 root 13: #endif
14: #ifndef u1byte
1.1.1.2 root 15: #define u1byte unsigned char
1.1 root 16: #endif
17:
18: #ifndef extract_byte
19: #define extract_byte(x,n) ((u1byte)((x) >> (8 * n)))
20: #endif
21:
22: #ifndef rotl
1.1.1.2 root 23:
24: #ifdef _WIN32
1.1 root 25: #include <stdlib.h>
26: #pragma intrinsic(_lrotr,_lrotl)
27: #define rotr(x,n) _lrotr(x,n)
28: #define rotl(x,n) _lrotl(x,n)
1.1.1.2 root 29: #else
30: #define rotr(x,n) (((x)>>(n))|((x)<<(32-(n))))
31: #define rotl(x,n) (((x)<<(n))|((x)>>(32-(n))))
32: #endif
33:
1.1 root 34: #endif
35: typedef struct
36: {
1.1.1.5 root 37: u4byte l_key[40];
38: u4byte s_key[4];
1.1.1.6 root 39: #if !defined (TC_MINIMIZE_CODE_SIZE) || defined (TC_WINDOWS_BOOT_TWOFISH)
1.1.1.5 root 40: u4byte mk_tab[4 * 256];
41: #endif
1.1 root 42: u4byte k_len;
43: } TwofishInstance;
44:
1.1.1.5 root 45: #define TWOFISH_KS sizeof(TwofishInstance)
1.1 root 46:
1.1.1.3 root 47: u4byte * twofish_set_key(TwofishInstance *instance, const u4byte in_key[], const u4byte key_len);
48: void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[]);
49: void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[4]);
1.1.1.4 root 50:
51: #if defined(__cplusplus)
52: }
53: #endif
54:
55: #endif // TWOFISH_H
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.