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.

63 lines
2.5 KiB

  1. --- a/Modules/_ssl.c
  2. +++ b/Modules/_ssl.c
  3. @@ -201,6 +202,11 @@ static void _PySSLFixErrno(void) {
  4. #define TLS_method SSLv23_method
  5. #define TLS_client_method SSLv23_client_method
  6. #define TLS_server_method SSLv23_server_method
  7. +#define X509_getm_notBefore X509_get_notBefore
  8. +#define X509_getm_notAfter X509_get_notAfter
  9. +#define OpenSSL_version_num SSLeay
  10. +#define OpenSSL_version SSLeay_version
  11. +#define OPENSSL_VERSION SSLEAY_VERSION
  12. static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)
  13. {
  14. @@ -1677,7 +1683,7 @@ _decode_certificate(X509 *certificate) {
  15. Py_DECREF(sn_obj);
  16. (void) BIO_reset(biobuf);
  17. - notBefore = X509_get_notBefore(certificate);
  18. + notBefore = X509_getm_notBefore(certificate);
  19. ASN1_TIME_print(biobuf, notBefore);
  20. len = BIO_gets(biobuf, buf, sizeof(buf)-1);
  21. if (len < 0) {
  22. @@ -1694,7 +1700,7 @@ _decode_certificate(X509 *certificate) {
  23. Py_DECREF(pnotBefore);
  24. (void) BIO_reset(biobuf);
  25. - notAfter = X509_get_notAfter(certificate);
  26. + notAfter = X509_getm_notAfter(certificate);
  27. ASN1_TIME_print(biobuf, notAfter);
  28. len = BIO_gets(biobuf, buf, sizeof(buf)-1);
  29. if (len < 0) {
  30. @@ -3235,7 +3241,7 @@ _ssl__SSLContext_impl(PyTypeObject *type, int proto_version)
  31. conservative and assume it wasn't fixed until release. We do this check
  32. at runtime to avoid problems from the dynamic linker.
  33. See #25672 for more on this. */
  34. - libver = SSLeay();
  35. + libver = OpenSSL_version_num();
  36. if (!(libver >= 0x10001000UL && libver < 0x1000108fUL) &&
  37. !(libver >= 0x10000000UL && libver < 0x100000dfUL)) {
  38. SSL_CTX_set_mode(self->ctx, SSL_MODE_RELEASE_BUFFERS);
  39. @@ -6403,10 +6409,10 @@ PyInit__ssl(void)
  40. return NULL;
  41. /* OpenSSL version */
  42. - /* SSLeay() gives us the version of the library linked against,
  43. + /* OpenSSL_version_num() gives us the version of the library linked against,
  44. which could be different from the headers version.
  45. */
  46. - libver = SSLeay();
  47. + libver = OpenSSL_version_num();
  48. r = PyLong_FromUnsignedLong(libver);
  49. if (r == NULL)
  50. return NULL;
  51. @@ -6416,7 +6422,7 @@ PyInit__ssl(void)
  52. r = Py_BuildValue("IIIII", major, minor, fix, patch, status);
  53. if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_INFO", r))
  54. return NULL;
  55. - r = PyUnicode_FromString(SSLeay_version(SSLEAY_VERSION));
  56. + r = PyUnicode_FromString(OpenSSL_version(OPENSSL_VERSION));
  57. if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION", r))
  58. return NULL;