Skip to content

Commit

Permalink
Add defines for totally deprecated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
neheb committed Feb 15, 2021
1 parent 5a27c43 commit d16f033
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/_cffi_src/openssl/asn1.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,7 @@
"""

CUSTOMIZATIONS = """
#if (OPENSSL_API_COMPAT >= 0x10100000L) && !CRYPTOGRAPHY_IS_LIBRESSL
#define ASN1_STRING_data ASN1_STRING_get0_data
#endif
"""
4 changes: 4 additions & 0 deletions src/_cffi_src/openssl/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
"""

CUSTOMIZATIONS = """
#if (OPENSSL_API_COMPAT >= 0x10100000L) && !CRYPTOGRAPHY_IS_LIBRESSL
#define OPENSSL_config(x) 0
#define OPENSSL_no_config() 0
#endif
"""
4 changes: 4 additions & 0 deletions src/_cffi_src/openssl/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,8 @@
void Cryptography_free_wrapper(void *ptr, const char *path, int line) {
free(ptr);
}
#if (OPENSSL_API_COMPAT >= 0x10100000L) && !CRYPTOGRAPHY_IS_LIBRESSL
#define CRYPTO_get_locking_callback() 0
#endif
"""
3 changes: 3 additions & 0 deletions src/_cffi_src/openssl/ecdh.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
"""

CUSTOMIZATIONS = """
#if (OPENSSL_API_COMPAT >= 0x10100000L) && !CRYPTOGRAPHY_IS_LIBRESSL
#define SSL_CTX_set_ecdh_auto(a, b) ((b) != 0)
#endif
"""
5 changes: 5 additions & 0 deletions src/_cffi_src/openssl/evp.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,4 +269,9 @@
#ifndef EVP_PKEY_POLY1305
#define EVP_PKEY_POLY1305 NID_poly1305
#endif
#if (OPENSSL_API_COMPAT >= 0x10100000L) && !CRYPTOGRAPHY_IS_LIBRESSL
#define EVP_CIPHER_CTX_cleanup EVP_CIPHER_CTX_reset
#define OpenSSL_add_all_algorithms() do {} while(0)
#endif
"""
5 changes: 5 additions & 0 deletions src/_cffi_src/openssl/ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -745,4 +745,9 @@
#else
static const long Cryptography_HAS_GET_PROTO_VERSION = 1;
#endif
#if (OPENSSL_API_COMPAT >= 0x10100000L) && !CRYPTOGRAPHY_IS_LIBRESSL
#define SSL_library_init() 1
#define SSL_load_error_strings() 0
#endif
"""
12 changes: 12 additions & 0 deletions src/_cffi_src/openssl/x509.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,4 +305,16 @@
return i2d_X509_CRL_INFO(crl->crl, pp);
}
#endif
#if (OPENSSL_API_COMPAT >= 0x10100000L) && !CRYPTOGRAPHY_IS_LIBRESSL
#define X509_get_notBefore X509_get0_notBefore
#define X509_get_notAfter X509_get0_notAfter
#define X509_set_notBefore X509_set1_notBefore
#define X509_set_notAfter X509_set1_notAfter
#define X509_CRL_get_lastUpdate X509_CRL_get0_lastUpdate
#define X509_CRL_get_nextUpdate X509_CRL_get0_nextUpdate
#define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate
#define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate
#endif
"""
6 changes: 6 additions & 0 deletions src/_cffi_src/openssl/x509_vfy.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,4 +265,10 @@
#else
static const long Cryptography_HAS_X509_CB_ISSUER_CHECK = 1;
#endif
#if (OPENSSL_API_COMPAT >= 0x10100000L) && !CRYPTOGRAPHY_IS_LIBRESSL
#define X509_STORE_CTX_trusted_stack X509_STORE_CTX_set0_trusted_stack
#define X509_STORE_CTX_set_chain X509_STORE_CTX_set0_untrusted
#define X509_STORE_CTX_get_chain X509_STORE_CTX_get1_chain
#endif
"""

0 comments on commit d16f033

Please sign in to comment.