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

Collapse All | Expand All

(-)file_not_specified_in_diff (-42 / +90 lines)
Line  Link Here
0
-- ruby-1.9.1-p376/ext/openssl/openssl_missing.c
0
++ ruby-1.9.1-p376/ext/openssl/openssl_missing.c
Lines 41-47 Link Here
41
{
41
{
42
    return CRYPTO_set_ex_data(&str->ex_data, idx, data);
42
    return CRYPTO_set_ex_data(&str->ex_data, idx, data);
43
}
43
}
44
 
44
#endif
45
46
#if !defined(HAVE_X509_STORE_GET_EX_DATA) 
45
void *X509_STORE_get_ex_data(X509_STORE *str, int idx)
47
void *X509_STORE_get_ex_data(X509_STORE *str, int idx)
46
{
48
{
47
    return CRYPTO_get_ex_data(&str->ex_data, idx);
49
    return CRYPTO_get_ex_data(&str->ex_data, idx);
48
-- ruby-1.9.1-p376/ext/openssl/openssl_missing.h
50
++ ruby-1.9.1-p376/ext/openssl/openssl_missing.h
Lines 60-66 Link Here
60
	(d2i_of_void *)d2i_PKCS7_RECIP_INFO, (char *)ri)
60
	(d2i_of_void *)d2i_PKCS7_RECIP_INFO, (char *)ri)
61
#endif
61
#endif
62
62
63
#if !defined(HAVE_EVP_MD_CTX_INIT)
63
#if !defined(HAVE_HMAC_CTX_INIT)
64
void HMAC_CTX_init(HMAC_CTX *ctx);
64
void HMAC_CTX_init(HMAC_CTX *ctx);
65
#endif
65
#endif
66
66
Lines 130-137 Link Here
130
#define OPENSSL_cleanse(p, l) memset(p, 0, l)
130
#define OPENSSL_cleanse(p, l) memset(p, 0, l)
131
#endif
131
#endif
132
132
133
#if !defined(HAVE_X509_STORE_SET_EX_DATA)
133
#if !defined(HAVE_X509_STORE_GET_EX_DATA)
134
void *X509_STORE_get_ex_data(X509_STORE *str, int idx);
134
void *X509_STORE_get_ex_data(X509_STORE *str, int idx);
135
#endif
136
137
#if !defined(HAVE_X509_STORE_SET_EX_DATA)
135
int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data);
138
int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data);
136
#endif
139
#endif
137
140
138
-- ruby-1.9.1-p376/ext/openssl/ossl.c
141
++ ruby-1.9.1-p376/ext/openssl/ossl.c
Lines 92-98 Link Here
92
92
93
#define OSSL_IMPL_SK2ARY(name, type)	        \
93
#define OSSL_IMPL_SK2ARY(name, type)	        \
94
VALUE						\
94
VALUE						\
95
ossl_##name##_sk2ary(STACK *sk)			\
95
ossl_##name##_sk2ary(STACK_OF(type) *sk)	\
96
{						\
96
{						\
97
    type *t;					\
97
    type *t;					\
98
    int i, num;					\
98
    int i, num;					\
Lines 102-108 Link Here
102
	OSSL_Debug("empty sk!");		\
102
	OSSL_Debug("empty sk!");		\
103
	return Qnil;				\
103
	return Qnil;				\
104
    }						\
104
    }						\
105
    num = sk_num(sk);				\
105
    num = sk_##type##_num(sk);			\
