crypto.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /* 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. #ifndef OPENSSL_HEADER_CRYPTO_H
  15. #define OPENSSL_HEADER_CRYPTO_H
  16. #include <openssl/base.h>
  17. // Upstream OpenSSL defines |OPENSSL_malloc|, etc., in crypto.h rather than
  18. // mem.h.
  19. #include <openssl/mem.h>
  20. // Upstream OpenSSL defines |CRYPTO_LOCK|, etc., in crypto.h rather than
  21. // thread.h.
  22. #include <openssl/thread.h>
  23. #if defined(__cplusplus)
  24. extern "C" {
  25. #endif
  26. // crypto.h contains functions for initializing the crypto library.
  27. // CRYPTO_library_init initializes the crypto library. It must be called if the
  28. // library is built with BORINGSSL_NO_STATIC_INITIALIZER. Otherwise, it does
  29. // nothing and a static initializer is used instead. It is safe to call this
  30. // function multiple times and concurrently from multiple threads.
  31. //
  32. // On some ARM configurations, this function may require filesystem access and
  33. // should be called before entering a sandbox.
  34. OPENSSL_EXPORT void CRYPTO_library_init(void);
  35. // CRYPTO_is_confidential_build returns one if the linked version of BoringSSL
  36. // has been built with the BORINGSSL_CONFIDENTIAL define and zero otherwise.
  37. //
  38. // This is used by some consumers to identify whether they are using an
  39. // internal version of BoringSSL.
  40. OPENSSL_EXPORT int CRYPTO_is_confidential_build(void);
  41. // CRYPTO_has_asm returns one unless BoringSSL was built with OPENSSL_NO_ASM,
  42. // in which case it returns zero.
  43. OPENSSL_EXPORT int CRYPTO_has_asm(void);
  44. // FIPS_mode returns zero unless BoringSSL is built with BORINGSSL_FIPS, in
  45. // which case it returns one.
  46. OPENSSL_EXPORT int FIPS_mode(void);
  47. // Deprecated functions.
  48. // OPENSSL_VERSION_TEXT contains a string the identifies the version of
  49. // “OpenSSL”. node.js requires a version number in this text.
  50. #define OPENSSL_VERSION_TEXT "OpenSSL 1.1.0 (compatible; BoringSSL)"
  51. #define SSLEAY_VERSION 0
  52. // SSLeay_version is a compatibility function that returns the string
  53. // "BoringSSL".
  54. OPENSSL_EXPORT const char *SSLeay_version(int unused);
  55. #define OPENSSL_VERSION 0
  56. // OpenSSL_version is a compatibility function that returns the string
  57. // "BoringSSL".
  58. OPENSSL_EXPORT const char *OpenSSL_version(int unused);
  59. // SSLeay is a compatibility function that returns OPENSSL_VERSION_NUMBER from
  60. // base.h.
  61. OPENSSL_EXPORT unsigned long SSLeay(void);
  62. // OpenSSL_version_num is a compatibility function that returns
  63. // OPENSSL_VERSION_NUMBER from base.h.
  64. OPENSSL_EXPORT unsigned long OpenSSL_version_num(void);
  65. // CRYPTO_malloc_init returns one.
  66. OPENSSL_EXPORT int CRYPTO_malloc_init(void);
  67. // ENGINE_load_builtin_engines does nothing.
  68. OPENSSL_EXPORT void ENGINE_load_builtin_engines(void);
  69. // ENGINE_register_all_complete returns one.
  70. OPENSSL_EXPORT int ENGINE_register_all_complete(void);
  71. // OPENSSL_load_builtin_modules does nothing.
  72. OPENSSL_EXPORT void OPENSSL_load_builtin_modules(void);
  73. #define OPENSSL_INIT_NO_LOAD_CRYPTO_STRINGS 0
  74. #define OPENSSL_INIT_LOAD_CRYPTO_STRINGS 0
  75. #define OPENSSL_INIT_ADD_ALL_CIPHERS 0
  76. #define OPENSSL_INIT_ADD_ALL_DIGESTS 0
  77. #define OPENSSL_INIT_NO_ADD_ALL_CIPHERS 0
  78. #define OPENSSL_INIT_NO_ADD_ALL_DIGESTS 0
  79. #define OPENSSL_INIT_LOAD_CONFIG 0
  80. #define OPENSSL_INIT_NO_LOAD_CONFIG 0
  81. // OPENSSL_init_crypto calls |CRYPTO_library_init| and returns one.
  82. OPENSSL_EXPORT int OPENSSL_init_crypto(uint64_t opts,
  83. const OPENSSL_INIT_SETTINGS *settings);
  84. #if defined(__cplusplus)
  85. } // extern C
  86. #endif
  87. #endif // OPENSSL_HEADER_CRYPTO_H