diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a0bc7a1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +# Generated version file +/source/deimos/openssl/version_.d + +# DUB artifacts +/.dub/ +/openssl +/*-test-library diff --git a/README b/README deleted file mode 100644 index 20bda83..0000000 --- a/README +++ /dev/null @@ -1,31 +0,0 @@ -OpenSSL D interface -------------------- - -From the OpenSSL website: "The OpenSSL Project is a collaborative effort to -develop a robust, commercial-grade, full-featured, and Open Source toolkit -implementing the Secure Sockets Layer (SSL v2/v3) and Transport Layer Security -(TLS v1) protocols as well as a full-strength general purpose cryptography -library. The project is managed by a worldwide community of volunteers that -use the Internet to communicate, plan, and develop the OpenSSL toolkit and its -related documentation." - -Library version: 1.1.0h - -Status: (Almost) complete, typical application should build fine. Most of the -functions from are not available due to missing Kerberos -headers. - -The OpenSSL headers are huge (>35k LOC) and make quite liberal use of the C -preprocessor, and thus a fully automatic translation is as desirable as -it is infeasible. This repository contains the result of a semi-automatic -approach, and while all header files have been ported (and successfully -compile), some preprocessor artifacts still need to be ported (currently -commented out and tagged with a FIXME note). - -The OPENSSL_NO_* family of conditional compilation switches has been -translated to D version()s, none of which is set by default. - -License: The OpenSSL toolkit is under a dual license, i.e. both the conditions -of the OpenSSL License and the original SSLeay license apply to the toolkit. -See the OpenSSL distribution for details. These interface files are a derived -work and do not impose any additional restrictions. diff --git a/README.md b/README.md new file mode 100644 index 0000000..7794b9d --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +OpenSSL D interface +------------------- + +From the OpenSSL website: + +> The OpenSSL Project is a collaborative effort to develop a robust, +> commercial-grade, full-featured, and Open Source toolkit +> implementing the Secure Sockets Layer (SSL v2/v3) and Transport +> Layer Security (TLS v1) protocols as well as a full-strength general +> purpose cryptography library. The project is managed by a worldwide +> community of volunteers that use the Internet to communicate, plan, +> and develop the OpenSSL toolkit and its related documentation. + +This repository contains D bindings for OpenSSL. + +Status: Varies, depending on targeted OpenSSL version. + +The OpenSSL headers are huge (>35k LOC) and make quite liberal use of the C +preprocessor, and thus a fully automatic translation is as desirable as +it is infeasible. This repository contains the result of a semi-automatic +approach, and while all header files have been ported (and successfully +compile), some preprocessor artifacts still need to be ported (currently +commented out and tagged with a `FIXME` note). + +The latest version of this package aims to provide compatibility with +[current versions of OpenSSL](https://www.openssl.org/news/changelog.html); +to facilitate this, a build script will detect the OpenSSL version on the +host system and configure the bindings appropriately. This will be done +automatically when using these bindings with Dub. + +### License + +The OpenSSL toolkit is under a dual license, i.e. both the conditions +of the OpenSSL License and the original SSLeay license apply to the toolkit. +See the OpenSSL distribution for details. These interface files are a derived +work and do not impose any additional restrictions. diff --git a/dub.sdl b/dub.sdl index 53f9f75..c40c2d4 100644 --- a/dub.sdl +++ b/dub.sdl @@ -3,13 +3,21 @@ description "Deimos bindings for the OpenSSL cryptographic library" homepage "http://www.openssl.org/" license "OpenSSL or SSLeay" libs "ssl" "crypto" platform="posix" -importPaths "." -configuration "library" { +configuration "library-autodetect" { targetType "sourceLibrary" - excludedSourceFiles "deimos/openssl/applink.d" + excludedSourceFiles "source/deimos/openssl/applink.d" + preGenerateCommands `${DUB} scripts/generate_version.d` platform="posix" + versions `DeimosOpenSSLAutoDetect` } +configuration "library-manual-version" { + targetType "sourceLibrary" + excludedSourceFiles "source/deimos/openssl/applink.d" +} + +// Includes a module to replace `applink.c` as described in: +// https://www.openssl.org/docs/manmaster/man3/OPENSSL_Applink.html configuration "library-applink" { targetType "sourceLibrary" } @@ -17,6 +25,7 @@ configuration "library-applink" { configuration "unittest" { targetType "executable" dflags "-main" - sourcePaths "deimos/openssl" - excludedSourceFiles "deimos/openssl/applink.d" + excludedSourceFiles "source/deimos/openssl/applink.d" + preGenerateCommands `${DUB} scripts/generate_version.d` platform="posix" + versions `DeimosOpenSSLAutoDetect` } diff --git a/scripts/generate_version.d b/scripts/generate_version.d new file mode 100644 index 0000000..6471eca --- /dev/null +++ b/scripts/generate_version.d @@ -0,0 +1,112 @@ +/+ dub.sdl: + name "script" + +/ + +/** + * This program will attempt to detect which version of openssl is installed + * + * End-users might have different versions of OpenSSL installed. + * The version might ever differ among members of a development team. + * + * This script attempts to first calls `pkg-config` to find out the version, + * then reverts to calling the `openssl` binary if `pkg-config` didn't work. + * + * It is called directly as a `preGenerateCommand` (see dub.sdl). + * To use it with another build system, pass the directory in which to write + * the `version_.d` file as first and only argument. The directory + * must exist, this script will not create it. + */ +module generate_version; + +import std.algorithm; +import std.conv; +import std.file; +import std.functional; +import std.path; +import std.process; +import std.range; +import std.stdio; +import std.string; +import std.uni; + +// file full path is: $SOME_PATH/openssl/scripts/generate_version.d +// We want: $SOME_PATH/openssl/deimos/openssl/ +immutable TARGET_DIR_PATH = __FILE_FULL_PATH__ + .dirName.dirName.buildPath("source", "deimos", "openssl"); + +void main(string[] args) +{ + string target; + + if (args.length == 2) + { + assert(args[1].isDir(), + "OpenSSL version detection: Argument '" ~ args[1] ~ "' is not a directory"); + target = args[1].buildPath("version_.d"); + } + else + { + assert(args.length == 1, + "OpenSSL version detection expects only one argument, " ~ + "a directory path where to write `version_.d`"); + target = TARGET_DIR_PATH.buildPath("version_.d"); + } + + string opensslVersion; + try + { + const res = execute(["pkg-config", "openssl", "--modversion"]); + if (res.status == 0) + opensslVersion = res.output.strip(); + } + catch (Exception e) {} + + if (!opensslVersion.length) try + { + const res = execute(["openssl", "version"]).output; + if (res.canFind("OpenSSL ")) + { + opensslVersion = res.splitter(" ").dropOne.front.filter!(not!(std.uni.isAlpha)).text; + } + else if (res.canFind("LibreSSL ")) + { + writeln("\tWarning: Your default openssl binary points to LibreSSL, which is not supported."); + version (OSX) + { + writeln("\tOn Mac OSX, this is the default behavior."); + writeln("\tIf you installed openssl via a package manager, you need to tell DUB how to find it."); + writeln("\tAssuming brew, run [brew link openssl] and follow the instructions for pkg-config.\n"); + } + } + } + catch (Exception e) {} + + if (!opensslVersion.length) + { + writeln("\tWarning: Could not find OpenSSL version via pkg-config nor by calling the openssl binary."); + writeln("\tAssuming version 1.1.0."); + writeln("\tYou might need to export PKG_CONFIG_PATH or install the openssl package if you have a library-only package."); + opensslVersion = "1.1.0h"; + } + auto data = format(q{/** + * Provide the version of the libssl being linked to at compile time + * + * This module was auto-generated by deimos/openssl's script/generate_version.d + * Manual edit might get overwritten by later build. + * + * This module should not be directly dependend upon. + * Instead, use `deimos.openssl.opensslv`, which handles explicit overrides + * provides a uniform interface, and a few utilities. + */ +module deimos.openssl.version_; + +/// Ditto +package enum OpenSSLTextVersion = "%s"; +}, opensslVersion); + + // Only write the file iff it has changed or didn't exist before. + // This way timestamp-based build system will not rebuild, + // and changes on the installed OpenSSL will be correctly detected. + if (!target.exists || target.readText.strip != data.strip) + data.toFile(target); +} diff --git a/deimos/openssl/_d_util.d b/source/deimos/openssl/_d_util.d similarity index 100% rename from deimos/openssl/_d_util.d rename to source/deimos/openssl/_d_util.d diff --git a/deimos/openssl/aes.d b/source/deimos/openssl/aes.d similarity index 100% rename from deimos/openssl/aes.d rename to source/deimos/openssl/aes.d diff --git a/deimos/openssl/applink.d b/source/deimos/openssl/applink.d similarity index 77% rename from deimos/openssl/applink.d rename to source/deimos/openssl/applink.d index 22f7056..c6c4f01 100644 --- a/deimos/openssl/applink.d +++ b/source/deimos/openssl/applink.d @@ -1,4 +1,14 @@ +/** + * Glue between OpenSSL BIO and Win32 compiler run-time + * + * Duplicate the content of the `applink.c` source file + * to avoid linking it in user code without adding a dependency + * to a C build system/compiler. + * + * See_Also: https://www.openssl.org/docs/manmaster/man3/OPENSSL_Applink.html + */ module deimos.openssl.applink; + import core.stdc.stdio; import std.stdio : _fileno, _setmode, _O_BINARY; import core.sys.posix.fcntl; @@ -35,53 +45,53 @@ enum _O_TEXT = 0x4000; extern(C) { - void *app_stdin() - { - return cast(void*)stdin; + void *app_stdin() + { + return cast(void*)stdin; } - - void *app_stdout() - { - return cast(void*)stdout; + + void *app_stdout() + { + return cast(void*)stdout; } - - void *app_stderr() - { - return cast(void*)stderr; + + void *app_stderr() + { + return cast(void*)stderr; } - - int app_feof(FILE *fp) - { - return feof(fp); + + int app_feof(FILE *fp) + { + return feof(fp); } - - int app_ferror(FILE *fp) - { - return ferror(fp); + + int app_ferror(FILE *fp) + { + return ferror(fp); } - + void app_clearerr(FILE *fp) - { - clearerr(fp); + { + clearerr(fp); } - - int app_fileno(FILE *fp) - { - return _fileno(fp); + + int app_fileno(FILE *fp) + { + return _fileno(fp); } - + int app_fsetmod(FILE *fp, char mod) - { - return _setmode (_fileno(fp),mod=='b'?_O_BINARY:_O_TEXT); + { + return _setmode (_fileno(fp),mod=='b'?_O_BINARY:_O_TEXT); } - + __gshared bool once = true; __gshared void*[APPLINK_MAX+1] OPENSSL_ApplinkTable = cast(void*)APPLINK_MAX; - + export void** OPENSSL_Applink() - { + { if (once) - { + { OPENSSL_ApplinkTable[APPLINK_STDIN] = &app_stdin; OPENSSL_ApplinkTable[APPLINK_STDOUT] = &app_stdout; OPENSSL_ApplinkTable[APPLINK_STDERR] = &app_stderr; @@ -92,7 +102,7 @@ extern(C) OPENSSL_ApplinkTable[APPLINK_FSETMOD] = &app_fsetmod; OPENSSL_ApplinkTable[APPLINK_FEOF] = &app_feof; OPENSSL_ApplinkTable[APPLINK_FCLOSE] = &fclose; - + OPENSSL_ApplinkTable[APPLINK_FOPEN] = &fopen; OPENSSL_ApplinkTable[APPLINK_FSEEK] = &fseek; OPENSSL_ApplinkTable[APPLINK_FTELL] = &ftell; @@ -100,16 +110,16 @@ extern(C) OPENSSL_ApplinkTable[APPLINK_FERROR] = &app_ferror; OPENSSL_ApplinkTable[APPLINK_CLEARERR] = &app_clearerr; OPENSSL_ApplinkTable[APPLINK_FILENO] = &app_fileno; - + OPENSSL_ApplinkTable[APPLINK_OPEN] = &fopen; OPENSSL_ApplinkTable[APPLINK_READ] = &fread; OPENSSL_ApplinkTable[APPLINK_WRITE] = &fwrite; OPENSSL_ApplinkTable[APPLINK_LSEEK] = &fseek; OPENSSL_ApplinkTable[APPLINK_CLOSE] = &fclose; - + once = false; } - + return OPENSSL_ApplinkTable.ptr; } -} \ No newline at end of file +} diff --git a/deimos/openssl/asn1.d b/source/deimos/openssl/asn1.d similarity index 100% rename from deimos/openssl/asn1.d rename to source/deimos/openssl/asn1.d diff --git a/deimos/openssl/asn1_mac.d b/source/deimos/openssl/asn1_mac.d similarity index 100% rename from deimos/openssl/asn1_mac.d rename to source/deimos/openssl/asn1_mac.d diff --git a/deimos/openssl/asn1t.d b/source/deimos/openssl/asn1t.d similarity index 100% rename from deimos/openssl/asn1t.d rename to source/deimos/openssl/asn1t.d diff --git a/deimos/openssl/bio.d b/source/deimos/openssl/bio.d similarity index 100% rename from deimos/openssl/bio.d rename to source/deimos/openssl/bio.d diff --git a/deimos/openssl/blowfish.d b/source/deimos/openssl/blowfish.d similarity index 100% rename from deimos/openssl/blowfish.d rename to source/deimos/openssl/blowfish.d diff --git a/deimos/openssl/bn.d b/source/deimos/openssl/bn.d similarity index 100% rename from deimos/openssl/bn.d rename to source/deimos/openssl/bn.d diff --git a/deimos/openssl/buffer.d b/source/deimos/openssl/buffer.d similarity index 100% rename from deimos/openssl/buffer.d rename to source/deimos/openssl/buffer.d diff --git a/deimos/openssl/camellia.d b/source/deimos/openssl/camellia.d similarity index 100% rename from deimos/openssl/camellia.d rename to source/deimos/openssl/camellia.d diff --git a/deimos/openssl/cast_.d b/source/deimos/openssl/cast_.d similarity index 100% rename from deimos/openssl/cast_.d rename to source/deimos/openssl/cast_.d diff --git a/deimos/openssl/cmac.d b/source/deimos/openssl/cmac.d similarity index 100% rename from deimos/openssl/cmac.d rename to source/deimos/openssl/cmac.d diff --git a/deimos/openssl/cms.d b/source/deimos/openssl/cms.d similarity index 100% rename from deimos/openssl/cms.d rename to source/deimos/openssl/cms.d diff --git a/deimos/openssl/comp.d b/source/deimos/openssl/comp.d similarity index 100% rename from deimos/openssl/comp.d rename to source/deimos/openssl/comp.d diff --git a/deimos/openssl/conf.d b/source/deimos/openssl/conf.d similarity index 100% rename from deimos/openssl/conf.d rename to source/deimos/openssl/conf.d diff --git a/deimos/openssl/conf_api.d b/source/deimos/openssl/conf_api.d similarity index 100% rename from deimos/openssl/conf_api.d rename to source/deimos/openssl/conf_api.d diff --git a/deimos/openssl/crypto.d b/source/deimos/openssl/crypto.d similarity index 100% rename from deimos/openssl/crypto.d rename to source/deimos/openssl/crypto.d diff --git a/deimos/openssl/des.d b/source/deimos/openssl/des.d similarity index 100% rename from deimos/openssl/des.d rename to source/deimos/openssl/des.d diff --git a/deimos/openssl/des_old.d b/source/deimos/openssl/des_old.d similarity index 100% rename from deimos/openssl/des_old.d rename to source/deimos/openssl/des_old.d diff --git a/deimos/openssl/dh.d b/source/deimos/openssl/dh.d similarity index 100% rename from deimos/openssl/dh.d rename to source/deimos/openssl/dh.d diff --git a/deimos/openssl/dsa.d b/source/deimos/openssl/dsa.d similarity index 100% rename from deimos/openssl/dsa.d rename to source/deimos/openssl/dsa.d diff --git a/deimos/openssl/dso.d b/source/deimos/openssl/dso.d similarity index 100% rename from deimos/openssl/dso.d rename to source/deimos/openssl/dso.d diff --git a/deimos/openssl/dtls1.d b/source/deimos/openssl/dtls1.d similarity index 100% rename from deimos/openssl/dtls1.d rename to source/deimos/openssl/dtls1.d diff --git a/deimos/openssl/e_os2.d b/source/deimos/openssl/e_os2.d similarity index 100% rename from deimos/openssl/e_os2.d rename to source/deimos/openssl/e_os2.d diff --git a/deimos/openssl/ebcdic.d b/source/deimos/openssl/ebcdic.d similarity index 100% rename from deimos/openssl/ebcdic.d rename to source/deimos/openssl/ebcdic.d diff --git a/deimos/openssl/ec.d b/source/deimos/openssl/ec.d similarity index 100% rename from deimos/openssl/ec.d rename to source/deimos/openssl/ec.d diff --git a/deimos/openssl/ecdh.d b/source/deimos/openssl/ecdh.d similarity index 100% rename from deimos/openssl/ecdh.d rename to source/deimos/openssl/ecdh.d diff --git a/deimos/openssl/ecdsa.d b/source/deimos/openssl/ecdsa.d similarity index 100% rename from deimos/openssl/ecdsa.d rename to source/deimos/openssl/ecdsa.d diff --git a/deimos/openssl/engine.d b/source/deimos/openssl/engine.d similarity index 100% rename from deimos/openssl/engine.d rename to source/deimos/openssl/engine.d diff --git a/deimos/openssl/err.d b/source/deimos/openssl/err.d similarity index 100% rename from deimos/openssl/err.d rename to source/deimos/openssl/err.d diff --git a/deimos/openssl/evp.d b/source/deimos/openssl/evp.d similarity index 100% rename from deimos/openssl/evp.d rename to source/deimos/openssl/evp.d diff --git a/deimos/openssl/hmac.d b/source/deimos/openssl/hmac.d similarity index 100% rename from deimos/openssl/hmac.d rename to source/deimos/openssl/hmac.d diff --git a/deimos/openssl/idea.d b/source/deimos/openssl/idea.d similarity index 100% rename from deimos/openssl/idea.d rename to source/deimos/openssl/idea.d diff --git a/deimos/openssl/krb5_asn.d b/source/deimos/openssl/krb5_asn.d similarity index 100% rename from deimos/openssl/krb5_asn.d rename to source/deimos/openssl/krb5_asn.d diff --git a/deimos/openssl/kssl.d b/source/deimos/openssl/kssl.d similarity index 100% rename from deimos/openssl/kssl.d rename to source/deimos/openssl/kssl.d diff --git a/deimos/openssl/lhash.d b/source/deimos/openssl/lhash.d similarity index 100% rename from deimos/openssl/lhash.d rename to source/deimos/openssl/lhash.d diff --git a/deimos/openssl/md4.d b/source/deimos/openssl/md4.d similarity index 100% rename from deimos/openssl/md4.d rename to source/deimos/openssl/md4.d diff --git a/deimos/openssl/md5.d b/source/deimos/openssl/md5.d similarity index 100% rename from deimos/openssl/md5.d rename to source/deimos/openssl/md5.d diff --git a/deimos/openssl/mdc2.d b/source/deimos/openssl/mdc2.d similarity index 100% rename from deimos/openssl/mdc2.d rename to source/deimos/openssl/mdc2.d diff --git a/deimos/openssl/modes.d b/source/deimos/openssl/modes.d similarity index 100% rename from deimos/openssl/modes.d rename to source/deimos/openssl/modes.d diff --git a/deimos/openssl/obj_mac.d b/source/deimos/openssl/obj_mac.d similarity index 100% rename from deimos/openssl/obj_mac.d rename to source/deimos/openssl/obj_mac.d diff --git a/deimos/openssl/objects.d b/source/deimos/openssl/objects.d similarity index 100% rename from deimos/openssl/objects.d rename to source/deimos/openssl/objects.d diff --git a/deimos/openssl/ocsp.d b/source/deimos/openssl/ocsp.d similarity index 100% rename from deimos/openssl/ocsp.d rename to source/deimos/openssl/ocsp.d diff --git a/deimos/openssl/opensslconf.d b/source/deimos/openssl/opensslconf.d similarity index 100% rename from deimos/openssl/opensslconf.d rename to source/deimos/openssl/opensslconf.d diff --git a/deimos/openssl/opensslv.d b/source/deimos/openssl/opensslv.d similarity index 55% rename from deimos/openssl/opensslv.d rename to source/deimos/openssl/opensslv.d index 5891c62..2236934 100644 --- a/deimos/openssl/opensslv.d +++ b/source/deimos/openssl/opensslv.d @@ -1,7 +1,93 @@ +/** + * Module to deal with the library version being used + * + * This library provide bindings for a wide range of OpenSSL versions, + * ranging from v0.9.x to v3.0.x. Some versions are not compatible with + * one another, either due to different ABI or different behavior, + * for example OpenSSL 1.0 requires initialization but later versions do not. + * + * While things tend to mostly work or error out while linking when the version + * the bindings assume and the actually C library version are too different, + * we prefer to try detecting the currently used version, and allow users + * to specify the version explicitly, before falling back to the latest bindings + */ module deimos.openssl.opensslv; import deimos.openssl._d_util; +version (DeimosOpenSSL_1_0_0) +{ + // https://www.openssl.org/news/changelog.html#openssl-100 + // OpenSSL 1.0.0t was released 2015-12-03 + public alias OpenSSLVersion = OpenSSLVersionTemplate!"1.0.0t"; +} +else version (DeimosOpenSSL_1_0_1) +{ + // https://www.openssl.org/news/changelog.html#openssl-101 + // OpenSSL 1.0.1u was released 2016-09-22 + public alias OpenSSLVersion = OpenSSLVersionTemplate!"1.0.1u"; +} +else version (DeimosOpenSSL_1_0_2) +{ + // https://www.openssl.org/news/changelog.html#openssl-102 + // OpenSSL 1.0.2t was released 2019-09-10 + public alias OpenSSLVersion = OpenSSLVersionTemplate!"1.0.2t"; +} +else version (DeimosOpenSSL_1_1_0) +{ + // https://www.openssl.org/news/changelog.html#openssl-110 + // OpenSSL 1.1.0l was released 2019-09-10 + public alias OpenSSLVersion = OpenSSLVersionTemplate!"1.1.0l"; +} +else version (DeimosOpenSSL_1_1_1) +{ + // https://www.openssl.org/news/changelog.html#openssl-111 + // OpenSSL 1.1.1m was released 2021-12-14 + public alias OpenSSLVersion = OpenSSLVersionTemplate!"1.1.1m"; +} +else version (DeimosOpenSSL_3_0) +{ + // https://www.openssl.org/news/changelog.html#openssl-30 + // OpenSSL 3.0.3 was released 2022-05-03 + public alias OpenSSLVersion = OpenSSLVersionTemplate!"3.0.3"; +} +else version (DeimosOpenSSLAutoDetect) +{ + import deimos.openssl.version_; + + public alias OpenSSLVersion = OpenSSLVersionTemplate!OpenSSLTextVersion; +} +else +{ + // It was decided in https://github.com/D-Programming-Deimos/openssl/pull/66 + // that we should fall back to the latest supported version of the bindings, + // should the user provide neither explicit version nor `DeimosOpenSSLAutoDetect` + public alias OpenSSLVersion = OpenSSLVersionTemplate!"1.1.0h"; +} + +// Publicly aliased above +private struct OpenSSLVersionTemplate (string textVersion) +{ + enum text = textVersion; + + enum int major = (text[0] - '0'); + static assert (major >= 0); + + enum int minor = (text[2] - '0'); + static assert (minor >= 0); + + enum int patch = (text[4] - '0'); + static assert (patch >= 0); + + static if (text.length == "1.1.0h".length) + { + enum int build = (text[5] - '`'); + static assert (build >= 0); + } + else + enum int build = 0; +} + /* Numeric release version identifier: * MNNFFPPS: major minor fix patch status * The status nibble has one of the values 0 for development, 1 to e for betas @@ -28,13 +114,13 @@ import deimos.openssl._d_util; */ /* Version macros for compile-time API version detection */ -enum -{ - OPENSSL_VERSION_MAJOR = 1, - OPENSSL_VERSION_MINOR = 1, - OPENSSL_VERSION_PATCH = 0, - OPENSSL_VERSION_BUILD = 'h' - '`' -} +enum OPENSSL_VERSION_MAJOR = OpenSSLVersion.major; + +enum OPENSSL_VERSION_MINOR = OpenSSLVersion.minor; + +enum OPENSSL_VERSION_PATCH = OpenSSLVersion.patch; + +enum OPENSSL_VERSION_BUILD = OpenSSLVersion.build; int OPENSSL_MAKE_VERSION(int major, int minor, int patch, int build) { @@ -42,7 +128,8 @@ int OPENSSL_MAKE_VERSION(int major, int minor, int patch, int build) } enum OPENSSL_VERSION_NUMBER = - OPENSSL_MAKE_VERSION(OPENSSL_VERSION_MAJOR, OPENSSL_VERSION_MINOR, OPENSSL_VERSION_PATCH, OPENSSL_VERSION_BUILD); + OPENSSL_MAKE_VERSION(OpenSSLVersion.major, OpenSSLVersion.minor, + OpenSSLVersion.patch, OpenSSLVersion.build); bool OPENSSL_VERSION_AT_LEAST(int major, int minor, int patch = 0, int build = 0) { @@ -54,13 +141,6 @@ bool OPENSSL_VERSION_BEFORE(int major, int minor, int patch = 0, int build = 0) return OPENSSL_VERSION_NUMBER < OPENSSL_MAKE_VERSION(major, minor, patch, build); } -version (OPENSSL_FIPS) { -enum OPENSSL_VERSION_TEXT = "OpenSSL 1.1.0h-fips 27 Mar 2018"; -} else { -enum OPENSSL_VERSION_TEXT = "OpenSSL 1.1.0h 27 Mar 2018"; -} -enum OPENSSL_VERSION_PTEXT = " part of " ~ OPENSSL_VERSION_TEXT; - /* The macros below are to be used for shared library (.so, .dll, ...) * versioning. That kind of versioning works a bit differently between * operating systems. The most usual scheme is to set a major and a minor diff --git a/deimos/openssl/ossl_typ.d b/source/deimos/openssl/ossl_typ.d similarity index 100% rename from deimos/openssl/ossl_typ.d rename to source/deimos/openssl/ossl_typ.d diff --git a/deimos/openssl/pem.d b/source/deimos/openssl/pem.d similarity index 100% rename from deimos/openssl/pem.d rename to source/deimos/openssl/pem.d diff --git a/deimos/openssl/pem2.d b/source/deimos/openssl/pem2.d similarity index 100% rename from deimos/openssl/pem2.d rename to source/deimos/openssl/pem2.d diff --git a/deimos/openssl/pkcs12.d b/source/deimos/openssl/pkcs12.d similarity index 100% rename from deimos/openssl/pkcs12.d rename to source/deimos/openssl/pkcs12.d diff --git a/deimos/openssl/pkcs7.d b/source/deimos/openssl/pkcs7.d similarity index 100% rename from deimos/openssl/pkcs7.d rename to source/deimos/openssl/pkcs7.d diff --git a/deimos/openssl/pqueue.d b/source/deimos/openssl/pqueue.d similarity index 100% rename from deimos/openssl/pqueue.d rename to source/deimos/openssl/pqueue.d diff --git a/deimos/openssl/rand.d b/source/deimos/openssl/rand.d similarity index 100% rename from deimos/openssl/rand.d rename to source/deimos/openssl/rand.d diff --git a/deimos/openssl/rc2.d b/source/deimos/openssl/rc2.d similarity index 100% rename from deimos/openssl/rc2.d rename to source/deimos/openssl/rc2.d diff --git a/deimos/openssl/rc4.d b/source/deimos/openssl/rc4.d similarity index 100% rename from deimos/openssl/rc4.d rename to source/deimos/openssl/rc4.d diff --git a/deimos/openssl/ripemd.d b/source/deimos/openssl/ripemd.d similarity index 100% rename from deimos/openssl/ripemd.d rename to source/deimos/openssl/ripemd.d diff --git a/deimos/openssl/rsa.d b/source/deimos/openssl/rsa.d similarity index 100% rename from deimos/openssl/rsa.d rename to source/deimos/openssl/rsa.d diff --git a/deimos/openssl/safestack.d b/source/deimos/openssl/safestack.d similarity index 100% rename from deimos/openssl/safestack.d rename to source/deimos/openssl/safestack.d diff --git a/deimos/openssl/seed.d b/source/deimos/openssl/seed.d similarity index 100% rename from deimos/openssl/seed.d rename to source/deimos/openssl/seed.d diff --git a/deimos/openssl/sha.d b/source/deimos/openssl/sha.d similarity index 100% rename from deimos/openssl/sha.d rename to source/deimos/openssl/sha.d diff --git a/deimos/openssl/srp.d b/source/deimos/openssl/srp.d similarity index 100% rename from deimos/openssl/srp.d rename to source/deimos/openssl/srp.d diff --git a/deimos/openssl/srtp.d b/source/deimos/openssl/srtp.d similarity index 100% rename from deimos/openssl/srtp.d rename to source/deimos/openssl/srtp.d diff --git a/deimos/openssl/ssl.d b/source/deimos/openssl/ssl.d similarity index 100% rename from deimos/openssl/ssl.d rename to source/deimos/openssl/ssl.d diff --git a/deimos/openssl/ssl2.d b/source/deimos/openssl/ssl2.d similarity index 100% rename from deimos/openssl/ssl2.d rename to source/deimos/openssl/ssl2.d diff --git a/deimos/openssl/ssl23.d b/source/deimos/openssl/ssl23.d similarity index 100% rename from deimos/openssl/ssl23.d rename to source/deimos/openssl/ssl23.d diff --git a/deimos/openssl/ssl3.d b/source/deimos/openssl/ssl3.d similarity index 100% rename from deimos/openssl/ssl3.d rename to source/deimos/openssl/ssl3.d diff --git a/deimos/openssl/stack.d b/source/deimos/openssl/stack.d similarity index 100% rename from deimos/openssl/stack.d rename to source/deimos/openssl/stack.d diff --git a/deimos/openssl/symhacks.d b/source/deimos/openssl/symhacks.d similarity index 100% rename from deimos/openssl/symhacks.d rename to source/deimos/openssl/symhacks.d diff --git a/deimos/openssl/tls1.d b/source/deimos/openssl/tls1.d similarity index 100% rename from deimos/openssl/tls1.d rename to source/deimos/openssl/tls1.d diff --git a/deimos/openssl/ts.d b/source/deimos/openssl/ts.d similarity index 100% rename from deimos/openssl/ts.d rename to source/deimos/openssl/ts.d diff --git a/deimos/openssl/txt_db.d b/source/deimos/openssl/txt_db.d similarity index 100% rename from deimos/openssl/txt_db.d rename to source/deimos/openssl/txt_db.d diff --git a/deimos/openssl/ui.d b/source/deimos/openssl/ui.d similarity index 100% rename from deimos/openssl/ui.d rename to source/deimos/openssl/ui.d diff --git a/deimos/openssl/ui_compat.d b/source/deimos/openssl/ui_compat.d similarity index 100% rename from deimos/openssl/ui_compat.d rename to source/deimos/openssl/ui_compat.d diff --git a/deimos/openssl/whrlpool.d b/source/deimos/openssl/whrlpool.d similarity index 100% rename from deimos/openssl/whrlpool.d rename to source/deimos/openssl/whrlpool.d diff --git a/deimos/openssl/x509.d b/source/deimos/openssl/x509.d similarity index 100% rename from deimos/openssl/x509.d rename to source/deimos/openssl/x509.d diff --git a/deimos/openssl/x509_vfy.d b/source/deimos/openssl/x509_vfy.d similarity index 100% rename from deimos/openssl/x509_vfy.d rename to source/deimos/openssl/x509_vfy.d diff --git a/deimos/openssl/x509v3.d b/source/deimos/openssl/x509v3.d similarity index 100% rename from deimos/openssl/x509v3.d rename to source/deimos/openssl/x509v3.d