106
    if (num < 0) {				\
106
    if (num < 0) {				\
107
	OSSL_Debug("items in sk < -1???");	\
107
	OSSL_Debug("items in sk < -1???");	\
108
	return rb_ary_new();			\
108
	return rb_ary_new();			\
Lines 110-116 Link Here
110
    ary = rb_ary_new2(num);			\
110
    ary = rb_ary_new2(num);			\
111
						\
111
						\
112
    for (i=0; i<num; i++) {			\
112
    for (i=0; i<num; i++) {			\
113
	t = (type *)sk_value(sk, i);		\
113
	t = sk_##type##_value(sk, i);		\
114
	rb_ary_push(ary, ossl_##name##_new(t));	\
114
	rb_ary_push(ary, ossl_##name##_new(t));	\
115
    }						\
115
    }						\
116
    return ary;					\
116
    return ary;					\
117
-- ruby-1.9.1-p376/ext/openssl/ossl_config.c
117
++ ruby-1.9.1-p376/ext/openssl/ossl_config.c
Lines 301-315 Link Here
301
    return ossl_config_get_section(self, section);
301
    return ossl_config_get_section(self, section);
302
}
302
}
303
303
304
#ifdef IMPLEMENT_LHASH_DOALL_ARG_FN
304
#if defined(IMPLEMENT_LHASH_DOALL_ARG_FN) && defined(LHASH_OF)
305
static void
305
static void
306
get_conf_section(CONF_VALUE *cv, VALUE ary)
306
get_conf_section_doall_arg(CONF_VALUE *cv, void *tmp)
307
{
307
{
308
    VALUE ary = (VALUE)tmp;
308
    if(cv->name) return;
309
    if(cv->name) return;
309
    rb_ary_push(ary, rb_str_new2(cv->section));
310
    rb_ary_push(ary, rb_str_new2(cv->section));
310
}
311
}
311
312
312
static IMPLEMENT_LHASH_DOALL_ARG_FN(get_conf_section, CONF_VALUE*, VALUE);
313
static IMPLEMENT_LHASH_DOALL_ARG_FN(get_conf_section, CONF_VALUE, void)
313
314
314
static VALUE
315
static VALUE
315
ossl_config_get_sections(VALUE self)
316
ossl_config_get_sections(VALUE self)
Lines 319-332 Link Here
319
320
320
    GetConfig(self, conf);
321
    GetConfig(self, conf);
321
    ary = rb_ary_new();
322
    ary = rb_ary_new();
322
    lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(get_conf_section), (void*)ary);
323
    lh_doall_arg((_LHASH *)conf->data, LHASH_DOALL_ARG_FN(get_conf_section),
324
		(void*)ary);
323
325
324
    return ary;
326
    return ary;
325
}
327
}
326
328
327
static void
329
static void
328
dump_conf_value(CONF_VALUE *cv, VALUE str)
330
dump_conf_value_doall_arg(CONF_VALUE *cv, void *tmp)
329
{
331
{
332
    VALUE str = (VALUE)tmp;
330
    STACK_OF(CONF_VALUE) *sk;
333
    STACK_OF(CONF_VALUE) *sk;
331
    CONF_VALUE *v;
334
    CONF_VALUE *v;
332
    int i, num;
335
    int i, num;
Lines 347-353 Link Here
347
    rb_str_cat2(str, "\n");
350
    rb_str_cat2(str, "\n");
348
}
351
}
349
352
350
static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_conf_value, CONF_VALUE*, VALUE);
353
static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_conf_value, CONF_VALUE, void)
351
354
352
static VALUE
355
static VALUE
353
dump_conf(CONF *conf)
356
dump_conf(CONF *conf)
Lines 355-361 Link Here
355
    VALUE str;
358
    VALUE str;
356
359
357
    str = rb_str_new(0, 0);
360
    str = rb_str_new(0, 0);
358
    lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_conf_value), (void*)str);
361
    lh_doall_arg((_LHASH *)conf->data, LHASH_DOALL_ARG_FN(dump_conf_value),
362
		(void*)str);
359
363
360
    return str;
364
    return str;
361
}
365
}
Lines 371-377 Link Here
371
}
375
}
372
376
373
static void
377
static void
374
each_conf_value(CONF_VALUE *cv, void* dummy)
378
each_conf_value_doall_arg(CONF_VALUE *cv, void *dummy)
375
{
379
{
376
    STACK_OF(CONF_VALUE) *sk;
380
    STACK_OF(CONF_VALUE) *sk;
377
    CONF_VALUE *v;
381
    CONF_VALUE *v;
Lines 391-397 Link Here
391
    }
395
    }
392
}
396
}
393
397
394
static IMPLEMENT_LHASH_DOALL_ARG_FN(each_conf_value, CONF_VALUE*, void*);
398
static IMPLEMENT_LHASH_DOALL_ARG_FN(each_conf_value, CONF_VALUE, void *)
395
399
396
static VALUE
400
static VALUE
397
ossl_config_each(VALUE self)
401
ossl_config_each(VALUE self)
Lines 401-407 Link Here
401
    RETURN_ENUMERATOR(self, 0, 0);
405
    RETURN_ENUMERATOR(self, 0, 0);
402
406
403
    GetConfig(self, conf);
407
    GetConfig(self, conf);
404
    lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(each_conf_value), (void*)NULL);
408
    lh_doall_arg((_LHASH *)conf->data, LHASH_DOALL_ARG_FN(each_conf_value),
409
		(void*)NULL);
405
410
406
    return self;
411
    return self;
407
}
412
}
408
-- ruby-1.9.1-p376/ext/openssl/ossl.h
413
++ ruby-1.9.1-p376/ext/openssl/ossl.h
Lines 104-109 Link Here
104
} while (0)
104
} while (0)
105
105
106
/*
106
/*
107
 * Compatibility
108
 */
