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

(-)Net-SSLeay-1.81-orig/SSLeay.xs (-4 / +93 lines)
Lines 195-200 Link Here
195
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
195
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
196
#include <openssl/ocsp.h>
196
#include <openssl/ocsp.h>
197
#endif
197
#endif
198
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
199
#include <openssl/bn.h>
200
#include <openssl/dh.h>
201
#include <openssl/rsa.h>
202
#endif
198
#undef BLOCK
203
#undef BLOCK
199
204
200
/* Debugging output - to enable use:
205
/* Debugging output - to enable use:
Lines 1471-1476 Link Here
1471
        : &PL_sv_undef;
1476
        : &PL_sv_undef;
1472
}
1477
}
1473
1478
1479
#if OPENSSL_API_COMPAT >= 0x10100000L
1480
#define SSLeay                  OpenSSL_version_num
1481
#define SSLeay_version          OpenSSL_version
1482
1483
#define SSL_library_init() OPENSSL_init_ssl(0, NULL)
1484
#define SSL_load_error_strings() \
1485
    OPENSSL_init_ssl(OPENSSL_INIT_LOAD_SSL_STRINGS \
1486
                     | OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
1487
1488
#define ERR_load_crypto_strings() \
1489
    OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL)
1490
#define ERR_free_strings() while(0) continue
1491
1492
#define RAND_pseudo_bytes RAND_bytes
1493
1494
#define RAND_cleanup() while(0) continue
1495
1496
#define X509_get_notBefore X509_getm_notBefore
1497
#define X509_get_notAfter X509_getm_notAfter
1498
#define X509_set_notBefore X509_set1_notBefore
1499
#define X509_set_notAfter X509_set1_notAfter
1500
#define X509_CRL_get_lastUpdate X509_CRL_get0_lastUpdate
1501
#define X509_CRL_get_nextUpdate X509_CRL_get0_nextUpdate
1502
#define X509_CRL_set_lastUpdate X509_CRL_set1_lastUpdate
1503
#define X509_CRL_set_nextUpdate X509_CRL_set1_nextUpdate
1504
1505
#define ASN1_STRING_data ASN1_STRING_get0_data
1506
1507
#define OPENSSL_add_all_algorithms_conf() \
1508
    OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
1509
                        | OPENSSL_INIT_ADD_ALL_DIGESTS \
1510
                        | OPENSSL_INIT_LOAD_CONFIG, NULL)
1511
1512
#define OPENSSL_add_all_algorithms_noconf() \
1513
    OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
1514
                        | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)
1515
1516
#ifdef OPENSSL_LOAD_CONF
1517
#define OpenSSL_add_all_algorithms() \
1518
    OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
1519
                        | OPENSSL_INIT_ADD_ALL_DIGESTS \
1520
                        | OPENSSL_INIT_LOAD_CONFIG, NULL)
1521
#else
1522
#define OpenSSL_add_all_algorithms() \
1523
    OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS \
1524
                        | OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)
1525
#endif
1526
1527
#define OpenSSL_add_all_digests() \
1528
    OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_DIGESTS, NULL)
1529
1530
static void _set_protocol_version(const SSL_METHOD *m, int version)
1531
{
1532
    SSL_CTX *ctx = SSL_CTX_new(m);
1533
    SSL_CTX_set_min_proto_version(ctx, version);
1534
    SSL_CTX_set_max_proto_version(ctx, version);
1535
    SSL_CTX_free(ctx);
1536
}
1537
1538
const SSL_METHOD *TLSv1_method(void)
1539
{
1540
    const SSL_METHOD *m = TLS_method();
1541
    _set_protocol_version(m, TLS1_VERSION);
1542
    return m;
1543
}
1544
1545
const SSL_METHOD *TLSv1_1_method(void)
1546
{
1547
    const SSL_METHOD *m = TLS_method();
1548
    _set_protocol_version(m, TLS1_1_VERSION);
1549
    return m;
1550
}
1551
1552
const SSL_METHOD *TLSv1_2_method(void)
1553
{
1554
    const SSL_METHOD *m = TLS_method();
1555
    _set_protocol_version(m, TLS1_2_VERSION);
1556
    return m;
1557
}
1558
1559
#endif
1560
1474
/* ============= end of helper functions ============== */
1561
/* ============= end of helper functions ============== */
1475
1562
1476
MODULE = Net::SSLeay		PACKAGE = Net::SSLeay          PREFIX = SSL_
1563
MODULE = Net::SSLeay		PACKAGE = Net::SSLeay          PREFIX = SSL_
Lines 4942-4948 Link Here
4942
5029
4943
#endif
5030
#endif
4944
5031
4945
#ifdef __ANDROID__
5032
#if defined(__ANDROID__) || OPENSSL_API_COMPAT >= 0x10100000L
4946
5033
4947
RSA *
5034
RSA *
4948
RSA_generate_key(bits,ee,perl_cb=&PL_sv_undef,perl_data=&PL_sv_undef)
5035
RSA_generate_key(bits,ee,perl_cb=&PL_sv_undef,perl_data=&PL_sv_undef)
Lines 4961-4977 Link Here
4961
       e = BN_new();
5048
       e = BN_new();
4962
       BN_set_word(e, ee);
5049
       BN_set_word(e, ee);
4963
       cb_data = simple_cb_data_new(perl_cb, perl_data);
5050
       cb_data = simple_cb_data_new(perl_cb, perl_data);
4964
       BN_GENCB new_cb;
5051
       BN_GENCB *new_cb  = BN_GENCB_new();
4965
       BN_GENCB_set_old(&new_cb, ssleay_RSA_generate_key_cb_invoke, cb_data);
5052
       BN_GENCB_set_old(new_cb, ssleay_RSA_generate_key_cb_invoke, cb_data);
4966
5053
4967
       ret = RSA_new();
5054
       ret = RSA_new();
4968
       rc = RSA_generate_key_ex(ret, bits, e, &new_cb);
5055
       rc = RSA_generate_key_ex(ret, bits, e, new_cb);
4969
       
5056
       
4970
       if (rc == -1 || ret == NULL)
5057
       if (rc == -1 || ret == NULL)
4971
           croak("Couldn't generate RSA key");
5058
           croak("Couldn't generate RSA key");
4972
       simple_cb_data_free(cb_data);
5059
       simple_cb_data_free(cb_data);
4973
       BN_free(e);
5060
       BN_free(e);
4974
       e = NULL;
5061
       e = NULL;
5062
       BN_GENCB_free(new_cb);
5063
       new_cb = NULL;
4975
       RETVAL = ret;
5064
       RETVAL = ret;
4976
    OUTPUT:
5065
    OUTPUT:
4977
        RETVAL
5066
        RETVAL

Return to bug 632566