comparison src/headers/tomcrypt_cfg.h @ 191:1c15b283127b libtomcrypt-orig

Import of libtomcrypt 1.02 with manual path rename rearrangement etc
author Matt Johnston <matt@ucc.asn.au>
date Fri, 06 May 2005 13:23:02 +0000
parents
children 39d5d58461d6
comparison
equal deleted inserted replaced
143:5d99163f7e32 191:1c15b283127b
1 /* This is the build config file.
2 *
3 * With this you can setup what to inlcude/exclude automatically during any build. Just comment
4 * out the line that #define's the word for the thing you want to remove. phew!
5 */
6
7 #ifndef TOMCRYPT_CFG_H
8 #define TOMCRYPT_CFG_H
9
10 /* you can change how memory allocation works ... */
11 void *XMALLOC(size_t n);
12 void *XREALLOC(void *p, size_t n);
13 void *XCALLOC(size_t n, size_t s);
14 void XFREE(void *p);
15
16 /* change the clock function too */
17 clock_t XCLOCK(void);
18
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
23 /* type of argument checking, 0=default, 1=fatal and 2=none */
24 #define ARGTYPE 0
25
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
33 /* detect x86-32 machines somewhat */
34 #if defined(INTEL_CC) || (defined(_MSC_VER) && defined(WIN32)) || (defined(__GNUC__) && (defined(__DJGPP__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__i386__)))
35 #define ENDIAN_LITTLE
36 #define ENDIAN_32BITWORD
37 #define LTC_FAST
38 #define LTC_FAST_TYPE unsigned long
39 #endif
40
41 /* detects MIPS R5900 processors (PS2) */
42 #if (defined(__R5900) || defined(R5900) || defined(__R5900__)) && (defined(_mips) || defined(__mips__) || defined(mips))
43 #define ENDIAN_LITTLE
44 #define ENDIAN_64BITWORD
45 #endif
46
47 /* detect amd64 */
48 #if defined(__x86_64__)
49 #define ENDIAN_LITTLE
50 #define ENDIAN_64BITWORD
51 #define LTC_FAST
52 #define LTC_FAST_TYPE unsigned long
53 #endif
54
55 #ifdef LTC_NO_FAST
56 #ifdef LTC_FAST
57 #undef LTC_FAST
58 #endif
59 #endif
60
61 /* No asm is a quick way to disable anything "not portable" */
62 #ifdef LTC_NO_ASM
63 #undef ENDIAN_LITTLE
64 #undef ENDIAN_BIG
65 #undef ENDIAN_32BITWORD
66 #undef ENDIAN_64BITWORD
67 #undef LTC_FAST
68 #undef LTC_FAST_TYPE
69 #define LTC_NO_ROLC
70 #define LTC_NO_BSWAP
71 #endif
72
73 /* #define ENDIAN_LITTLE */
74 /* #define ENDIAN_BIG */
75
76 /* #define ENDIAN_32BITWORD */
77 /* #define ENDIAN_64BITWORD */
78
79 #if (defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) && !(defined(ENDIAN_32BITWORD) || defined(ENDIAN_64BITWORD))
80 #error You must specify a word size as well as endianess in mycrypt_cfg.h
81 #endif
82
83 #if !(defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE))
84 #define ENDIAN_NEUTRAL
85 #endif
86
87 /* packet code */
88 #if defined(MRSA) || defined(MDH) || defined(MECC)
89 #define PACKET
90
91 /* size of a packet header in bytes */
92 #define PACKET_SIZE 4
93
94 /* Section tags */
95 #define PACKET_SECT_RSA 0
96 #define PACKET_SECT_DH 1
97 #define PACKET_SECT_ECC 2
98 #define PACKET_SECT_DSA 3
99
100 /* Subsection Tags for the first three sections */
101 #define PACKET_SUB_KEY 0
102 #define PACKET_SUB_ENCRYPTED 1
103 #define PACKET_SUB_SIGNED 2
104 #define PACKET_SUB_ENC_KEY 3
105 #endif
106
107 #endif
108