You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
2.0 KiB

  1. From 77b25307a743eb52ef5ead24c956e577f5bd025f Mon Sep 17 00:00:00 2001
  2. From: Rosen Penev <rosenp@gmail.com>
  3. Date: Fri, 7 Jun 2019 20:42:04 -0700
  4. Subject: [PATCH 2/7] Add compatibility for X509_STORE_set_get_issuer
  5. Deprecated under OpenSSL 1.1.
  6. ---
  7. src/_cffi_src/openssl/x509_vfy.py | 8 ++++++++
  8. src/cryptography/hazmat/bindings/openssl/_conditional.py | 8 ++++++++
  9. 2 files changed, 16 insertions(+)
  10. --- a/src/_cffi_src/openssl/x509_vfy.py
  11. +++ b/src/_cffi_src/openssl/x509_vfy.py
  12. @@ -21,6 +21,7 @@ TYPES = """
  13. static const long Cryptography_HAS_102_VERIFICATION;
  14. static const long Cryptography_HAS_110_VERIFICATION_PARAMS;
  15. static const long Cryptography_HAS_X509_STORE_CTX_GET_ISSUER;
  16. +static const long Cryptography_HAS_X509_CB_ISSUER_CHECK;
  17. typedef ... Cryptography_STACK_OF_ASN1_OBJECT;
  18. typedef ... Cryptography_STACK_OF_X509_OBJECT;
  19. @@ -257,4 +258,11 @@ void (*X509_STORE_set_get_issuer)(X509_S
  20. #else
  21. static const long Cryptography_HAS_X509_STORE_CTX_GET_ISSUER = 1;
  22. #endif
  23. +
  24. +#ifndef X509_V_FLAG_CB_ISSUER_CHECK
  25. +static const long Cryptography_HAS_X509_CB_ISSUER_CHECK = 0;
  26. +#define X509_V_FLAG_CB_ISSUER_CHECK 0x0
  27. +#else
  28. +static const long Cryptography_HAS_X509_CB_ISSUER_CHECK = 1;
  29. +#endif
  30. """
  31. --- a/src/cryptography/hazmat/bindings/openssl/_conditional.py
  32. +++ b/src/cryptography/hazmat/bindings/openssl/_conditional.py
  33. @@ -269,6 +269,11 @@ def cryptography_has_get_proto_version()
  34. "SSL_get_max_proto_version",
  35. ]
  36. +def cryptography_has_x509_cb_issuer_check():
  37. + return [
  38. + "X509_V_FLAG_CB_ISSUER_CHECK",
  39. + ]
  40. +
  41. # This is a mapping of
  42. # {condition: function-returning-names-dependent-on-that-condition} so we can
  43. @@ -318,4 +323,7 @@ CONDITIONAL_NAMES = {
  44. "Cryptography_HAS_VERIFIED_CHAIN": cryptography_has_verified_chain,
  45. "Cryptography_HAS_SRTP": cryptography_has_srtp,
  46. "Cryptography_HAS_GET_PROTO_VERSION": cryptography_has_get_proto_version,
  47. + "Cryptography_HAS_X509_CB_ISSUER_CHECK": (
  48. + cryptography_has_x509_cb_issuer_check
  49. + ),
  50. }