2
0

cryptlib.h 2.8 KB

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