o_init.c revision 205128
143543Swollman/* o_init.c */
22742Swollman/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
32742Swollman * project.
42742Swollman */
52742Swollman/* ====================================================================
62742Swollman * Copyright (c) 2007 The OpenSSL Project.  All rights reserved.
730711Swollman *
82742Swollman * Redistribution and use in source and binary forms, with or without
92742Swollman * modification, are permitted provided that the following conditions
1030711Swollman * are met:
1130711Swollman *
122742Swollman * 1. Redistributions of source code must retain the above copyright
1320094Swollman *    notice, this list of conditions and the following disclaimer.
1420094Swollman *
1520094Swollman * 2. Redistributions in binary form must reproduce the above copyright
1620094Swollman *    notice, this list of conditions and the following disclaimer in
1720094Swollman *    the documentation and/or other materials provided with the
1820094Swollman *    distribution.
1920094Swollman *
2020094Swollman * 3. All advertising materials mentioning features or use of this
2120094Swollman *    software must display the following acknowledgment:
222742Swollman *    "This product includes software developed by the OpenSSL Project
232742Swollman *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
242742Swollman *
252742Swollman * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
2614343Swollman *    endorse or promote products derived from this software without
2714343Swollman *    prior written permission. For written permission, please contact
2814343Swollman *    openssl-core@openssl.org.
2914343Swollman *
3030711Swollman * 5. Products derived from this software may not be called "OpenSSL"
3130711Swollman *    nor may "OpenSSL" appear in their names without prior written
3230711Swollman *    permission of the OpenSSL Project.
3330711Swollman *
3430711Swollman * 6. Redistributions of any form whatsoever must retain the following
3530711Swollman *    acknowledgment:
3630711Swollman *    "This product includes software developed by the OpenSSL Project
3730711Swollman *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
382742Swollman *
3930711Swollman * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
4030711Swollman * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4130711Swollman * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
4230711Swollman * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
4330711Swollman * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
442742Swollman * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
4530711Swollman * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
4630711Swollman * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4730711Swollman * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
4830711Swollman * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
4930711Swollman * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
5030711Swollman * OF THE POSSIBILITY OF SUCH DAMAGE.
5130711Swollman * ====================================================================
5230711Swollman *
5330711Swollman * This product includes cryptographic software written by Eric Young
5430711Swollman * (eay@cryptsoft.com).  This product includes software written by Tim
552742Swollman * Hudson (tjh@cryptsoft.com).
5630711Swollman *
5730711Swollman */
5830711Swollman
5930711Swollman#include <e_os.h>
6030711Swollman#include <openssl/err.h>
6130711Swollman/* Internal only functions: only ever used here */
622742Swollmanextern	void int_ERR_lib_init(void);
6330711Swollmanextern	void int_EVP_MD_init_engine_callbacks(void );
642742Swollmanextern	void int_EVP_CIPHER_init_engine_callbacks(void );
652742Swollmanextern	void int_RAND_init_engine_callbacks(void );
662742Swollman
6719878Swollman/* Perform any essential OpenSSL initialization operations.
682742Swollman * Currently only sets FIPS callbacks
6919878Swollman */
7019878Swollman
7119878Swollmanvoid OPENSSL_init(void)
7219878Swollman	{
732742Swollman#ifdef OPENSSL_FIPS
7419878Swollman	static int done = 0;
752742Swollman	if (!done)
7619878Swollman		{
772742Swollman		int_ERR_lib_init();
7819878Swollman#ifdef CRYPTO_MDEBUG
792742Swollman		CRYPTO_malloc_debug_init();
802742Swollman#endif
8119878Swollman#ifndef OPENSSL_NO_ENGINE
822742Swollman		int_EVP_MD_init_engine_callbacks();
8319878Swollman		int_EVP_CIPHER_init_engine_callbacks();
842742Swollman		int_RAND_init_engine_callbacks();
8519878Swollman#endif
862742Swollman		done = 1;
8719878Swollman		}
882742Swollman#endif
8914343Swollman	}
902742Swollman
912742Swollman
9214343Swollman