From 7a1eefd3cd8f697b33bf5348ea4d5c1e581dcdb6 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Sat, 17 Oct 2015 23:39:22 -0400 Subject: [PATCH] Deprecate SSL_library_init. It just calls CRYPTO_library_init and doesn't do anything else. If anything, I'd like to make CRYPTO_library_init completely go away too. We have CRYPTO_once now, so I think it's safe to assume that, if ssl/ ever grows initialization needs beyond that of crypto/, we can hide it behind a CRYPTO_once and not burden callers. Change-Id: I63dc362e0e9e98deec5516f4620d1672151a91b6 Reviewed-on: https://boringssl-review.googlesource.com/6311 Reviewed-by: Adam Langley --- PORTING.md | 8 ++++---- include/openssl/ssl.h | 9 +++------ ssl/pqueue/pqueue_test.c | 3 ++- ssl/ssl_test.cc | 3 ++- ssl/test/bssl_shim.cc | 5 ++--- tool/tool.cc | 3 ++- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/PORTING.md b/PORTING.md index 04b28fa7..cf841150 100644 --- a/PORTING.md +++ b/PORTING.md @@ -149,10 +149,10 @@ OpenSSL has a number of different initialization functions for setting up error strings and loading algorithms, etc. All of these functions still exist in BoringSSL for convenience, but they do nothing and are not necessary. -The one exception is `CRYPTO_library_init` (and `SSL_library_init` which merely -calls it). In `BORINGSSL_NO_STATIC_INITIALIZER` builds, it must be called to -query CPU capabitilies before the rest of the library. In the default -configuration, this is done with a static initializer and is also unnecessary. +The one exception is `CRYPTO_library_init`. In `BORINGSSL_NO_STATIC_INITIALIZER` +builds, it must be called to query CPU capabitilies before the rest of the +library. In the default configuration, this is done with a static initializer +and is also unnecessary. ### Threading diff --git a/include/openssl/ssl.h b/include/openssl/ssl.h index af880948..11b757e0 100644 --- a/include/openssl/ssl.h +++ b/include/openssl/ssl.h @@ -174,12 +174,6 @@ extern "C" { /* SSL implementation. */ -/* Initialization. */ - -/* SSL_library_init initializes the crypto and SSL libraries and returns one. */ -OPENSSL_EXPORT int SSL_library_init(void); - - /* SSL contexts. * * |SSL_CTX| objects manage shared state and configuration between multiple TLS @@ -2859,6 +2853,9 @@ OPENSSL_EXPORT int SSL_state(const SSL *ssl); /* Deprecated functions. */ +/* SSL_library_init calls |CRYPTO_library_init| and returns one. */ +OPENSSL_EXPORT int SSL_library_init(void); + /* SSL_set_reject_peer_renegotiations calls |SSL_set_renegotiate_mode| with * |ssl_never_renegotiate| if |reject| is one and |ssl_renegotiate_freely| if * zero. */ diff --git a/ssl/pqueue/pqueue_test.c b/ssl/pqueue/pqueue_test.c index 5a68fc45..f76e4a3c 100644 --- a/ssl/pqueue/pqueue_test.c +++ b/ssl/pqueue/pqueue_test.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -117,7 +118,7 @@ static int fixed_random(void) { } int main(void) { - SSL_library_init(); + CRYPTO_library_init(); if (!trivial() || !fixed_random()) { return 1; diff --git a/ssl/ssl_test.cc b/ssl/ssl_test.cc index 810d3fac..875fac8b 100644 --- a/ssl/ssl_test.cc +++ b/ssl/ssl_test.cc @@ -20,6 +20,7 @@ #include #include +#include #include #include @@ -819,7 +820,7 @@ static bool TestClientCAList() { } int main() { - SSL_library_init(); + CRYPTO_library_init(); if (!TestCipherRules() || !TestSSL_SESSIONEncoding(kOpenSSLSession) || diff --git a/ssl/test/bssl_shim.cc b/ssl/test/bssl_shim.cc index 87f713f7..a133d09a 100644 --- a/ssl/test/bssl_shim.cc +++ b/ssl/test/bssl_shim.cc @@ -39,6 +39,7 @@ #include #include #include +#include #include #include #include @@ -1364,9 +1365,7 @@ int main(int argc, char **argv) { signal(SIGPIPE, SIG_IGN); #endif - if (!SSL_library_init()) { - return 1; - } + CRYPTO_library_init(); g_config_index = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL); g_state_index = SSL_get_ex_new_index(0, NULL, NULL, NULL, TestStateExFree); if (g_config_index < 0 || g_state_index < 0) { diff --git a/tool/tool.cc b/tool/tool.cc index e4d5201b..f67f0c7d 100644 --- a/tool/tool.cc +++ b/tool/tool.cc @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -109,7 +110,7 @@ int main(int argc, char **argv) { } #endif - SSL_library_init(); + CRYPTO_library_init(); int starting_arg = 1; tool_func_t tool = nullptr;