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