cryptlib.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #include <contrib/libs/openssl/redef.h>
  2. /*
  3. * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
  4. *
  5. * Licensed under the OpenSSL license (the "License"). You may not use
  6. * this file except in compliance with the License. You can obtain a copy
  7. * in the file LICENSE in the source distribution or at
  8. * https://www.openssl.org/source/license.html
  9. */
  10. #ifndef OSSL_INTERNAL_CRYPTLIB_H
  11. # define OSSL_INTERNAL_CRYPTLIB_H
  12. # include <stdlib.h>
  13. # include <string.h>
  14. # ifdef OPENSSL_USE_APPLINK
  15. # undef BIO_FLAGS_UPLINK
  16. # define BIO_FLAGS_UPLINK 0x8000
  17. # include "ms/uplink.h"
  18. # endif
  19. # include <openssl/crypto.h>
  20. # include <openssl/buffer.h>
  21. # include <openssl/bio.h>
  22. # include <openssl/err.h>
  23. # include "internal/nelem.h"
  24. #ifdef NDEBUG
  25. # define ossl_assert(x) ((x) != 0)
  26. #else
  27. __owur static ossl_inline int ossl_assert_int(int expr, const char *exprstr,
  28. const char *file, int line)
  29. {
  30. if (!expr)
  31. OPENSSL_die(exprstr, file, line);
  32. return expr;
  33. }
  34. # define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \
  35. __FILE__, __LINE__)
  36. #endif
  37. typedef struct ex_callback_st EX_CALLBACK;
  38. DEFINE_STACK_OF(EX_CALLBACK)
  39. typedef struct app_mem_info_st APP_INFO;
  40. typedef struct mem_st MEM;
  41. DEFINE_LHASH_OF(MEM);
  42. # define OPENSSL_CONF "openssl.cnf"
  43. # ifndef OPENSSL_SYS_VMS
  44. # define X509_CERT_AREA OPENSSLDIR
  45. # define X509_CERT_DIR OPENSSLDIR "/certs"
  46. # define X509_CERT_FILE OPENSSLDIR "/cert.pem"
  47. # define X509_PRIVATE_DIR OPENSSLDIR "/private"
  48. # define CTLOG_FILE OPENSSLDIR "/ct_log_list.cnf"
  49. # else
  50. # define X509_CERT_AREA "OSSL$DATAROOT:[000000]"
  51. # define X509_CERT_DIR "OSSL$DATAROOT:[CERTS]"
  52. # define X509_CERT_FILE "OSSL$DATAROOT:[000000]cert.pem"
  53. # define X509_PRIVATE_DIR "OSSL$DATAROOT:[PRIVATE]"
  54. # define CTLOG_FILE "OSSL$DATAROOT:[000000]ct_log_list.cnf"
  55. # endif
  56. # define X509_CERT_DIR_EVP "SSL_CERT_DIR"
  57. # define X509_CERT_FILE_EVP "SSL_CERT_FILE"
  58. # define CTLOG_FILE_EVP "CTLOG_FILE"
  59. /* size of string representations */
  60. # define DECIMAL_SIZE(type) ((sizeof(type)*8+2)/3+1)
  61. # define HEX_SIZE(type) (sizeof(type)*2)
  62. void OPENSSL_cpuid_setup(void);
  63. extern unsigned int OPENSSL_ia32cap_P[];
  64. void OPENSSL_showfatal(const char *fmta, ...);
  65. void crypto_cleanup_all_ex_data_int(void);
  66. int openssl_init_fork_handlers(void);
  67. int openssl_get_fork_id(void);
  68. char *ossl_safe_getenv(const char *name);
  69. extern CRYPTO_RWLOCK *memdbg_lock;
  70. int openssl_strerror_r(int errnum, char *buf, size_t buflen);
  71. # if !defined(OPENSSL_NO_STDIO)
  72. FILE *openssl_fopen(const char *filename, const char *mode);
  73. # else
  74. void *openssl_fopen(const char *filename, const char *mode);
  75. # endif
  76. uint32_t OPENSSL_rdtsc(void);
  77. size_t OPENSSL_instrument_bus(unsigned int *, size_t);
  78. size_t OPENSSL_instrument_bus2(unsigned int *, size_t, size_t);
  79. #endif