1 /****************************************************************************** 2 * Filename: sw_ecrypt-config.h 3 ******************************************************************************/ 4 /* ecrypt-config.h */ 5 6 /* *** Normally, it should not be necessary to edit this file. *** */ 7 8 #ifndef ECRYPT_CONFIG 9 #define ECRYPT_CONFIG 10 11 /* ------------------------------------------------------------------------- */ 12 13 /* Guess the endianness of the target architecture. */ 14 15 /* 16 * The LITTLE endian machines: 17 */ 18 #if (!defined(ECRYPT_LITTLE_ENDIAN)) 19 #if defined(__ultrix) /* Older MIPS */ 20 #define ECRYPT_LITTLE_ENDIAN 21 #elif defined(__alpha) /* Alpha */ 22 #define ECRYPT_LITTLE_ENDIAN 23 #elif defined(i386) /* x86 (gcc) */ 24 #define ECRYPT_LITTLE_ENDIAN 25 #elif defined(__i386) /* x86 (gcc) */ 26 #define ECRYPT_LITTLE_ENDIAN 27 #elif defined(_M_IX86) /* x86 (MSC, Borland) */ 28 #define ECRYPT_LITTLE_ENDIAN 29 #elif defined(_MSC_VER) /* x86 (surely MSC) */ 30 #define ECRYPT_LITTLE_ENDIAN 31 #elif defined(__INTEL_COMPILER) /* x86 (surely Intel compiler icl.exe) */ 32 #define ECRYPT_LITTLE_ENDIAN 33 34 /* 35 * The BIG endian machines: 36 */ 37 #elif defined(sun) /* Newer Sparc's */ 38 #define ECRYPT_BIG_ENDIAN 39 #elif defined(__ppc__) /* PowerPC */ 40 #define ECRYPT_BIG_ENDIAN 41 42 /* 43 * Finally machines with UNKNOWN endianness: 44 */ 45 #elif defined(_AIX) /* RS6000 */ 46 #define ECRYPT_UNKNOWN 47 #elif defined(__hpux) /* HP-PA */ 48 #define ECRYPT_UNKNOWN 49 #elif defined(__aux) /* 68K */ 50 #define ECRYPT_UNKNOWN 51 #elif defined(__dgux) /* 88K (but P6 in latest boxes) */ 52 #define ECRYPT_UNKNOWN 53 #elif defined(__sgi) /* Newer MIPS */ 54 #define ECRYPT_UNKNOWN 55 #else /* Any other processor */ 56 #define ECRYPT_UNKNOWN 57 #endif 58 #endif 59 60 /* ------------------------------------------------------------------------- */ 61 62 /* 63 * Find minimal-width types to store 8-bit, 16-bit, 32-bit, and 64-bit 64 * integers. 65 * 66 * Note: to enable 64-bit types on 32-bit compilers, it might be 67 * necessary to switch from ISO C90 mode to ISO C99 mode (e.g., gcc 68 * -std=c99). 69 */ 70 71 #include <limits.h> 72 73 /* --- check char --- */ 74 75 #if (UCHAR_MAX / 0xFU > 0xFU) 76 #ifndef I8T 77 #define I8T char 78 #define U8C(v) (v##U) 79 80 #if (UCHAR_MAX == 0xFFU) 81 #define ECRYPT_I8T_IS_BYTE 82 #endif 83 84 #endif 85 86 #if (UCHAR_MAX / 0xFFU > 0xFFU) 87 #ifndef I16T 88 #define I16T char 89 #define U16C(v) (v##U) 90 #endif 91 92 #if (UCHAR_MAX / 0xFFFFU > 0xFFFFU) 93 #ifndef I32T 94 #define I32T char 95 #define U32C(v) (v##U) 96 #endif 97 98 #if (UCHAR_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU) 99 #ifndef I64T 100 #define I64T char 101 #define U64C(v) (v##U) 102 #define ECRYPT_NATIVE64 103 #endif 104 105 #endif 106 #endif 107 #endif 108 #endif 109 110 /* --- check short --- */ 111 112 #if (USHRT_MAX / 0xFU > 0xFU) 113 #ifndef I8T 114 #define I8T short 115 #define U8C(v) (v##U) 116 117 #if (USHRT_MAX == 0xFFU) 118 #define ECRYPT_I8T_IS_BYTE 119 #endif 120 121 #endif 122 123 #if (USHRT_MAX / 0xFFU > 0xFFU) 124 #ifndef I16T 125 #define I16T short 126 #define U16C(v) (v##U) 127 #endif 128 129 #if (USHRT_MAX / 0xFFFFU > 0xFFFFU) 130 #ifndef I32T 131 #define I32T short 132 #define U32C(v) (v##U) 133 #endif 134 135 #if (USHRT_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU) 136 #ifndef I64T 137 #define I64T short 138 #define U64C(v) (v##U) 139 #define ECRYPT_NATIVE64 140 #endif 141 142 #endif 143 #endif 144 #endif 145 #endif 146 147 /* --- check int --- */ 148 149 #if (UINT_MAX / 0xFU > 0xFU) 150 #ifndef I8T 151 #define I8T int 152 #define U8C(v) (v##U) 153 154 #if (ULONG_MAX == 0xFFU) 155 #define ECRYPT_I8T_IS_BYTE 156 #endif 157 158 #endif 159 160 #if (UINT_MAX / 0xFFU > 0xFFU) 161 #ifndef I16T 162 #define I16T int 163 #define U16C(v) (v##U) 164 #endif 165 166 #if (UINT_MAX / 0xFFFFU > 0xFFFFU) 167 #ifndef I32T 168 #define I32T int 169 #define U32C(v) (v##U) 170 #endif 171 172 #if (UINT_MAX / 0xFFFFFFFFU > 0xFFFFFFFFU) 173 #ifndef I64T 174 #define I64T int 175 #define U64C(v) (v##U) 176 #define ECRYPT_NATIVE64 177 #endif 178 179 #endif 180 #endif 181 #endif 182 #endif 183 184 /* --- check long --- */ 185 186 #if (ULONG_MAX / 0xFUL > 0xFUL) 187 #ifndef I8T 188 #define I8T long 189 #define U8C(v) (v##UL) 190 191 #if (ULONG_MAX == 0xFFUL) 192 #define ECRYPT_I8T_IS_BYTE 193 #endif 194 195 #endif 196 197 #if (ULONG_MAX / 0xFFUL > 0xFFUL) 198 #ifndef I16T 199 #define I16T long 200 #define U16C(v) (v##UL) 201 #endif 202 203 #if (ULONG_MAX / 0xFFFFUL > 0xFFFFUL) 204 #ifndef I32T 205 #define I32T long 206 #define U32C(v) (v##UL) 207 #endif 208 209 #if (ULONG_MAX / 0xFFFFFFFFUL > 0xFFFFFFFFUL) 210 #ifndef I64T 211 #define I64T long 212 #define U64C(v) (v##UL) 213 #define ECRYPT_NATIVE64 214 #endif 215 216 #endif 217 #endif 218 #endif 219 #endif 220 221 /* --- check long long --- */ 222 223 #ifdef ULLONG_MAX 224 225 #if (ULLONG_MAX / 0xFULL > 0xFULL) 226 #ifndef I8T 227 #define I8T long long 228 #define U8C(v) (v##ULL) 229 230 #if (ULLONG_MAX == 0xFFULL) 231 #define ECRYPT_I8T_IS_BYTE 232 #endif 233 234 #endif 235 236 #if (ULLONG_MAX / 0xFFULL > 0xFFULL) 237 #ifndef I16T 238 #define I16T long long 239 #define U16C(v) (v##ULL) 240 #endif 241 242 #if (ULLONG_MAX / 0xFFFFULL > 0xFFFFULL) 243 #ifndef I32T 244 #define I32T long long 245 #define U32C(v) (v##ULL) 246 #endif 247 248 #if (ULLONG_MAX / 0xFFFFFFFFULL > 0xFFFFFFFFULL) 249 #ifndef I64T 250 #define I64T long long 251 #define U64C(v) (v##ULL) 252 #endif 253 254 #endif 255 #endif 256 #endif 257 #endif 258 259 #endif 260 261 /* --- check __int64 --- */ 262 263 #ifdef _UI64_MAX 264 265 #if (_UI64_MAX / 0xFFFFFFFFui64 > 0xFFFFFFFFui64) 266 #ifndef I64T 267 #define I64T __int64 268 #define U64C(v) (v##ui64) 269 #endif 270 271 #endif 272 273 #endif 274 275 /* ------------------------------------------------------------------------- */ 276 277 #endif 278