wpa_supplicant-2.6-libressl-compatibility.patch 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. diff --git a/src/crypto/crypto_openssl.c b/src/crypto/crypto_openssl.c
  2. index 19e0e2be8..6585c0245 100644
  3. --- a/src/crypto/crypto_openssl.c
  4. +++ b/src/crypto/crypto_openssl.c
  5. @@ -33,7 +33,9 @@
  6. #include "aes_wrap.h"
  7. #include "crypto.h"
  8. -#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  9. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
  10. + (defined(LIBRESSL_VERSION_NUMBER) && \
  11. + LIBRESSL_VERSION_NUMBER < 0x20700000L)
  12. /* Compatibility wrappers for older versions. */
  13. static HMAC_CTX * HMAC_CTX_new(void)
  14. @@ -79,7 +81,9 @@ static void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  15. static BIGNUM * get_group5_prime(void)
  16. {
  17. -#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
  18. +#if OPENSSL_VERSION_NUMBER >= 0x10100000L && \
  19. + !(defined(LIBRESSL_VERSION_NUMBER) && \
  20. + LIBRESSL_VERSION_NUMBER < 0x20700000L)
  21. return BN_get_rfc3526_prime_1536(NULL);
  22. #elif !defined(OPENSSL_IS_BORINGSSL)
  23. return get_rfc3526_prime_1536(NULL);
  24. @@ -611,7 +615,9 @@ void crypto_cipher_deinit(struct crypto_cipher *ctx)
  25. void * dh5_init(struct wpabuf **priv, struct wpabuf **publ)
  26. {
  27. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  28. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
  29. + (defined(LIBRESSL_VERSION_NUMBER) && \
  30. + LIBRESSL_VERSION_NUMBER < 0x20700000L)
  31. DH *dh;
  32. struct wpabuf *pubkey = NULL, *privkey = NULL;
  33. size_t publen, privlen;
  34. @@ -712,7 +718,9 @@ err:
  35. void * dh5_init_fixed(const struct wpabuf *priv, const struct wpabuf *publ)
  36. {
  37. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  38. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
  39. + (defined(LIBRESSL_VERSION_NUMBER) && \
  40. + LIBRESSL_VERSION_NUMBER < 0x20700000L)
  41. DH *dh;
  42. dh = DH_new();
  43. diff --git a/src/crypto/tls_openssl.c b/src/crypto/tls_openssl.c
  44. index 23ac64b48..91acc579d 100644
  45. --- a/src/crypto/tls_openssl.c
  46. +++ b/src/crypto/tls_openssl.c
  47. @@ -59,7 +59,8 @@ typedef int stack_index_t;
  48. #endif /* SSL_set_tlsext_status_type */
  49. #if (OPENSSL_VERSION_NUMBER < 0x10100000L || \
  50. - defined(LIBRESSL_VERSION_NUMBER)) && \
  51. + (defined(LIBRESSL_VERSION_NUMBER) && \
  52. + LIBRESSL_VERSION_NUMBER < 0x20700000L)) && \
  53. !defined(BORINGSSL_API_VERSION)
  54. /*
  55. * SSL_get_client_random() and SSL_get_server_random() were added in OpenSSL
  56. @@ -919,7 +920,9 @@ void * tls_init(const struct tls_config *conf)
  57. }
  58. #endif /* OPENSSL_FIPS */
  59. #endif /* CONFIG_FIPS */
  60. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  61. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
  62. + (defined(LIBRESSL_VERSION_NUMBER) && \
  63. + LIBRESSL_VERSION_NUMBER < 0x20700000L)
  64. SSL_load_error_strings();
  65. SSL_library_init();
  66. #ifndef OPENSSL_NO_SHA256
  67. @@ -1043,7 +1046,9 @@ void tls_deinit(void *ssl_ctx)
  68. tls_openssl_ref_count--;
  69. if (tls_openssl_ref_count == 0) {
  70. -#if OPENSSL_VERSION_NUMBER < 0x10100000L
  71. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
  72. + (defined(LIBRESSL_VERSION_NUMBER) && \
  73. + LIBRESSL_VERSION_NUMBER < 0x20700000L)
  74. #ifndef OPENSSL_NO_ENGINE
  75. ENGINE_cleanup();
  76. #endif /* OPENSSL_NO_ENGINE */
  77. @@ -3105,7 +3110,9 @@ int tls_connection_get_random(void *ssl_ctx, struct tls_connection *conn,
  78. #ifdef OPENSSL_NEED_EAP_FAST_PRF
  79. static int openssl_get_keyblock_size(SSL *ssl)
  80. {
  81. -#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  82. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
  83. + (defined(LIBRESSL_VERSION_NUMBER) && \
  84. + LIBRESSL_VERSION_NUMBER < 0x20700000L)
  85. const EVP_CIPHER *c;
  86. const EVP_MD *h;
  87. int md_size;
  88. @@ -4159,7 +4166,9 @@ static int tls_sess_sec_cb(SSL *s, void *secret, int *secret_len,
  89. struct tls_connection *conn = arg;
  90. int ret;
  91. -#if OPENSSL_VERSION_NUMBER < 0x10100000L || defined(LIBRESSL_VERSION_NUMBER)
  92. +#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
  93. + (defined(LIBRESSL_VERSION_NUMBER) && \
  94. + LIBRESSL_VERSION_NUMBER < 0x20700000L)
  95. if (conn == NULL || conn->session_ticket_cb == NULL)
  96. return 0;