1 module deimos.openssl.opensslv; 2 3 import deimos.openssl._d_util; 4 5 /* Numeric release version identifier: 6 * MNNFFPPS: major minor fix patch status 7 * The status nibble has one of the values 0 for development, 1 to e for betas 8 * 1 to 14, and f for release. The patch level is exactly that. 9 * For example: 10 * 0.9.3-dev 0x00903000 11 * 0.9.3-beta1 0x00903001 12 * 0.9.3-beta2-dev 0x00903002 13 * 0.9.3-beta2 0x00903002 (same as ...beta2-dev) 14 * 0.9.3 0x0090300f 15 * 0.9.3a 0x0090301f 16 * 0.9.4 0x0090400f 17 * 1.2.3z 0x102031af 18 * 19 * For continuity reasons (because 0.9.5 is already out, and is coded 20 * 0x00905100), between 0.9.5 and 0.9.6 the coding of the patch level 21 * part is slightly different, by setting the highest bit. This means 22 * that 0.9.5a looks like this: 0x0090581f. At 0.9.6, we can start 23 * with 0x0090600S... 24 * 25 * (Prior to 0.9.3-dev a different scheme was used: 0.9.2b is 0x0922.) 26 * (Prior to 0.9.5a beta1, a different scheme was used: MMNNFFRBB for 27 * major minor fix final patch/beta) 28 */ 29 30 /* Version macros for compile-time API version detection */ 31 enum 32 { 33 OPENSSL_VERSION_MAJOR = 1, 34 OPENSSL_VERSION_MINOR = 1, 35 OPENSSL_VERSION_PATCH = 0, 36 OPENSSL_VERSION_BUILD = 'h' - '`' 37 } 38 39 int OPENSSL_MAKE_VERSION(int major, int minor, int patch, int build) 40 { 41 return (major << 28) | (minor << 20) | (patch << 12) | (build << 4) | 0xf; 42 } 43 44 enum OPENSSL_VERSION_NUMBER = 45 OPENSSL_MAKE_VERSION(OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH, OPENSSL_VERSION_BUILD); 46 47 bool OPENSSL_VERSION_AT_LEAST(int major, int minor, int patch = 0, int build = 0) 48 { 49 return OPENSSL_VERSION_NUMBER >= OPENSSL_MAKE_VERSION(major, minor, patch, build); 50 } 51 52 bool OPENSSL_VERSION_BEFORE(int major, int minor, int patch = 0, int build = 0) 53 { 54 return OPENSSL_VERSION_NUMBER < OPENSSL_MAKE_VERSION(major, minor, patch, build); 55 } 56 57 version (OPENSSL_FIPS) { 58 enum OPENSSL_VERSION_TEXT = "OpenSSL 1.1.0h-fips 27 Mar 2018"; 59 } else { 60 enum OPENSSL_VERSION_TEXT = "OpenSSL 1.1.0h 27 Mar 2018"; 61 } 62 enum OPENSSL_VERSION_PTEXT = " part of " ~ OPENSSL_VERSION_TEXT; 63 64 /* The macros below are to be used for shared library (.so, .dll, ...) 65 * versioning. That kind of versioning works a bit differently between 66 * operating systems. The most usual scheme is to set a major and a minor 67 * number, and have the runtime loader check that the major number is equal 68 * to what it was at application link time, while the minor number has to 69 * be greater or equal to what it was at application link time. With this 70 * scheme, the version number is usually part of the file name, like this: 71 * 72 * libcrypto.so.0.9 73 * 74 * Some unixen also make a softlink with the major version number only: 75 * 76 * libcrypto.so.0 77 * 78 * On Tru64 and IRIX 6.x it works a little bit differently. There, the 79 * shared library version is stored in the file, and is actually a series 80 * of versions, separated by colons. The rightmost version present in the 81 * library when linking an application is stored in the application to be 82 * matched at run time. When the application is run, a check is done to 83 * see if the library version stored in the application matches any of the 84 * versions in the version string of the library itself. 85 * This version string can be constructed in any way, depending on what 86 * kind of matching is desired. However, to implement the same scheme as 87 * the one used in the other unixen, all compatible versions, from lowest 88 * to highest, should be part of the string. Consecutive builds would 89 * give the following versions strings: 90 * 91 * 3.0 92 * 3.0:3.1 93 * 3.0:3.1:3.2 94 * 4.0 95 * 4.0:4.1 96 * 97 * Notice how version 4 is completely incompatible with version, and 98 * therefore give the breach you can see. 99 * 100 * There may be other schemes as well that I haven't yet discovered. 101 * 102 * So, here's the way it works here: first of all, the library version 103 * number doesn't need at all to match the overall OpenSSL version. 104 * However, it's nice and more understandable if it actually does. 105 * The current library version is stored in the macro SHLIB_VERSION_NUMBER, 106 * which is just a piece of text in the format "M.m.e" (Major, minor, edit). 107 * For the sake of Tru64, IRIX, and any other OS that behaves in similar ways, 108 * we need to keep a history of version numbers, which is done in the 109 * macro SHLIB_VERSION_HISTORY. The numbers are separated by colons and 110 * should only keep the versions that are binary compatible with the current. 111 */ 112 enum SHLIB_VERSION_HISTORY = ""; 113 enum SHLIB_VERSION_NUMBER = "1.0.0";