o_init.c revision 193645
1193645Ssimon/* o_init.c */
2193645Ssimon/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3193645Ssimon * project.
4193645Ssimon */
5193645Ssimon/* ====================================================================
6193645Ssimon * Copyright (c) 2007 The OpenSSL Project.  All rights reserved.
7193645Ssimon *
8193645Ssimon * Redistribution and use in source and binary forms, with or without
9193645Ssimon * modification, are permitted provided that the following conditions
10193645Ssimon * are met:
11193645Ssimon *
12193645Ssimon * 1. Redistributions of source code must retain the above copyright
13193645Ssimon *    notice, this list of conditions and the following disclaimer.
14193645Ssimon *
15193645Ssimon * 2. Redistributions in binary form must reproduce the above copyright
16193645Ssimon *    notice, this list of conditions and the following disclaimer in
17193645Ssimon *    the documentation and/or other materials provided with the
18193645Ssimon *    distribution.
19193645Ssimon *
20193645Ssimon * 3. All advertising materials mentioning features or use of this
21193645Ssimon *    software must display the following acknowledgment:
22193645Ssimon *    "This product includes software developed by the OpenSSL Project
23193645Ssimon *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
24193645Ssimon *
25193645Ssimon * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26193645Ssimon *    endorse or promote products derived from this software without
27193645Ssimon *    prior written permission. For written permission, please contact
28193645Ssimon *    openssl-core@openssl.org.
29193645Ssimon *
30193645Ssimon * 5. Products derived from this software may not be called "OpenSSL"
31193645Ssimon *    nor may "OpenSSL" appear in their names without prior written
32193645Ssimon *    permission of the OpenSSL Project.
33193645Ssimon *
34193645Ssimon * 6. Redistributions of any form whatsoever must retain the following
35193645Ssimon *    acknowledgment:
36193645Ssimon *    "This product includes software developed by the OpenSSL Project
37193645Ssimon *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
38193645Ssimon *
39193645Ssimon * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40193645Ssimon * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41193645Ssimon * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42193645Ssimon * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
43193645Ssimon * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44193645Ssimon * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45193645Ssimon * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46193645Ssimon * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47193645Ssimon * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48193645Ssimon * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49193645Ssimon * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50193645Ssimon * OF THE POSSIBILITY OF SUCH DAMAGE.
51193645Ssimon * ====================================================================
52193645Ssimon *
53193645Ssimon * This product includes cryptographic software written by Eric Young
54193645Ssimon * (eay@cryptsoft.com).  This product includes software written by Tim
55193645Ssimon * Hudson (tjh@cryptsoft.com).
56193645Ssimon *
57193645Ssimon */
58193645Ssimon
59193645Ssimon#include <e_os.h>
60193645Ssimon#include <openssl/err.h>
61193645Ssimon
62193645Ssimon/* Perform any essential OpenSSL initialization operations.
63193645Ssimon * Currently only sets FIPS callbacks
64193645Ssimon */
65193645Ssimon
66193645Ssimonvoid OPENSSL_init(void)
67193645Ssimon	{
68193645Ssimon#ifdef OPENSSL_FIPS
69193645Ssimon	static int done = 0;
70193645Ssimon	if (!done)
71193645Ssimon		{
72193645Ssimon		int_ERR_lib_init();
73193645Ssimon#ifdef CRYPTO_MDEBUG
74193645Ssimon		CRYPTO_malloc_debug_init();
75193645Ssimon#endif
76193645Ssimon#ifdef OPENSSL_ENGINE
77193645Ssimon		int_EVP_MD_init_engine_callbacks();
78193645Ssimon		int_EVP_CIPHER_init_engine_callbacks();
79193645Ssimon		int_RAND_init_engine_callbacks();
80193645Ssimon#endif
81193645Ssimon		done = 1;
82193645Ssimon		}
83193645Ssimon#endif
84193645Ssimon	}
85193645Ssimon
86193645Ssimon
87