109
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
110
#define STACK _STACK
111
#endif
112
113
/*
107
 * String to HEXString conversion
114
 * String to HEXString conversion
108
 */
115
 */
109
int string2hex(const unsigned char *, int, char **, int *);
116
int string2hex(const unsigned char *, int, char **, int *);
110
-- ruby-1.9.1-p376/ext/openssl/ossl_pkcs7.c
117
++ ruby-1.9.1-p376/ext/openssl/ossl_pkcs7.c
Lines 572-582 Link Here
572
    return self;
572
    return self;
573
}
573
}
574
574
575
static STACK *
575
static STACK_OF(X509) *
576
pkcs7_get_certs_or_crls(VALUE self, int want_certs)
576
pkcs7_get_certs(VALUE self)
577
{
577
{
578
    PKCS7 *pkcs7;
578
    PKCS7 *pkcs7;
579
    STACK_OF(X509) *certs;
579
    STACK_OF(X509) *certs;
580
    int i;
581
582
    GetPKCS7(self, pkcs7);
583
    i = OBJ_obj2nid(pkcs7->type);
584
    switch(i){
585
    case NID_pkcs7_signed:
586
	certs = pkcs7->d.sign->cert;
587
	break;
588
    case NID_pkcs7_signedAndEnveloped:
589
	certs = pkcs7->d.signed_and_enveloped->cert;
590
	break;
591
    default:
592
	certs = NULL;
593
    }
594
595
    return certs;
596
}
597
598
static STACK_OF(X509_CRL) *
599
pkcs7_get_crls(VALUE self)
600
{
601
    PKCS7 *pkcs7;
580
    STACK_OF(X509_CRL) *crls;
602
    STACK_OF(X509_CRL) *crls;
581
    int i;
603
    int i;
582
604
Lines 584-601 Link Here
584
    i = OBJ_obj2nid(pkcs7->type);
606
    i = OBJ_obj2nid(pkcs7->type);
585
    switch(i){
607
    switch(i){
586
    case NID_pkcs7_signed:
608
    case NID_pkcs7_signed:
587
        certs = pkcs7->d.sign->cert;
588
        crls = pkcs7->d.sign->crl;
609
        crls = pkcs7->d.sign->crl;
589
        break;
610
        break;
590
    case NID_pkcs7_signedAndEnveloped:
611
    case NID_pkcs7_signedAndEnveloped:
591
        certs = pkcs7->d.signed_and_enveloped->cert;
592
        crls = pkcs7->d.signed_and_enveloped->crl;
612
        crls = pkcs7->d.signed_and_enveloped->crl;
593
        break;
613
        break;
594
    default:
614
    default:
595
        certs = crls = NULL;
615
        crls = NULL;
596
    }
616
    }
597
617
598
    return want_certs ? certs : crls;
618
    return crls;
599
}
619
}
600
620
601
static VALUE
621
static VALUE
Lines 610-616 Link Here
610
    STACK_OF(X509) *certs;
630
    STACK_OF(X509) *certs;
611
    X509 *cert;
631
    X509 *cert;
612
632
613
    certs = pkcs7_get_certs_or_crls(self, 1);
633
    certs = pkcs7_get_certs(self);
614
    while((cert = sk_X509_pop(certs))) X509_free(cert);
634
    while((cert = sk_X509_pop(certs))) X509_free(cert);
615
    rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_certs_i, self);
635
    rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_certs_i, self);
616
636
Lines 620-626 Link Here
620
static VALUE
640
static VALUE
621
ossl_pkcs7_get_certificates(VALUE self)
641
ossl_pkcs7_get_certificates(VALUE self)
622
{
642
{
623
    return ossl_x509_sk2ary(pkcs7_get_certs_or_crls(self, 1));
643
    return ossl_x509_sk2ary(pkcs7_get_certs(self));
624
}
644
}
625
645
626
static VALUE
646
static VALUE
Lines 650-656 Link Here
650
    STACK_OF(X509_CRL) *crls;
670
    STACK_OF(X509_CRL) *crls;
651
    X509_CRL *crl;
671
    X509_CRL *crl;
652
672
653
    crls = pkcs7_get_certs_or_crls(self, 0);
673
    crls = pkcs7_get_crls(self);
654
    while((crl = sk_X509_CRL_pop(crls))) X509_CRL_free(crl);
674
    while((crl = sk_X509_CRL_pop(crls))) X509_CRL_free(crl);
655
    rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_crls_i, self);
675
    rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_crls_i, self);
