Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 604842
Collapse All | Expand All

(-)M2Crypto-0.27.0-orig/SWIG/_m2crypto.i (+1 lines)
Lines 26-31 Link Here
26
#pragma GCC diagnostic warning "-Wstrict-prototypes"
26
#pragma GCC diagnostic warning "-Wstrict-prototypes"
27
#endif
27
#endif
28
28
29
#include <openssl/dsa.h>
29
#include <openssl/err.h>
30
#include <openssl/err.h>
30
#include <openssl/rand.h>
31
#include <openssl/rand.h>
31
#include <_lib.h>
32
#include <_lib.h>
(-)M2Crypto-0.27.0-orig/SWIG/_engine.i (-9 / +22 lines)
Lines 23-37 Link Here
23
%rename(engine_load_builtin_engines) ENGINE_load_builtin_engines;
23
%rename(engine_load_builtin_engines) ENGINE_load_builtin_engines;
24
extern void ENGINE_load_builtin_engines(void);
24
extern void ENGINE_load_builtin_engines(void);
25
25
26
%rename(engine_load_dynamic) ENGINE_load_dynamic;
27
extern void ENGINE_load_dynamic(void);
28
29
%rename(engine_load_openssl) ENGINE_load_openssl;
30
extern void ENGINE_load_openssl(void);
31
32
%rename(engine_cleanup) ENGINE_cleanup;
33
extern void ENGINE_cleanup(void);
34
35
/*
26
/*
36
 * Engine allocation functions
27
 * Engine allocation functions
37
 */
28
 */
Lines 111-116 Link Here
111
 * optional password set.
102
 * optional password set.
112
 */
103
 */
113
104
105
void engine_load_dynamic(void) {
106
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
107
    OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_DYNAMIC, NULL);
108
#else
109
    ENGINE_load_dynamic();
