Browse Source

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 <alangley@gmail.com>
kris/onging/CECPQ3_patch15
David Benjamin 9 years ago
committed by Adam Langley
parent
commit
7a1eefd3cd
6 changed files with 15 additions and 16 deletions
  1. +4
    -4
      PORTING.md
  2. +3
    -6
      include/openssl/ssl.h
  3. +2
    -1
      ssl/pqueue/pqueue_test.c
  4. +2
    -1
      ssl/ssl_test.cc
  5. +2
    -3
      ssl/test/bssl_shim.cc
  6. +2
    -1
      tool/tool.cc

+ 4
- 4
PORTING.md View File

@@ -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



+ 3
- 6
include/openssl/ssl.h View File

@@ -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. */


+ 2
- 1
ssl/pqueue/pqueue_test.c View File

@@ -15,6 +15,7 @@
#include <stdio.h>
#include <string.h>

#include <openssl/crypto.h>
#include <openssl/pqueue.h>
#include <openssl/ssl.h>

@@ -117,7 +118,7 @@ static int fixed_random(void) {
}

int main(void) {
SSL_library_init();
CRYPTO_library_init();

if (!trivial() || !fixed_random()) {
return 1;


+ 2
- 1
ssl/ssl_test.cc View File

@@ -20,6 +20,7 @@

#include <openssl/base64.h>
#include <openssl/bio.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/ssl.h>

@@ -819,7 +820,7 @@ static bool TestClientCAList() {
}

int main() {
SSL_library_init();
CRYPTO_library_init();

if (!TestCipherRules() ||
!TestSSL_SESSIONEncoding(kOpenSSLSession) ||


+ 2
- 3
ssl/test/bssl_shim.cc View File

@@ -39,6 +39,7 @@
#include <openssl/buf.h>
#include <openssl/bytestring.h>
#include <openssl/cipher.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/hmac.h>
#include <openssl/rand.h>
@@ -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) {


+ 2
- 1
tool/tool.cc View File

@@ -15,6 +15,7 @@
#include <string>
#include <vector>

#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/ssl.h>

@@ -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;


Loading…
Cancel
Save