From d3819813b8e0a64400ddf3ce033bae7c3f245508 Mon Sep 17 00:00:00 2001 From: Mathieu Trudel-Lapierre Date: Tue, 26 Jul 2016 12:02:18 -0400 Subject: Import upstream version 0.9+1465500757.14a5905 --- Cryptlib/OpenSSL/crypto/o_init.c | 69 ++++++++++++---------------------------- 1 file changed, 21 insertions(+), 48 deletions(-) (limited to 'Cryptlib/OpenSSL/crypto/o_init.c') diff --git a/Cryptlib/OpenSSL/crypto/o_init.c b/Cryptlib/OpenSSL/crypto/o_init.c index c89fda58..20883881 100644 --- a/Cryptlib/OpenSSL/crypto/o_init.c +++ b/Cryptlib/OpenSSL/crypto/o_init.c @@ -1,16 +1,17 @@ /* o_init.c */ -/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL +/* + * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project. */ /* ==================================================================== - * Copyright (c) 2007 The OpenSSL Project. All rights reserved. + * Copyright (c) 2011 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. + * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in @@ -50,61 +51,33 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. * ==================================================================== * - * This product includes cryptographic software written by Eric Young - * (eay@cryptsoft.com). This product includes software written by Tim - * Hudson (tjh@cryptsoft.com). - * */ #include #include - -/* Internal only functions: only ever used here */ #ifdef OPENSSL_FIPS -extern void int_ERR_lib_init(void); -# ifndef OPENSSL_NO_ENGINE -extern void int_EVP_MD_init_engine_callbacks(void ); -extern void int_EVP_CIPHER_init_engine_callbacks(void ); -extern void int_RAND_init_engine_callbacks(void ); -# endif +# include +# include #endif -/* Perform any essential OpenSSL initialization operations. - * Currently only sets FIPS callbacks +/* + * Perform any essential OpenSSL initialization operations. Currently only + * sets FIPS callbacks */ void OPENSSL_init(void) - { +{ + static int done = 0; + if (done) + return; + done = 1; #ifdef OPENSSL_FIPS - static int done = 0; - if (!done) - { - int_ERR_lib_init(); -#ifdef CRYPTO_MDEBUG - CRYPTO_malloc_debug_init(); -#endif -#ifndef OPENSSL_NO_ENGINE - int_EVP_MD_init_engine_callbacks(); - int_EVP_CIPHER_init_engine_callbacks(); - int_RAND_init_engine_callbacks(); -#endif - done = 1; - } + FIPS_set_locking_callbacks(CRYPTO_lock, CRYPTO_add_lock); + FIPS_set_error_callbacks(ERR_put_error, ERR_add_error_vdata); + FIPS_set_malloc_callbacks(CRYPTO_malloc, CRYPTO_free); + RAND_init_fips(); #endif - } - -#ifdef OPENSSL_FIPS - -int CRYPTO_memcmp(const void *in_a, const void *in_b, size_t len) - { - size_t i; - const unsigned char *a = in_a; - const unsigned char *b = in_b; - unsigned char x = 0; - - for (i = 0; i < len; i++) - x |= a[i] ^ b[i]; - - return x; - } +#if 0 + fprintf(stderr, "Called OPENSSL_init\n"); #endif +} -- cgit v1.2.3