diff options
| author | beck <> | 2018-03-17 16:20:01 +0000 |
|---|---|---|
| committer | beck <> | 2018-03-17 16:20:01 +0000 |
| commit | 035770aca4c8c1f0d36f1b8da62c9e1fb9a4f09b (patch) | |
| tree | 12cc674e7652f4d67e57ec9e1882e6e824b4808d /src/lib/libcrypto/engine | |
| parent | 1c31745efe6ed99c3a4e427046074fc4b544f08d (diff) | |
| download | openbsd-035770aca4c8c1f0d36f1b8da62c9e1fb9a4f09b.tar.gz openbsd-035770aca4c8c1f0d36f1b8da62c9e1fb9a4f09b.tar.bz2 openbsd-035770aca4c8c1f0d36f1b8da62c9e1fb9a4f09b.zip | |
Bring in compatibility for OpenSSL 1.1 style init functions.
This adds OPENSSL_init_crypto and OPENSSL_init_ssl, as well
thread safety modifications for the existing LibreSSL init
functions. The initialization routines are called automatically
by the normal entry points into the library, as in newer OpenSSL
ok jsing@, nits by tb@ and deraadt@
Diffstat (limited to 'src/lib/libcrypto/engine')
| -rw-r--r-- | src/lib/libcrypto/engine/eng_all.c | 20 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/eng_lib.c | 5 |
2 files changed, 19 insertions, 6 deletions
diff --git a/src/lib/libcrypto/engine/eng_all.c b/src/lib/libcrypto/engine/eng_all.c index 7640cf7fcd..403ca6865d 100644 --- a/src/lib/libcrypto/engine/eng_all.c +++ b/src/lib/libcrypto/engine/eng_all.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: eng_all.c,v 1.29 2015/07/19 22:34:27 doug Exp $ */ | 1 | /* $OpenBSD: eng_all.c,v 1.30 2018/03/17 16:20:01 beck Exp $ */ |
| 2 | /* Written by Richard Levitte <richard@levitte.org> for the OpenSSL | 2 | /* Written by Richard Levitte <richard@levitte.org> for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -56,17 +56,16 @@ | |||
| 56 | * | 56 | * |
| 57 | */ | 57 | */ |
| 58 | 58 | ||
| 59 | #include <pthread.h> | ||
| 60 | |||
| 59 | #include <openssl/opensslconf.h> | 61 | #include <openssl/opensslconf.h> |
| 60 | 62 | ||
| 61 | #include "cryptlib.h" | 63 | #include "cryptlib.h" |
| 62 | #include "eng_int.h" | 64 | #include "eng_int.h" |
| 63 | 65 | ||
| 64 | void | 66 | void |
| 65 | ENGINE_load_builtin_engines(void) | 67 | ENGINE_load_builtin_engines_internal(void) |
| 66 | { | 68 | { |
| 67 | /* Some ENGINEs need this */ | ||
| 68 | OPENSSL_cpuid_setup(); | ||
| 69 | |||
| 70 | #ifndef OPENSSL_NO_STATIC_ENGINE | 69 | #ifndef OPENSSL_NO_STATIC_ENGINE |
| 71 | #ifndef OPENSSL_NO_HW | 70 | #ifndef OPENSSL_NO_HW |
| 72 | #ifndef OPENSSL_NO_HW_PADLOCK | 71 | #ifndef OPENSSL_NO_HW_PADLOCK |
| @@ -76,3 +75,14 @@ ENGINE_load_builtin_engines(void) | |||
| 76 | #endif | 75 | #endif |
| 77 | ENGINE_register_all_complete(); | 76 | ENGINE_register_all_complete(); |
| 78 | } | 77 | } |
| 78 | |||
| 79 | void | ||
| 80 | ENGINE_load_builtin_engines(void) | ||
| 81 | { | ||
| 82 | static pthread_once_t once = PTHREAD_ONCE_INIT; | ||
| 83 | |||
| 84 | /* Prayer and clean living lets you ignore errors, OpenSSL style */ | ||
| 85 | (void) OPENSSL_init_crypto(0, NULL); | ||
| 86 | |||
| 87 | (void) pthread_once(&once, ENGINE_load_builtin_engines_internal); | ||
| 88 | } | ||
diff --git a/src/lib/libcrypto/engine/eng_lib.c b/src/lib/libcrypto/engine/eng_lib.c index d2da29fe69..11ad771109 100644 --- a/src/lib/libcrypto/engine/eng_lib.c +++ b/src/lib/libcrypto/engine/eng_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: eng_lib.c,v 1.12 2017/01/29 17:49:23 beck Exp $ */ | 1 | /* $OpenBSD: eng_lib.c,v 1.13 2018/03/17 16:20:01 beck Exp $ */ |
| 2 | /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL | 2 | /* Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL |
| 3 | * project 2000. | 3 | * project 2000. |
| 4 | */ | 4 | */ |
| @@ -70,6 +70,9 @@ ENGINE_new(void) | |||
| 70 | { | 70 | { |
| 71 | ENGINE *ret; | 71 | ENGINE *ret; |
| 72 | 72 | ||
| 73 | if (!OPENSSL_init_crypto(0, NULL)) | ||
| 74 | return NULL; | ||
| 75 | |||
| 73 | ret = malloc(sizeof(ENGINE)); | 76 | ret = malloc(sizeof(ENGINE)); |
| 74 | if (ret == NULL) { | 77 | if (ret == NULL) { |
| 75 | ENGINEerror(ERR_R_MALLOC_FAILURE); | 78 | ENGINEerror(ERR_R_MALLOC_FAILURE); |
