/[mcrypt]/libmcrypt-nm/lib/safer.h
ViewVC logotype

Contents of /libmcrypt-nm/lib/safer.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (vendor branch)
Mon May 22 13:09:10 2000 UTC (23 years, 11 months ago) by nmav
Branch: MAIN, mcrypt
CVS Tags: start, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain

1 /*******************************************************************************
2 *
3 * FILE: safer.h
4 *
5 * DESCRIPTION: block-cipher algorithm SAFER (Secure And Fast Encryption
6 * Routine) in its four versions: SAFER K-64, SAFER K-128,
7 * SAFER SK-64 and SAFER SK-128.
8 *
9 * AUTHOR: Richard De Moliner (demoliner@isi.ee.ethz.ch)
10 * Signal and Information Processing Laboratory
11 * Swiss Federal Institute of Technology
12 * CH-8092 Zuerich, Switzerland
13 *
14 * DATE: September 9, 1995
15 *
16 * CHANGE HISTORY:
17 *
18 *******************************************************************************/
19 #ifndef SAFER_H
20 #define SAFER_H
21
22 /******************* External Headers *****************************************/
23
24 /******************* Local Headers ********************************************/
25
26 /******************* Constants ************************************************/
27 #define SAFER_K64_DEFAULT_NOF_ROUNDS 6
28 #define SAFER_K128_DEFAULT_NOF_ROUNDS 10
29 #define SAFER_SK64_DEFAULT_NOF_ROUNDS 8
30 #define SAFER_SK128_DEFAULT_NOF_ROUNDS 10
31 #define SAFER_MAX_NOF_ROUNDS 13
32 #define SAFER_BLOCK_LEN 8
33 #define SAFER_KEY_LEN (1 + SAFER_BLOCK_LEN * (1 + 2 * SAFER_MAX_NOF_ROUNDS))
34
35 /******************* Assertions ***********************************************/
36
37 /******************* Macros ***************************************************/
38
39 /******************* Types ****************************************************/
40 #define safer_block_t unsigned char
41 /* [SAFER_BLOCK_LEN]; */
42 #define safer_key_t unsigned char
43 /* [SAFER_KEY_LEN]; */
44
45 /******************* Module Data **********************************************/
46
47 /******************* Prototypes ***********************************************/
48
49 /*******************************************************************************
50 * void Safer_Init_Module(void)
51 *
52 * initializes this module.
53 *
54 ********************************************************************************
55 * void Safer_Expand_Userkey(safer_block_t userkey_1,
56 * safer_block_t userkey_2,
57 * unsigned int nof_rounds,
58 * int strengthened,
59 * safer_key_t key)
60 *
61 * expands a user-selected key of length 64 bits or 128 bits to a encryption /
62 * decryption key. If your user-selected key is of length 64 bits, then give
63 * this key to both arguments 'userkey_1' and 'userkey_2', e.g.
64 * 'Safer_Expand_Userkey(z, z, key)'. Note: SAFER K-64 and SAFER SK-64 with a
65 * user-selected key 'z' of length 64 bits are identical to SAFER K-128 and
66 * SAFER SK-128 with a user-selected key 'z z' of length 128 bits,
67 * respectively.
68 * pre: 'userkey_1' contains the first 64 bits of user key.
69 * 'userkey_2' contains the second 64 bits of user key.
70 * 'nof_rounds' contains the number of encryption rounds
71 * 'nof_rounds' <= 'SAFER_MAX_NOF_ROUNDS'
72 * 'strengthened' is non-zero if the strengthened key schedule should be
73 * used and zero if the original key schedule should be
74 * used.
75 * post: 'key' contains the expanded key.
76 *
77 ********************************************************************************
78 * void Safer_Encrypt_Block(safer_block_t block_in, safer_key_t key,
79 * safer_block_t block_out)
80 *
81 * encryption algorithm.
82 * pre: 'block_in' contains the plain-text block.
83 * 'key' contains the expanded key.
84 * post: 'block_out' contains the cipher-text block.
85 *
86 ********************************************************************************
87 * void Safer_Decrypt_Block(safer_block_t block_in, safer_key_t key,
88 * safer_block_t block_out)
89 *
90 * decryption algorithm.
91 * pre: 'block_in' contains the cipher-text block.
92 * 'key' contains the expanded key.
93 * post: 'block_out' contains the plain-text block.
94 *
95 *******************************************************************************/
96
97 void _mcrypt_Safer_Init_Module();
98 void _mcrypt_Safer_Expand_Userkey(safer_block_t *userkey_1, safer_block_t *userkey_2, unsigned int nof_rounds, int strengthened, safer_key_t *key);
99 void _mcrypt_Safer_Encrypt_Block(safer_block_t *block_in, const safer_key_t* key);
100 void _mcrypt_Safer_Decrypt_Block(safer_block_t *block_in, const safer_key_t* key);
101
102 /******************************************************************************/
103 #endif /* SAFER_H */

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26