1 module libressl_d.openssl.opensslconf; 2 3 4 private static import core.stdc.config; 5 private static import libressl_d.openssl.bn; 6 private static import libressl_d.openssl.des; 7 private static import libressl_d.openssl.idea; 8 private static import libressl_d.openssl.rc2; 9 private static import libressl_d.openssl.rc4; 10 public import libressl_d.openssl.opensslfeatures; 11 /* crypto/opensslconf.h.in */ 12 13 //#if defined(_MSC_VER) && !defined(__attribute__) 14 //#define __attribute__(a) 15 //#endif 16 17 //#if defined(HEADER_CRYPTLIB_H) && !defined(OPENSSLDIR) 18 enum OPENSSLDIR = "/etc/ssl"; 19 //#endif 20 21 //#undef OPENSSL_UNISTD 22 //#define OPENSSL_UNISTD <unistd.h> 23 24 //#undef OPENSSL_EXPORT_VAR_AS_FUNCTION 25 26 static assert(libressl_d.openssl.idea.HEADER_IDEA_H); 27 alias IDEA_INT = uint; 28 29 //#if defined(HEADER_MD2_H) && !defined(MD2_INT) 30 version (none) { 31 alias MD2_INT = uint; 32 } 33 34 static assert(libressl_d.openssl.rc2.HEADER_RC2_H); 35 /* I need to put in a mod for the alpha - eay */ 36 alias RC2_INT = uint; 37 38 static assert(libressl_d.openssl.rc4.HEADER_RC4_H); 39 /* 40 * using int types make the structure larger but make the code faster 41 * on most boxes I have tested - up to %20 faster. 42 */ 43 /* 44 * I don't know what does "most" mean, but declaring "int" is a must on: 45 * - Intel P6 because partial register stalls are very expensive; 46 * - elder Alpha because it lacks byte load/store instructions; 47 */ 48 alias RC4_INT = uint; 49 50 /* 51 * This enables code handling data aligned at natural CPU word 52 * boundary. See crypto/rc4/rc4_enc.c for further details. 53 */ 54 alias RC4_CHUNK = core.stdc.config.c_ulong; 55 56 static assert(libressl_d.openssl.des.HEADER_NEW_DES_H); 57 /* 58 * If this is set to 'uint' on a DEC Alpha, this gives about a 59 * %20 speed up (longs are 8 bytes, int's are 4). 60 */ 61 alias DES_LONG = uint; 62 63 static assert(libressl_d.openssl.bn.HEADER_BN_H); 64 //version = CONFIG_HEADER_BN_H; 65 //#undef BN_LLONG 66 67 /* Should we define BN_DIV2W here? */ 68 69 /* Only one for the following should be defined */ 70 //version = SIXTY_FOUR_BIT_LONG; 71 //#undef SIXTY_FOUR_BIT 72 //#undef THIRTY_TWO_BIT 73 74 /+ 75 #if defined(HEADER_RC4_LOCL_H) && !defined(CONFIG_HEADER_RC4_LOCL_H) 76 version = CONFIG_HEADER_RC4_LOCL_H; 77 /* 78 * if this is defined data[i] is used instead of *data, this is a %20 79 * speedup on x86 80 */ 81 #undef RC4_INDEX 82 #endif 83 84 #if defined(HEADER_BF_LOCL_H) && !defined(CONFIG_HEADER_BF_LOCL_H) 85 version = CONFIG_HEADER_BF_LOCL_H; 86 #undef BF_PTR 87 #endif /* HEADER_BF_LOCL_H */ 88 89 #if defined(HEADER_DES_LOCL_H) && !defined(CONFIG_HEADER_DES_LOCL_H) 90 version = CONFIG_HEADER_DES_LOCL_H; 91 92 #if !defined(DES_DEFAULT_OPTIONS) 93 /* 94 * the following is tweaked from a config script, that is why it is a 95 * protected undef/define 96 */ 97 #if !defined(DES_PTR) 98 #undef DES_PTR 99 #endif 100 101 /* 102 * This helps C compiler generate the correct code for multiple functional 103 * units. It reduces register dependancies at the expense of 2 more 104 * registers 105 */ 106 #if !defined(DES_RISC1) 107 #undef DES_RISC1 108 #endif 109 110 #if !defined(DES_RISC2) 111 #undef DES_RISC2 112 #endif 113 114 #if defined(DES_RISC1) && defined(DES_RISC2) 115 YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED !!!!! 116 #endif 117 118 /* 119 * Unroll the inner loop, this sometimes helps, sometimes hinders. 120 * Very mucy CPU dependant 121 */ 122 #if !defined(DES_UNROLL) 123 version = DES_UNROLL; 124 #endif 125 126 /* 127 * These default values were supplied by 128 * Peter Gutman <pgut001@cs.auckland.ac.nz> 129 * They are only used if nothing else has been defined 130 */ 131 #if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) 132 /* 133 * Special defines which change the way the code is built depending on the 134 * CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find 135 * even newer MIPS CPU's, but at the moment one size fits all for 136 * optimization options. Older Sparc's work better with only UNROLL, but 137 * there's no way to tell at compile time what it is you're running on 138 */ 139 #if defined(sun) /* Newer Sparc's */ 140 version = DES_PTR; 141 version = DES_RISC1; 142 version = DES_UNROLL; 143 #elif defined(__ultrix) /* Older MIPS */ 144 version = DES_PTR; 145 version = DES_RISC2; 146 version = DES_UNROLL; 147 #elif defined(__osf1__) /* Alpha */ 148 version = DES_PTR; 149 version = DES_RISC2; 150 #elif defined(_AIX) /* RS6000 */ 151 /* Unknown */ 152 #elif defined(__hpux) /* HP-PA */ 153 /* Unknown */ 154 #elif defined(__aux) /* 68K */ 155 /* Unknown */ 156 #elif defined(__dgux) /* 88K (but P6 in latest boxes) */ 157 version = DES_UNROLL; 158 #elif defined(__sgi) /* Newer MIPS */ 159 version = DES_PTR; 160 version = DES_RISC2; 161 version = DES_UNROLL; 162 #elif defined(i386) || defined(__i386__) /* x86 boxes, should be gcc */ 163 version = DES_PTR; 164 version = DES_RISC1; 165 version = DES_UNROLL; 166 #endif /* Systems-specific speed defines */ 167 #endif 168 #endif /* DES_DEFAULT_OPTIONS */ 169 #endif /* HEADER_DES_LOCL_H */ 170 +/