110
#endif
111
}
112
113
void engine_load_openssl(void) {
114
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
115
    OPENSSL_init_crypto(OPENSSL_INIT_ENGINE_OPENSSL, NULL);
116
#else
117
    ENGINE_load_openssl();
118
#endif
119
}
120
121
void engine_cleanup(void) {
122
#if OPENSSL_VERSION_NUMBER < 0x10100000L
123
    ENGINE_cleanup();
124
#endif
125
}
126
114
typedef struct {
127
typedef struct {
115
    char * password;
128
    char * password;
116
    char * prompt;
129
    char * prompt;
(-)M2Crypto-0.27.0-orig/SWIG/_rand.i (-2 / +10 lines)
Lines 16-28 Link Here
16
extern int RAND_poll(void);
16
extern int RAND_poll(void);
17
%rename(rand_status) RAND_status;
17
%rename(rand_status) RAND_status;
18
extern int RAND_status(void);
18
extern int RAND_status(void);
19
%rename(rand_cleanup) RAND_cleanup;
20
extern void RAND_cleanup(void);
21
19
22
%warnfilter(454) _rand_err;
20
%warnfilter(454) _rand_err;
23
%inline %{
21
%inline %{
24
static PyObject *_rand_err;
22
static PyObject *_rand_err;
25
23
24
void rand_cleanup(void) {
25
#if OPENSSL_VERSION_NUMBER < 0x10100000L
26
    RAND_cleanup();
27
#endif
28
}
29
26
void rand_init(PyObject *rand_err) {
30
void rand_init(PyObject *rand_err) {
27
    Py_INCREF(rand_err);
31
    Py_INCREF(rand_err);
28
    _rand_err = rand_err;
32
    _rand_err = rand_err;
Lines 86-92 Link Here
86
        PyMem_Free(blob);
90
        PyMem_Free(blob);
87
        return NULL;
91
        return NULL;
88
    }
92
    }
93
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
94
    ret = (_PyOS_URandom(blob, n) == 0 ? 1 : 0);
95
#else
89
    ret = RAND_pseudo_bytes(blob, n);
96
    ret = RAND_pseudo_bytes(blob, n);
97
#endif
90
    if (ret == -1) {
98
    if (ret == -1) {
91
        PyMem_Free(blob);
99
        PyMem_Free(blob);
92
        Py_DECREF(tuple);
100
        Py_DECREF(tuple);
(-)M2Crypto-0.27.0-orig/SWIG/_ssl.i (-2 / +34 lines)
Lines 19-24 Link Here
19
#include <pythread.h>
19
#include <pythread.h>
20
#include <limits.h>
20
#include <limits.h>
21
#include <openssl/bio.h>
21
#include <openssl/bio.h>
22
#include <openssl/crypto.h>
22
#include <openssl/dh.h>
23
#include <openssl/dh.h>
23
#include <openssl/ssl.h>
24
#include <openssl/ssl.h>
24
#include <openssl/tls1.h>
25
#include <openssl/tls1.h>
Lines 258-278 Link Here
258
static PyObject *_ssl_timeout_err;
259
static PyObject *_ssl_timeout_err;
259
260
260
void ssl_init(PyObject *ssl_err, PyObject *ssl_timeout_err) {
261
void ssl_init(PyObject *ssl_err, PyObject *ssl_timeout_err) {
262
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
263
    OPENSSL_init_ssl(0, NULL);
264
    OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \
265
                     | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
266
#else
261
    SSL_library_init();
267
    SSL_library_init();
262
    SSL_load_error_strings();
268
    SSL_load_error_strings();
269
#endif
263
    Py_INCREF(ssl_err);
270
    Py_INCREF(ssl_err);
264
    Py_INCREF(ssl_timeout_err);
271
    Py_INCREF(ssl_timeout_err);
265
    _ssl_err = ssl_err;
272
    _ssl_err = ssl_err;
266
    _ssl_timeout_err = ssl_timeout_err;
273
    _ssl_timeout_err = ssl_timeout_err;
267
}
274
}
268
275
276
static void _set_protocol_version(const SSL_METHOD *m, int version)
277
{
278
    SSL_CTX *ctx = SSL_CTX_new(m);
279
    SSL_CTX_set_min_proto_version(ctx, version);
280
    SSL_CTX_set_max_proto_version(ctx, version);
281
    SSL_CTX_free(ctx);
282
}
283
269
#ifndef OPENSSL_NO_SSL3
284
#ifndef OPENSSL_NO_SSL3
270
const SSL_METHOD *sslv3_method(void) {
285
const SSL_METHOD *sslv3_method(void) {
271
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
286
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
272
    PyErr_WarnEx(PyExc_DeprecationWarning,
287
    PyErr_WarnEx(PyExc_DeprecationWarning,
273
                 "Function SSLv3_method has been deprecated.", 1);
288
                 "Function SSLv3_method has been deprecated.", 1);
274
#endif
289
    const SSL_METHOD *m = TLS_method();
290
    _set_protocol_version(m, SSL3_VERSION);
291
    return m;
292
#else
275
    return SSLv3_method();
293
    return SSLv3_method();
294
#endif
276
}
295
}
277
#endif
296
#endif
278
297
Lines 280-287 Link Here
280
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
299
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
281
    PyErr_WarnEx(PyExc_DeprecationWarning,
300
    PyErr_WarnEx(PyExc_DeprecationWarning,
282
                 "Function TLSv1_method has been deprecated.", 1);
301
                 "Function TLSv1_method has been deprecated.", 1);
283
#endif
302
    const SSL_METHOD *m = TLS_method();
303
    _set_protocol_version(m, TLS1_VERSION);
304
    return m;
305
#else
284
    return TLSv1_method();
306
    return TLSv1_method();
307
#endif
285
}
308
}
286
309
287
void ssl_ctx_passphrase_callback(SSL_CTX *ctx, PyObject *pyfunc) {
310
void ssl_ctx_passphrase_callback(SSL_CTX *ctx, PyObject *pyfunc) {
Lines 407-420 Link Here
407
}
430
}
408
431
409
long ssl_ctx_set_tmp_rsa(SSL_CTX *ctx, RSA* rsa) {
432
long ssl_ctx_set_tmp_rsa(SSL_CTX *ctx, RSA* rsa) {
433
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
434
    return 1;
435
#else
410
    return SSL_CTX_set_tmp_rsa(ctx, rsa);
436
    return SSL_CTX_set_tmp_rsa(ctx, rsa);
437
#endif
411
}
438
}
412
439
413
void ssl_ctx_set_tmp_rsa_callback(SSL_CTX *ctx,  PyObject *pyfunc) {
440
void ssl_ctx_set_tmp_rsa_callback(SSL_CTX *ctx,  PyObject *pyfunc) {
414
    Py_XDECREF(ssl_set_tmp_rsa_cb_func);
441
    Py_XDECREF(ssl_set_tmp_rsa_cb_func);
415
    Py_INCREF(pyfunc);
442
    Py_INCREF(pyfunc);
416
    ssl_set_tmp_rsa_cb_func = pyfunc;
443
    ssl_set_tmp_rsa_cb_func = pyfunc;
444
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
445
    (void)ctx;
446
    (void)ssl_set_tmp_rsa_cb_func;
447
#else
417
    SSL_CTX_set_tmp_rsa_callback(ctx, ssl_set_tmp_rsa_callback);
448
    SSL_CTX_set_tmp_rsa_callback(ctx, ssl_set_tmp_rsa_callback);
449
#endif
418
}
450
}
419
451
420
int ssl_ctx_load_verify_locations(SSL_CTX *ctx, const char *cafile, const char *capath) {
452
int ssl_ctx_load_verify_locations(SSL_CTX *ctx, const char *cafile, const char *capath) {
(-)M2Crypto-0.27.0-orig/SWIG/_util.i (-2 / +7 lines)
Lines 11-16 Link Here
11
%inline %{
11
%inline %{
12
static PyObject *_util_err;
12
static PyObject *_util_err;
13
13
14
#if OPENSSL_VERSION_NUMBER < 0x10100000L
15
#define OPENSSL_buf2hexstr hex_to_string
16
#define OPENSSL_hexstr2buf string_to_hex
17
#endif
18
14
void util_init(PyObject *util_err) {
19
void util_init(PyObject *util_err) {
15
    Py_INCREF(util_err);
20
    Py_INCREF(util_err);
16
    _util_err = util_err;
21
    _util_err = util_err;
Lines 25-31 Link Here
25
    if (PyObject_AsReadBuffer(blob, &buf, &len) == -1)
30
    if (PyObject_AsReadBuffer(blob, &buf, &len) == -1)
26
        return NULL;
31
        return NULL;
27
32
28
    ret = hex_to_string((unsigned char *)buf, len);
33
    ret = OPENSSL_buf2hexstr((unsigned char *)buf, len);
29
    if (!ret) {
34
    if (!ret) {
30
        m2_PyErr_Msg(_util_err);
35
        m2_PyErr_Msg(_util_err);
31
        return NULL;
36
        return NULL;
Lines 52-58 Link Here
52
        return NULL;
57
        return NULL;
53
58
54
    len = len0;
59
    len = len0;
55
    ret = string_to_hex((char *)buf, &len);
60
    ret = OPENSSL_hexstr2buf((char *)buf, &len);
56
    if (ret == NULL) {
61
    if (ret == NULL) {
57
        m2_PyErr_Msg(_util_err);
62
        m2_PyErr_Msg(_util_err);
58
        return NULL;
63
        return NULL;
(-)M2Crypto-0.27.0-orig/SWIG/_x509.i (-4 / +11 lines)
Lines 38-43 Link Here
38
extern int X509_check_ca(X509 *);
38
extern int X509_check_ca(X509 *);
39
#endif
39
#endif
40
40
41
#if OPENSSL_VERSION_NUMBER < 0x10100000L
42
#define X509_getm_notBefore X509_get_notBefore
43
#define X509_getm_notAfter X509_get_notAfter
44
#define X509_set1_notBefore X509_set_notBefore
45
#define X509_set1_notAfter X509_set_notAfter
46
#endif
47
41
%rename(x509_new) X509_new;
48
%rename(x509_new) X509_new;
42
extern X509 *X509_new( void );
49
extern X509 *X509_new( void );
43
%rename(x509_dup) X509_dup;
50
%rename(x509_dup) X509_dup;
Lines 425-446 Link Here
425
432
426
/* X509_set_notBefore() is a macro. */
433
/* X509_set_notBefore() is a macro. */
427
int x509_set_not_before(X509 *x, ASN1_TIME *tm) {
434
int x509_set_not_before(X509 *x, ASN1_TIME *tm) {
428
    return X509_set_notBefore(x, tm);
435
    return X509_set1_notBefore(x, tm);
429
}
436
}
430
437
431
/* X509_get_notBefore() is a macro. */
438
/* X509_get_notBefore() is a macro. */
432
ASN1_TIME *x509_get_not_before(X509 *x) {
439
ASN1_TIME *x509_get_not_before(X509 *x) {
433
    return X509_get_notBefore(x);
440
    return X509_getm_notBefore(x);
434
}
441
}
435
442
436
/* X509_set_notAfter() is a macro. */
443
/* X509_set_notAfter() is a macro. */
437
int x509_set_not_after(X509 *x, ASN1_TIME *tm) {
444
int x509_set_not_after(X509 *x, ASN1_TIME *tm) {
438
    return X509_set_notAfter(x, tm);
445
    return X509_set1_notAfter(x, tm);
439
}
446
}
440
447
441
/* X509_get_notAfter() is a macro. */
448
/* X509_get_notAfter() is a macro. */
442
ASN1_TIME *x509_get_not_after(X509 *x) {
449
ASN1_TIME *x509_get_not_after(X509 *x) {
443
    return X509_get_notAfter(x);
450
    return X509_getm_notAfter(x);
444
}
451
}
445
452
446
int x509_sign(X509 *x, EVP_PKEY *pkey, EVP_MD *md) {
453
int x509_sign(X509 *x, EVP_PKEY *pkey, EVP_MD *md) {

Return to bug 604842