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 #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 25 /* you can change how memory allocation works ... */ 26 LTC_EXPORT void * LTC_CALL XMALLOC(size_t n); 27 LTC_EXPORT void * LTC_CALL XREALLOC(void *p, size_t n); 28 LTC_EXPORT void * LTC_CALL XCALLOC(size_t n, size_t s); 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 33 34 /* change the clock function too */ 35 LTC_EXPORT clock_t LTC_CALL XCLOCK(void); 36 37 /* various other functions */ 38 LTC_EXPORT void * LTC_CALL XMEMCPY(void *dest, const void *src, 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); 41 42 LTC_EXPORT int LTC_CALL XSTRCMP(const char *s1, const char *s2); 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 50 51 /* Controls endianess and size of registers. Leave uncommented to get platform neutral [slower] code 52 * 53 * Note: in order to use the optimized macros your platform must support unaligned 32 and 64 bit read/writes. 54 * The x86 platforms allow this but some others [ARM for instance] do not. On those platforms you **MUST** 55 * use the portable [slower] macros. 56 */ 57 58 /* detect x86-32 machines somewhat */ 59 #if !defined(__STRICT_ANSI__) && (defined(INTEL_CC) || (defined(_MSC_VER) && defined(WIN32)) || (defined(__GNUC__) && (defined(__DJGPP__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__i386__)))) 60 #define ENDIAN_LITTLE 61 #define ENDIAN_32BITWORD 62 #define LTC_FAST 63 #define LTC_FAST_TYPE unsigned long 64 #endif 65 66 /* detects MIPS R5900 processors (PS2) */ 67 #if (defined(__R5900) || defined(R5900) || defined(__R5900__)) && (defined(_mips) || defined(__mips__) || defined(mips)) 68 #define ENDIAN_LITTLE 69 #define ENDIAN_64BITWORD 70 #endif 71 72 /* detect amd64 */ 73 #if !defined(__STRICT_ANSI__) && defined(__x86_64__) 74 #define ENDIAN_LITTLE 75 #define ENDIAN_64BITWORD 76 #define LTC_FAST 77 #define LTC_FAST_TYPE unsigned long 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 98 99 #ifdef LTC_NO_FAST 100 #ifdef LTC_FAST 101 #undef LTC_FAST 102 #endif 103 #endif 104 105 /* No asm is a quick way to disable anything "not portable" */ 106 #ifdef LTC_NO_ASM 107 #undef ENDIAN_LITTLE 108 #undef ENDIAN_BIG 109 #undef ENDIAN_32BITWORD 110 #undef ENDIAN_64BITWORD 111 #undef LTC_FAST 112 #undef LTC_FAST_TYPE 113 #define LTC_NO_ROLC 114 #define LTC_NO_BSWAP 115 #endif 116 117 /* #define ENDIAN_LITTLE */ 118 /* #define ENDIAN_BIG */ 119 120 /* #define ENDIAN_32BITWORD */ 121 /* #define ENDIAN_64BITWORD */ 122 123 #if (defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) && !(defined(ENDIAN_32BITWORD) || defined(ENDIAN_64BITWORD)) 124 #error You must specify a word size as well as endianess in tomcrypt_cfg.h 125 #endif 126 127 #if !(defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) 128 #define ENDIAN_NEUTRAL 129 #endif 130 131 #endif 132 133 134 /* $Source: /cvs/libtom/libtomcrypt/src/headers/tomcrypt_cfg.h,v $ */ 135 /* $Revision: 1.19 $ */ 136 /* $Date: 2006/12/04 02:19:48 $ */ 137