#ifndef SSL_COMPAT_H
#define SSL_COMPAT_H
#include "nghttp2_config.h"
#include <cstdint>
#ifdef HAVE_WOLFSSL
# include <wolfssl/options.h>
# include <wolfssl/openssl/ssl.h>
# define NGHTTP2_OPENSSL_IS_WOLFSSL
using nghttp2_ssl_op_type = long;
using nghttp2_ssl_proto_version_type = int;
using nghttp2_ssl_key_length_type = int;
using nghttp2_ssl_stack_index_type = int;
using nghttp2_ssl_timeout_type = uint32_t;
using nghttp2_ssl_rand_length_type = int;
using nghttp2_ssl_verify_host_length_type = unsigned int;
inline constexpr auto NGHTTP2_CERT_TYPE_ECDSA = ECDSAk;
inline constexpr auto NGHTTP2_CERT_TYPE_ML_DSA_44 = ML_DSA_LEVEL2k;
inline constexpr auto NGHTTP2_CERT_TYPE_ML_DSA_65 = ML_DSA_LEVEL3k;
inline constexpr auto NGHTTP2_CERT_TYPE_ML_DSA_87 = ML_DSA_LEVEL5k;
#else
# include <openssl/ssl.h>
# ifdef LIBRESSL_VERSION_NUMBER
# define NGHTTP2_OPENSSL_IS_LIBRESSL
using nghttp2_ssl_op_type = long;
using nghttp2_ssl_proto_version_type = uint16_t;
using nghttp2_ssl_key_length_type = int;
using nghttp2_ssl_stack_index_type = int;
using nghttp2_ssl_timeout_type = long;
using nghttp2_ssl_rand_length_type = int;
using nghttp2_ssl_verify_host_length_type = size_t;
# endif
# if defined(OPENSSL_IS_BORINGSSL) || defined(OPENSSL_IS_AWSLC)
# define NGHTTP2_OPENSSL_IS_BORINGSSL
using nghttp2_ssl_op_type = uint32_t;
using nghttp2_ssl_proto_version_type = uint16_t;
using nghttp2_ssl_key_length_type = size_t;
using nghttp2_ssl_stack_index_type = size_t;
using nghttp2_ssl_timeout_type = uint32_t;
using nghttp2_ssl_rand_length_type = size_t;
using nghttp2_ssl_verify_host_length_type = size_t;
# endif
# if !defined(NGHTTP2_OPENSSL_IS_BORINGSSL) && \
!defined(NGHTTP2_OPENSSL_IS_LIBRESSL)
# define NGHTTP2_GENUINE_OPENSSL
# endif
# ifdef NGHTTP2_GENUINE_OPENSSL
# define OPENSSL_3_0_0_API (OPENSSL_VERSION_NUMBER >= 0x30000000L)
# define OPENSSL_3_5_0_API (OPENSSL_VERSION_NUMBER >= 0x30500000L)
# if OPENSSL_VERSION_NUMBER >= 0x30000000L
using nghttp2_ssl_op_type = uint64_t;
# else
using nghttp2_ssl_op_type = unsigned long;
# endif using nghttp2_ssl_proto_version_type = long;
using nghttp2_ssl_key_length_type = int;
using nghttp2_ssl_stack_index_type = int;
using nghttp2_ssl_timeout_type = long;
using nghttp2_ssl_rand_length_type = int;
using nghttp2_ssl_verify_host_length_type = size_t;
# else
# define OPENSSL_3_0_0_API 0
# define OPENSSL_3_5_0_API 0
# endif
inline constexpr auto NGHTTP2_CERT_TYPE_ECDSA = EVP_PKEY_EC;
# if OPENSSL_3_5_0_API
inline constexpr auto NGHTTP2_CERT_TYPE_ML_DSA_44 = EVP_PKEY_ML_DSA_44;
inline constexpr auto NGHTTP2_CERT_TYPE_ML_DSA_65 = EVP_PKEY_ML_DSA_65;
inline constexpr auto NGHTTP2_CERT_TYPE_ML_DSA_87 = EVP_PKEY_ML_DSA_87;
# endif #endif
#endif