blob: c94f39f6292360670c49656eddcbf1ee45d7ee82 [file] [log] [blame]
Adam Langley4c921e12014-07-14 15:28:14 -07001/* Copyright (c) 2014, Google Inc.
2 *
3 * Permission to use, copy, modify, and/or distribute this software for any
4 * purpose with or without fee is hereby granted, provided that the above
5 * copyright notice and this permission notice appear in all copies.
6 *
7 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
David Benjamina70c75c2014-09-11 19:11:15 -040015#ifndef OPENSSL_HEADER_CRYPTO_H
16#define OPENSSL_HEADER_CRYPTO_H
17
18#include <openssl/base.h>
19
David Benjamin4512b792017-08-18 19:21:50 -040020// Upstream OpenSSL defines |OPENSSL_malloc|, etc., in crypto.h rather than
21// mem.h.
David Benjamin2c6080f2015-04-24 10:15:31 -040022#include <openssl/mem.h>
23
David Benjamin4512b792017-08-18 19:21:50 -040024// Upstream OpenSSL defines |CRYPTO_LOCK|, etc., in crypto.h rather than
25// thread.h.
Matt Braithwaited0e1f1c2015-08-05 11:40:35 -070026#include <openssl/thread.h>
27
David Benjamina70c75c2014-09-11 19:11:15 -040028
29#if defined(__cplusplus)
30extern "C" {
31#endif
32
33
David Benjamin4512b792017-08-18 19:21:50 -040034// crypto.h contains functions for initializing the crypto library.
David Benjamina70c75c2014-09-11 19:11:15 -040035
36
David Benjamin4512b792017-08-18 19:21:50 -040037// CRYPTO_library_init initializes the crypto library. It must be called if the
38// library is built with BORINGSSL_NO_STATIC_INITIALIZER. Otherwise, it does
39// nothing and a static initializer is used instead. It is safe to call this
40// function multiple times and concurrently from multiple threads.
41//
42// On some ARM configurations, this function may require filesystem access and
43// should be called before entering a sandbox.
David Benjamina70c75c2014-09-11 19:11:15 -040044OPENSSL_EXPORT void CRYPTO_library_init(void);
45
David Benjamin4512b792017-08-18 19:21:50 -040046// CRYPTO_is_confidential_build returns one if the linked version of BoringSSL
47// has been built with the BORINGSSL_CONFIDENTIAL define and zero otherwise.
48//
49// This is used by some consumers to identify whether they are using an
50// internal version of BoringSSL.
Adam Langleyb83c6802016-05-03 09:16:21 -070051OPENSSL_EXPORT int CRYPTO_is_confidential_build(void);
52
David Benjamin4512b792017-08-18 19:21:50 -040053// CRYPTO_has_asm returns one unless BoringSSL was built with OPENSSL_NO_ASM,
54// in which case it returns zero.
Adam Langley4fac8d02016-05-16 13:44:40 -070055OPENSSL_EXPORT int CRYPTO_has_asm(void);
56
David Benjamin4512b792017-08-18 19:21:50 -040057// FIPS_mode returns zero unless BoringSSL is built with BORINGSSL_FIPS, in
58// which case it returns one.
Adam Langleyfd499932017-04-04 14:21:43 -070059OPENSSL_EXPORT int FIPS_mode(void);
60
David Benjamina70c75c2014-09-11 19:11:15 -040061
David Benjamin4512b792017-08-18 19:21:50 -040062// Deprecated functions.
Adam Langleyc3ef76f2015-04-13 14:34:17 -070063
David Benjamin4512b792017-08-18 19:21:50 -040064// OPENSSL_VERSION_TEXT contains a string the identifies the version of
65// “OpenSSL”. node.js requires a version number in this text.
Adam Langleyce9d85e2016-01-24 15:58:39 -080066#define OPENSSL_VERSION_TEXT "OpenSSL 1.0.2 (compatible; BoringSSL)"
Adam Langleyc3ef76f2015-04-13 14:34:17 -070067
68#define SSLEAY_VERSION 0
69
David Benjamin4512b792017-08-18 19:21:50 -040070// SSLeay_version is a compatibility function that returns the string
71// "BoringSSL".
Adam Langleyc3ef76f2015-04-13 14:34:17 -070072OPENSSL_EXPORT const char *SSLeay_version(int unused);
73
David Benjamin4512b792017-08-18 19:21:50 -040074// SSLeay is a compatibility function that returns OPENSSL_VERSION_NUMBER from
75// base.h.
Adam Langleyb3a262c2015-05-19 16:30:20 -070076OPENSSL_EXPORT unsigned long SSLeay(void);
Adam Langleyc3ef76f2015-04-13 14:34:17 -070077
David Benjamin4512b792017-08-18 19:21:50 -040078// CRYPTO_malloc_init returns one.
Adam Langley05ee4fd2015-08-02 09:35:44 -070079OPENSSL_EXPORT int CRYPTO_malloc_init(void);
80
David Benjamin4512b792017-08-18 19:21:50 -040081// ENGINE_load_builtin_engines does nothing.
Adam Langley05ee4fd2015-08-02 09:35:44 -070082OPENSSL_EXPORT void ENGINE_load_builtin_engines(void);
83
David Benjamin4512b792017-08-18 19:21:50 -040084// ENGINE_register_all_complete returns one.
Adam Langley27516f72016-07-12 10:26:56 -070085OPENSSL_EXPORT int ENGINE_register_all_complete(void);
86
David Benjamin4512b792017-08-18 19:21:50 -040087// OPENSSL_load_builtin_modules does nothing.
David Benjamine5aa7912016-01-26 01:09:19 -050088OPENSSL_EXPORT void OPENSSL_load_builtin_modules(void);
89
Adam Langleyc3ef76f2015-04-13 14:34:17 -070090
David Benjamina70c75c2014-09-11 19:11:15 -040091#if defined(__cplusplus)
David Benjamin4512b792017-08-18 19:21:50 -040092} // extern C
David Benjamina70c75c2014-09-11 19:11:15 -040093#endif
Adam Langley4c921e12014-07-14 15:28:14 -070094
David Benjamin4512b792017-08-18 19:21:50 -040095#endif // OPENSSL_HEADER_CRYPTO_H