656
676
Lines 660-666 Link Here
660
static VALUE
680
static VALUE
661
ossl_pkcs7_get_crls(VALUE self)
681
ossl_pkcs7_get_crls(VALUE self)
662
{
682
{
663
    return ossl_x509crl_sk2ary(pkcs7_get_certs_or_crls(self, 0));
683
    return ossl_x509crl_sk2ary(pkcs7_get_crls(self));
664
}
684
}
665
685
666
static VALUE
686
static VALUE
667
-- ruby-1.9.1-p376/ext/openssl/ossl_ssl.c
687
++ ruby-1.9.1-p376/ext/openssl/ossl_ssl.c
Lines 1195-1204 Link Here
1195
    }
1195
    }
1196
    chain = SSL_get_peer_cert_chain(ssl);
1196
    chain = SSL_get_peer_cert_chain(ssl);
1197
    if(!chain) return Qnil;
1197
    if(!chain) return Qnil;
1198
    num = sk_num(chain);
1198
    num = sk_X509_num(chain);
1199
    ary = rb_ary_new2(num);
1199
    ary = rb_ary_new2(num);
1200
    for (i = 0; i < num; i++){
1200
    for (i = 0; i < num; i++){
1201
	cert = (X509*)sk_value(chain, i);
1201
	cert = sk_X509_value(chain, i);
1202
	rb_ary_push(ary, ossl_x509_new(cert));
1202
	rb_ary_push(ary, ossl_x509_new(cert));
1203
    }
1203
    }
1204
1204
1205
-- ruby-1.9.1-p376/ext/openssl/ossl_ssl_session.c
1205
++ ruby-1.9.1-p376/ext/openssl/ossl_ssl_session.c
Lines 72-77 Link Here
72
	return self;
72
	return self;
73
}
73
}
74
74
75
#if HAVE_SSL_SESSION_CMP == 0
76
int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b)
77
{
78
    if (a->ssl_version != b->ssl_version ||
79
	a->session_id_length != b->session_id_length)
80
	return 1;
81
    return memcmp(a->session_id,b-> session_id, a->session_id_length);
82
}
83
#endif
84
75
/*
85
/*
76
 * call-seq:
86
 * call-seq:
77
 *    session1 == session2 -> boolean
87
 *    session1 == session2 -> boolean
78
-- ruby-1.9.1-p376/ext/openssl/ossl_x509attr.c
88
++ ruby-1.9.1-p376/ext/openssl/ossl_x509attr.c
Lines 218-225 Link Here
218
	ossl_str_adjust(str, p);
218
	ossl_str_adjust(str, p);
219
    }
219
    }
220
    else{
220
    else{
221
	length = i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, NULL,
221
	length = i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set,
222
			i2d_ASN1_TYPE, V_ASN1_SET, V_ASN1_UNIVERSAL, 0);
222
			(unsigned char **) NULL, i2d_ASN1_TYPE,
223
			V_ASN1_SET, V_ASN1_UNIVERSAL, 0);
223
	str = rb_str_new(0, length);
224
	str = rb_str_new(0, length);
224
	p = (unsigned char *)RSTRING_PTR(str);
225
	p = (unsigned char *)RSTRING_PTR(str);
225
	i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, &p,
226
	i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, &p,
226
-- ruby-1.9.1-p376/ext/openssl/ossl_x509crl.c
227
++ ruby-1.9.1-p376/ext/openssl/ossl_x509crl.c
Lines 264-270 Link Here
264
    VALUE ary, revoked;
264
    VALUE ary, revoked;
265
265
266
    GetX509CRL(self, crl);
266
    GetX509CRL(self, crl);
267
    num = sk_X509_CRL_num(X509_CRL_get_REVOKED(crl));
267
    num = sk_X509_REVOKED_num(X509_CRL_get_REVOKED(crl));
268
    if (num < 0) {
268
    if (num < 0) {
269
	OSSL_Debug("num < 0???");
269
	OSSL_Debug("num < 0???");
270
	return rb_ary_new();
270
	return rb_ary_new();
Lines 272-278 Link Here
272
    ary = rb_ary_new2(num);
272
    ary = rb_ary_new2(num);
273
    for(i=0; i<num; i++) {
273
    for(i=0; i<num; i++) {
274
	/* NO DUP - don't free! */
274
	/* NO DUP - don't free! */
275
	rev = (X509_REVOKED *)sk_X509_CRL_value(X509_CRL_get_REVOKED(crl), i);
275
	rev = sk_X509_REVOKED_value(X509_CRL_get_REVOKED(crl), i);
276
	revoked = ossl_x509revoked_new(rev);
276
	revoked = ossl_x509revoked_new(rev);
277
	rb_ary_push(ary, revoked);
277
	rb_ary_push(ary, revoked);
278
    }
278
    }

Return to bug 304427