comparison mycrypt_cfg.h @ 143:5d99163f7e32 libtomcrypt-orig

import of libtomcrypt 0.99
author Matt Johnston <matt@ucc.asn.au>
date Sun, 19 Dec 2004 11:34:45 +0000
parents 7faae8f46238
children
comparison
equal deleted inserted replaced
15:6362d3854bb4 143:5d99163f7e32
6 6
7 #ifndef MYCRYPT_CFG_H 7 #ifndef MYCRYPT_CFG_H
8 #define MYCRYPT_CFG_H 8 #define MYCRYPT_CFG_H
9 9
10 /* you can change how memory allocation works ... */ 10 /* you can change how memory allocation works ... */
11 extern void *XMALLOC(size_t n); 11 void *XMALLOC(size_t n);
12 extern void *REALLOC(void *p, size_t n); 12 void *REALLOC(void *p, size_t n);
13 extern void *XCALLOC(size_t n, size_t s); 13 void *XCALLOC(size_t n, size_t s);
14 extern void XFREE(void *p); 14 void XFREE(void *p);
15 15
16 /* change the clock function too */ 16 /* change the clock function too */
17 extern clock_t XCLOCK(void); 17 clock_t XCLOCK(void);
18 18
19 /* ch1-01-1 */ 19 /* various other functions */
20 void *XMEMCPY(void *dest, const void *src, size_t n);
21 int XMEMCMP(const void *s1, const void *s2, size_t n);
22
20 /* type of argument checking, 0=default, 1=fatal and 2=none */ 23 /* type of argument checking, 0=default, 1=fatal and 2=none */
21 #define ARGTYPE 0 24 #define ARGTYPE 0
22 /* ch1-01-1 */
23 25
24 /* Controls endianess and size of registers. Leave uncommented to get platform neutral [slower] code */ 26 /* Controls endianess and size of registers. Leave uncommented to get platform neutral [slower] code
27 *
28 * Note: in order to use the optimized macros your platform must support unaligned 32 and 64 bit read/writes.
29 * The x86 platforms allow this but some others [ARM for instance] do not. On those platforms you **MUST**
30 * use the portable [slower] macros.
31 */
32
25 /* detect x86-32 machines somewhat */ 33 /* detect x86-32 machines somewhat */
26 #if defined(INTEL_CC) || (defined(_MSC_VER) && defined(WIN32)) || (defined(__GNUC__) && (defined(__DJGPP__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__i386__))) 34 #if defined(INTEL_CC) || (defined(_MSC_VER) && defined(WIN32)) || (defined(__GNUC__) && (defined(__DJGPP__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__i386__)))
27 #define ENDIAN_LITTLE 35 #define ENDIAN_LITTLE
28 #define ENDIAN_32BITWORD 36 #define ENDIAN_32BITWORD
29 #endif 37 #endif
30 38
31 /* detects MIPS R5900 processors (PS2) */ 39 /* detects MIPS R5900 processors (PS2) */
32 #if (defined(__R5900) || defined(R5900) || defined(__R5900__)) && (defined(_mips) || defined(__mips__) || defined(mips)) 40 #if (defined(__R5900) || defined(R5900) || defined(__R5900__)) && (defined(_mips) || defined(__mips__) || defined(mips))
41 #define ENDIAN_LITTLE
42 #define ENDIAN_64BITWORD
43 #endif
44
45 /* detect amd64 */
46 #if defined(__x86_64__)
33 #define ENDIAN_LITTLE 47 #define ENDIAN_LITTLE
34 #define ENDIAN_64BITWORD 48 #define ENDIAN_64BITWORD
35 #endif 49 #endif
36 50
37 /* #define ENDIAN_LITTLE */ 51 /* #define ENDIAN_LITTLE */
44 #error You must specify a word size as well as endianess in mycrypt_cfg.h 58 #error You must specify a word size as well as endianess in mycrypt_cfg.h
45 #endif 59 #endif
46 60
47 #if !(defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) 61 #if !(defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE))
48 #define ENDIAN_NEUTRAL 62 #define ENDIAN_NEUTRAL
49 #endif
50
51 #ifdef YARROW
52 #ifndef CTR
53 #error YARROW requires CTR chaining mode to be defined!
54 #endif
55 #endif 63 #endif
56 64
57 /* packet code */ 65 /* packet code */
58 #if defined(MRSA) || defined(MDH) || defined(MECC) 66 #if defined(MRSA) || defined(MDH) || defined(MECC)
59 #define PACKET 67 #define PACKET