comparison libtomcrypt/src/headers/tomcrypt_cfg.h @ 398:59c7938af2bd

merge of '1250b8af44b62d8f4fe0f8d9fc7e7a1cc34e7e1c' and '7f8670ac3bb975f40967f3979d09d2199b7e90c8'
author Matt Johnston <matt@ucc.asn.au>
date Sat, 03 Feb 2007 08:20:30 +0000
parents 0cbe8f6dbf9e
children f849a5ca2efc
comparison
equal deleted inserted replaced
396:e7c1a77d2921 398:59c7938af2bd
5 */ 5 */
6 6
7 #ifndef TOMCRYPT_CFG_H 7 #ifndef TOMCRYPT_CFG_H
8 #define TOMCRYPT_CFG_H 8 #define TOMCRYPT_CFG_H
9 9
10 #if defined(_WIN32) || defined(_MSC_VER)
11 #define LTC_CALL __cdecl
12 #else
13 #ifndef LTC_CALL
14 #define LTC_CALL
15 #endif
16 #endif
17
18 #ifndef LTC_EXPORT
19 #define LTC_EXPORT
20 #endif
21
22 /* certain platforms use macros for these, making the prototypes broken */
23 #ifndef LTC_NO_PROTOTYPES
24
10 /* you can change how memory allocation works ... */ 25 /* you can change how memory allocation works ... */
11 void *XMALLOC(size_t n); 26 LTC_EXPORT void * LTC_CALL XMALLOC(size_t n);
12 void *XREALLOC(void *p, size_t n); 27 LTC_EXPORT void * LTC_CALL XREALLOC(void *p, size_t n);
13 void *XCALLOC(size_t n, size_t s); 28 LTC_EXPORT void * LTC_CALL XCALLOC(size_t n, size_t s);
14 void XFREE(void *p); 29 LTC_EXPORT void LTC_CALL XFREE(void *p);
30
31 LTC_EXPORT void LTC_CALL XQSORT(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));
32
15 33
16 /* change the clock function too */ 34 /* change the clock function too */
17 clock_t XCLOCK(void); 35 LTC_EXPORT clock_t LTC_CALL XCLOCK(void);
18 36
19 /* various other functions */ 37 /* various other functions */
20 void *XMEMCPY(void *dest, const void *src, size_t n); 38 LTC_EXPORT void * LTC_CALL XMEMCPY(void *dest, const void *src, size_t n);
21 int XMEMCMP(const void *s1, const void *s2, size_t n); 39 LTC_EXPORT int LTC_CALL XMEMCMP(const void *s1, const void *s2, size_t n);
40 LTC_EXPORT void * LTC_CALL XMEMSET(void *s, int c, size_t n);
22 41
23 /* type of argument checking, 0=default, 1=fatal and 2=none */ 42 LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2);
24 #define ARGTYPE 0 43
44 #endif
45
46 /* type of argument checking, 0=default, 1=fatal and 2=error+continue, 3=nothing */
47 #ifndef ARGTYPE
48 #define ARGTYPE 0
49 #endif
25 50
26 /* Controls endianess and size of registers. Leave uncommented to get platform neutral [slower] code 51 /* Controls endianess and size of registers. Leave uncommented to get platform neutral [slower] code
27 * 52 *
28 * Note: in order to use the optimized macros your platform must support unaligned 32 and 64 bit read/writes. 53 * 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** 54 * The x86 platforms allow this but some others [ARM for instance] do not. On those platforms you **MUST**
30 * use the portable [slower] macros. 55 * use the portable [slower] macros.
31 */ 56 */
32 57
33 /* detect x86-32 machines somewhat */ 58 /* 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__))) 59 #if !defined(__STRICT_ANSI__) && (defined(INTEL_CC) || (defined(_MSC_VER) && defined(WIN32)) || (defined(__GNUC__) && (defined(__DJGPP__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__i386__))))
35 #define ENDIAN_LITTLE 60 #define ENDIAN_LITTLE
36 #define ENDIAN_32BITWORD 61 #define ENDIAN_32BITWORD
37 #define LTC_FAST 62 #define LTC_FAST
38 #define LTC_FAST_TYPE unsigned long 63 #define LTC_FAST_TYPE unsigned long
39 #endif 64 #endif
43 #define ENDIAN_LITTLE 68 #define ENDIAN_LITTLE
44 #define ENDIAN_64BITWORD 69 #define ENDIAN_64BITWORD
45 #endif 70 #endif
46 71
47 /* detect amd64 */ 72 /* detect amd64 */
48 #if defined(__x86_64__) 73 #if !defined(__STRICT_ANSI__) && defined(__x86_64__)
49 #define ENDIAN_LITTLE 74 #define ENDIAN_LITTLE
50 #define ENDIAN_64BITWORD 75 #define ENDIAN_64BITWORD
51 #define LTC_FAST 76 #define LTC_FAST
52 #define LTC_FAST_TYPE unsigned long 77 #define LTC_FAST_TYPE unsigned long
53 #endif 78 #endif
79
80 /* detect PPC32 */
81 #if !defined(__STRICT_ANSI__) && defined(LTC_PPC32)
82 #define ENDIAN_BIG
83 #define ENDIAN_32BITWORD
84 #define LTC_FAST
85 #define LTC_FAST_TYPE unsigned long
86 #endif
87
88 /* detect sparc and sparc64 */
89 #if defined(__sparc__)
90 #define ENDIAN_BIG
91 #if defined(__arch64__)
92 #define ENDIAN_64BITWORD
93 #else
94 #define ENDIAN_32BITWORD
95 #endif
96 #endif
97
54 98
55 #ifdef LTC_NO_FAST 99 #ifdef LTC_NO_FAST
56 #ifdef LTC_FAST 100 #ifdef LTC_FAST
57 #undef LTC_FAST 101 #undef LTC_FAST
58 #endif 102 #endif
75 119
76 /* #define ENDIAN_32BITWORD */ 120 /* #define ENDIAN_32BITWORD */
77 /* #define ENDIAN_64BITWORD */ 121 /* #define ENDIAN_64BITWORD */
78 122
79 #if (defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) && !(defined(ENDIAN_32BITWORD) || defined(ENDIAN_64BITWORD)) 123 #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 124 #error You must specify a word size as well as endianess in tomcrypt_cfg.h
81 #endif 125 #endif
82 126
83 #if !(defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) 127 #if !(defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE))
84 #define ENDIAN_NEUTRAL 128 #define ENDIAN_NEUTRAL
85 #endif 129 #endif
86 130
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 131 #endif
108 132
109 133
110 /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_cfg.h,v $ */ 134 /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_cfg.h,v $ */
111 /* $Revision: 1.7 $ */ 135 /* $Revision: 1.19 $ */
112 /* $Date: 2005/05/05 14:35:58 $ */ 136 /* $Date: 2006/12/04 02:19:48 $ */