Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 592480 | Differences between
and this patch

Collapse All | Expand All

(-)Python-2.7.14-orig/Modules/_ssl.c (-6 / +23 lines)
Lines 69-74 Link Here
69
#include "openssl/ssl.h"
69
#include "openssl/ssl.h"
70
#include "openssl/err.h"
70
#include "openssl/err.h"
71
#include "openssl/rand.h"
71
#include "openssl/rand.h"
72
#include "openssl/dh.h"
72
73
73
/* SSL error object */
74
/* SSL error object */
74
static PyObject *PySSLErrorObject;
75
static PyObject *PySSLErrorObject;
Lines 137-142 Link Here
137
#endif
138
#endif
138
139
139
#define TLS_method SSLv23_method
140
#define TLS_method SSLv23_method
141
#define TLS_client_method SSLv23_client_method
142
#define TLS_server_method SSLv23_server_method
143
#define X509_get0_notBefore X509_get_notBefore
144
#define X509_get0_notAfter X509_get_notAfter
145
#define ASN1_STRING_get0_data ASN1_STRING_data
146
#define OpenSSL_version_num SSLeay
147
#define OpenSSL_version SSLeay_version
148
#define OPENSSL_VERSION SSLEAY_VERSION
140
149
141
static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)
150
static int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne)
142
{
151
{
Lines 944-950 Link Here
944
                    goto fail;
953
                    goto fail;
945
                }
954
                }
946
                PyTuple_SET_ITEM(t, 0, v);
955
                PyTuple_SET_ITEM(t, 0, v);
947
                v = PyString_FromStringAndSize((char *)ASN1_STRING_data(as),
956
                v = PyString_FromStringAndSize((char *)ASN1_STRING_get0_data(as),
948
                                               ASN1_STRING_length(as));
957
                                               ASN1_STRING_length(as));
949
                if (v == NULL) {
958
                if (v == NULL) {
950
                    Py_DECREF(t);
959
                    Py_DECREF(t);
Lines 1245-1251 Link Here
1245
    Py_DECREF(sn_obj);
1254
    Py_DECREF(sn_obj);
1246
1255
1247
    (void) BIO_reset(biobuf);
1256
    (void) BIO_reset(biobuf);
1248
    notBefore = X509_get_notBefore(certificate);
1257
    notBefore = X509_get0_notBefore(certificate);
1249
    ASN1_TIME_print(biobuf, notBefore);
1258
    ASN1_TIME_print(biobuf, notBefore);
1250
    len = BIO_gets(biobuf, buf, sizeof(buf)-1);
1259
    len = BIO_gets(biobuf, buf, sizeof(buf)-1);
1251
    if (len < 0) {
1260
    if (len < 0) {
Lines 1262-1268 Link Here
1262
    Py_DECREF(pnotBefore);
1271
    Py_DECREF(pnotBefore);
1263
1272
1264
    (void) BIO_reset(biobuf);
1273
    (void) BIO_reset(biobuf);
1265
    notAfter = X509_get_notAfter(certificate);
1274
    notAfter = X509_get0_notAfter(certificate);
1266
    ASN1_TIME_print(biobuf, notAfter);
1275
    ASN1_TIME_print(biobuf, notAfter);
1267
    len = BIO_gets(biobuf, buf, sizeof(buf)-1);
1276
    len = BIO_gets(biobuf, buf, sizeof(buf)-1);
1268
    if (len < 0) {
1277
    if (len < 0) {
Lines 4154-4162 Link Here
4154
    if (PySocketModule_ImportModuleAndAPI())
4163
    if (PySocketModule_ImportModuleAndAPI())
4155
        return;
4164
        return;
4156
4165
4166
#ifdef OPENSSL_VERSION_1_1
4167
    OPENSSL_init_ssl(0, NULL);
4168
#else
4157
    /* Init OpenSSL */
4169
    /* Init OpenSSL */
4158
    SSL_load_error_strings();
4170
    SSL_load_error_strings();
4159
    SSL_library_init();
4171
    SSL_library_init();
4172
#endif
4173
4160
#ifdef WITH_THREAD
4174
#ifdef WITH_THREAD
4161
#ifdef HAVE_OPENSSL_CRYPTO_LOCK
4175
#ifdef HAVE_OPENSSL_CRYPTO_LOCK
4162
    /* note that this will start threading if not already started */
4176
    /* note that this will start threading if not already started */
Lines 4168-4174 Link Here
4168
    _ssl_locks_count++;
4182
    _ssl_locks_count++;
4169
#endif
4183
#endif
4170
#endif  /* WITH_THREAD */
4184
#endif  /* WITH_THREAD */
4185
    
4186
#ifndef OPENSSL_VERSION_1_1
4171
    OpenSSL_add_all_algorithms();
4187
    OpenSSL_add_all_algorithms();
4188
#endif
4172
4189
4173
    /* Add symbols to module dict */
4190
    /* Add symbols to module dict */
4174
    PySSLErrorObject = PyErr_NewExceptionWithDoc(
4191
    PySSLErrorObject = PyErr_NewExceptionWithDoc(
Lines 4438-4447 Link Here
4438
        return;
4455
        return;
4439
4456
4440
    /* OpenSSL version */
4457
    /* OpenSSL version */
4441
    /* SSLeay() gives us the version of the library linked against,
4458
    /* OpenSSL_version_num() gives us the version of the library linked against,
4442
       which could be different from the headers version.
4459
       which could be different from the headers version.
4443
    */
4460
    */
4444
    libver = SSLeay();
4461
    libver = OpenSSL_version_num();
4445
    r = PyLong_FromUnsignedLong(libver);
4462
    r = PyLong_FromUnsignedLong(libver);
4446
    if (r == NULL)
4463
    if (r == NULL)
4447
        return;
4464
        return;
Lines 4451-4457 Link Here
4451
    r = Py_BuildValue("IIIII", major, minor, fix, patch, status);
4468
    r = Py_BuildValue("IIIII", major, minor, fix, patch, status);
4452
    if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_INFO", r))
4469
    if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION_INFO", r))
4453
        return;
4470
        return;
4454
    r = PyString_FromString(SSLeay_version(SSLEAY_VERSION));
4471
    r = PyString_FromString(OpenSSL_version(OPENSSL_VERSION));
4455
    if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION", r))
4472
    if (r == NULL || PyModule_AddObject(m, "OPENSSL_VERSION", r))
4456
        return;
4473
        return;
4457
4474
(-)Python-2.7.14-orig/Modules/_hashopenssl.c (+2 lines)
Lines 899-906 Link Here
899
{
899
{
900
    PyObject *m, *openssl_md_meth_names;
900
    PyObject *m, *openssl_md_meth_names;
901
901
902
#if (OPENSSL_VERSION_NUMBER < 0x10100000L) || defined(LIBRESSL_VERSION_NUMBER)
902
    OpenSSL_add_all_digests();
903
    OpenSSL_add_all_digests();
903
    ERR_load_crypto_strings();
904
    ERR_load_crypto_strings();
905
#endif
904
906
905
    /* TODO build EVP_functions openssl_* entries dynamically based
907
    /* TODO build EVP_functions openssl_* entries dynamically based
906
     * on what hashes are supported rather than listing many
908
     * on what hashes are supported rather than listing many

Return to bug 592480