rev |
line source |
slaxemulator@5479
|
1 diff -Nura ruby-1.9.1-p378.orig/ext/openssl/ossl.c ruby-1.9.1-p378/ext/openssl/ossl.c
|
slaxemulator@5479
|
2 --- ruby-1.9.1-p378.orig/ext/openssl/ossl.c 2009-01-15 16:39:30.000000000 +0100
|
slaxemulator@5479
|
3 +++ ruby-1.9.1-p378/ext/openssl/ossl.c 2010-04-01 07:41:19.397603813 +0200
|
slaxemulator@5479
|
4 @@ -92,7 +92,7 @@
|
slaxemulator@5479
|
5
|
slaxemulator@5479
|
6 #define OSSL_IMPL_SK2ARY(name, type) \
|
slaxemulator@5479
|
7 VALUE \
|
slaxemulator@5479
|
8 -ossl_##name##_sk2ary(STACK *sk) \
|
slaxemulator@5479
|
9 +ossl_##name##_sk2ary(STACK_OF(type) *sk) \
|
slaxemulator@5479
|
10 { \
|
slaxemulator@5479
|
11 type *t; \
|
slaxemulator@5479
|
12 int i, num; \
|
slaxemulator@5479
|
13 @@ -102,7 +102,7 @@
|
slaxemulator@5479
|
14 OSSL_Debug("empty sk!"); \
|
slaxemulator@5479
|
15 return Qnil; \
|
slaxemulator@5479
|
16 } \
|
slaxemulator@5479
|
17 - num = sk_num(sk); \
|
slaxemulator@5479
|
18 + num = sk_##type##_num(sk); \
|
slaxemulator@5479
|
19 if (num < 0) { \
|
slaxemulator@5479
|
20 OSSL_Debug("items in sk < -1???"); \
|
slaxemulator@5479
|
21 return rb_ary_new(); \
|
slaxemulator@5479
|
22 @@ -110,7 +110,7 @@
|
slaxemulator@5479
|
23 ary = rb_ary_new2(num); \
|
slaxemulator@5479
|
24 \
|
slaxemulator@5479
|
25 for (i=0; i<num; i++) { \
|
slaxemulator@5479
|
26 - t = (type *)sk_value(sk, i); \
|
slaxemulator@5479
|
27 + t = sk_##type##_value(sk, i); \
|
slaxemulator@5479
|
28 rb_ary_push(ary, ossl_##name##_new(t)); \
|
slaxemulator@5479
|
29 } \
|
slaxemulator@5479
|
30 return ary; \
|
slaxemulator@5479
|
31 diff -Nura ruby-1.9.1-p378.orig/ext/openssl/ossl_pkcs7.c ruby-1.9.1-p378/ext/openssl/ossl_pkcs7.c
|
slaxemulator@5479
|
32 --- ruby-1.9.1-p378.orig/ext/openssl/ossl_pkcs7.c 2008-07-22 17:34:23.000000000 +0200
|
slaxemulator@5479
|
33 +++ ruby-1.9.1-p378/ext/openssl/ossl_pkcs7.c 2010-04-01 07:41:19.415105324 +0200
|
slaxemulator@5479
|
34 @@ -572,12 +572,11 @@
|
slaxemulator@5479
|
35 return self;
|
slaxemulator@5479
|
36 }
|
slaxemulator@5479
|
37
|
slaxemulator@5479
|
38 -static STACK *
|
slaxemulator@5479
|
39 -pkcs7_get_certs_or_crls(VALUE self, int want_certs)
|
slaxemulator@5479
|
40 +static STACK_OF(X509) *
|
slaxemulator@5479
|
41 +pkcs7_get_certs(VALUE self)
|
slaxemulator@5479
|
42 {
|
slaxemulator@5479
|
43 PKCS7 *pkcs7;
|
slaxemulator@5479
|
44 STACK_OF(X509) *certs;
|
slaxemulator@5479
|
45 - STACK_OF(X509_CRL) *crls;
|
slaxemulator@5479
|
46 int i;
|
slaxemulator@5479
|
47
|
slaxemulator@5479
|
48 GetPKCS7(self, pkcs7);
|
slaxemulator@5479
|
49 @@ -585,17 +584,38 @@
|
slaxemulator@5479
|
50 switch(i){
|
slaxemulator@5479
|
51 case NID_pkcs7_signed:
|
slaxemulator@5479
|
52 certs = pkcs7->d.sign->cert;
|
slaxemulator@5479
|
53 - crls = pkcs7->d.sign->crl;
|
slaxemulator@5479
|
54 break;
|
slaxemulator@5479
|
55 case NID_pkcs7_signedAndEnveloped:
|
slaxemulator@5479
|
56 certs = pkcs7->d.signed_and_enveloped->cert;
|
slaxemulator@5479
|
57 + break;
|
slaxemulator@5479
|
58 + default:
|
slaxemulator@5479
|
59 + certs = NULL;
|
slaxemulator@5479
|
60 + }
|
slaxemulator@5479
|
61 +
|
slaxemulator@5479
|
62 + return certs;
|
slaxemulator@5479
|
63 +}
|
slaxemulator@5479
|
64 +
|
slaxemulator@5479
|
65 +static STACK_OF(X509_CRL) *
|
slaxemulator@5479
|
66 +pkcs7_get_crls(VALUE self)
|
slaxemulator@5479
|
67 +{
|
slaxemulator@5479
|
68 + PKCS7 *pkcs7;
|
slaxemulator@5479
|
69 + STACK_OF(X509_CRL) *crls;
|
slaxemulator@5479
|
70 + int i;
|
slaxemulator@5479
|
71 +
|
slaxemulator@5479
|
72 + GetPKCS7(self, pkcs7);
|
slaxemulator@5479
|
73 + i = OBJ_obj2nid(pkcs7->type);
|
slaxemulator@5479
|
74 + switch(i){
|
slaxemulator@5479
|
75 + case NID_pkcs7_signed:
|
slaxemulator@5479
|
76 + crls = pkcs7->d.sign->crl;
|
slaxemulator@5479
|
77 + break;
|
slaxemulator@5479
|
78 + case NID_pkcs7_signedAndEnveloped:
|
slaxemulator@5479
|
79 crls = pkcs7->d.signed_and_enveloped->crl;
|
slaxemulator@5479
|
80 break;
|
slaxemulator@5479
|
81 default:
|
slaxemulator@5479
|
82 - certs = crls = NULL;
|
slaxemulator@5479
|
83 + crls = NULL;
|
slaxemulator@5479
|
84 }
|
slaxemulator@5479
|
85
|
slaxemulator@5479
|
86 - return want_certs ? certs : crls;
|
slaxemulator@5479
|
87 + return crls;
|
slaxemulator@5479
|
88 }
|
slaxemulator@5479
|
89
|
slaxemulator@5479
|
90 static VALUE
|
slaxemulator@5479
|
91 @@ -610,7 +630,7 @@
|
slaxemulator@5479
|
92 STACK_OF(X509) *certs;
|
slaxemulator@5479
|
93 X509 *cert;
|
slaxemulator@5479
|
94
|
slaxemulator@5479
|
95 - certs = pkcs7_get_certs_or_crls(self, 1);
|
slaxemulator@5479
|
96 + certs = pkcs7_get_certs(self);
|
slaxemulator@5479
|
97 while((cert = sk_X509_pop(certs))) X509_free(cert);
|
slaxemulator@5479
|
98 rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_certs_i, self);
|
slaxemulator@5479
|
99
|
slaxemulator@5479
|
100 @@ -620,7 +640,7 @@
|
slaxemulator@5479
|
101 static VALUE
|
slaxemulator@5479
|
102 ossl_pkcs7_get_certificates(VALUE self)
|
slaxemulator@5479
|
103 {
|
slaxemulator@5479
|
104 - return ossl_x509_sk2ary(pkcs7_get_certs_or_crls(self, 1));
|
slaxemulator@5479
|
105 + return ossl_x509_sk2ary(pkcs7_get_certs(self));
|
slaxemulator@5479
|
106 }
|
slaxemulator@5479
|
107
|
slaxemulator@5479
|
108 static VALUE
|
slaxemulator@5479
|
109 @@ -650,7 +670,7 @@
|
slaxemulator@5479
|
110 STACK_OF(X509_CRL) *crls;
|
slaxemulator@5479
|
111 X509_CRL *crl;
|
slaxemulator@5479
|
112
|
slaxemulator@5479
|
113 - crls = pkcs7_get_certs_or_crls(self, 0);
|
slaxemulator@5479
|
114 + crls = pkcs7_get_crls(self);
|
slaxemulator@5479
|
115 while((crl = sk_X509_CRL_pop(crls))) X509_CRL_free(crl);
|
slaxemulator@5479
|
116 rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_crls_i, self);
|
slaxemulator@5479
|
117
|
slaxemulator@5479
|
118 @@ -660,7 +680,7 @@
|
slaxemulator@5479
|
119 static VALUE
|
slaxemulator@5479
|
120 ossl_pkcs7_get_crls(VALUE self)
|
slaxemulator@5479
|
121 {
|
slaxemulator@5479
|
122 - return ossl_x509crl_sk2ary(pkcs7_get_certs_or_crls(self, 0));
|
slaxemulator@5479
|
123 + return ossl_x509crl_sk2ary(pkcs7_get_crls(self));
|
slaxemulator@5479
|
124 }
|
slaxemulator@5479
|
125
|
slaxemulator@5479
|
126 static VALUE
|
slaxemulator@5479
|
127 diff -Nura ruby-1.9.1-p378.orig/ext/openssl/ossl_ssl.c ruby-1.9.1-p378/ext/openssl/ossl_ssl.c
|
slaxemulator@5479
|
128 --- ruby-1.9.1-p378.orig/ext/openssl/ossl_ssl.c 2009-04-19 15:32:18.000000000 +0200
|
slaxemulator@5479
|
129 +++ ruby-1.9.1-p378/ext/openssl/ossl_ssl.c 2010-04-01 07:41:19.450937427 +0200
|
slaxemulator@5479
|
130 @@ -88,12 +88,18 @@
|
slaxemulator@5479
|
131
|
slaxemulator@5479
|
132 ID ID_callback_state;
|
slaxemulator@5479
|
133
|
slaxemulator@5479
|
134 +#if OPENSSL_VERSION_NUMBER >= 0x10000000L
|
slaxemulator@5479
|
135 +#define OSSL_MORE_CONST const
|
slaxemulator@5479
|
136 +#define STACK _STACK
|
slaxemulator@5479
|
137 +#else
|
slaxemulator@5479
|
138 +#define OSSL_MORE_CONST
|
slaxemulator@5479
|
139 +#endif
|
slaxemulator@5479
|
140 /*
|
slaxemulator@5479
|
141 * SSLContext class
|
slaxemulator@5479
|
142 */
|
slaxemulator@5479
|
143 struct {
|
slaxemulator@5479
|
144 const char *name;
|
slaxemulator@5479
|
145 - SSL_METHOD *(*func)(void);
|
slaxemulator@5479
|
146 + OSSL_MORE_CONST SSL_METHOD *(*func)(void);
|
slaxemulator@5479
|
147 } ossl_ssl_method_tab[] = {
|
slaxemulator@5479
|
148 #define OSSL_SSL_METHOD_ENTRY(name) { #name, name##_method }
|
slaxemulator@5479
|
149 OSSL_SSL_METHOD_ENTRY(TLSv1),
|
slaxemulator@5479
|
150 @@ -142,7 +148,7 @@
|
slaxemulator@5479
|
151 static VALUE
|
slaxemulator@5479
|
152 ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method)
|
slaxemulator@5479
|
153 {
|
slaxemulator@5479
|
154 - SSL_METHOD *method = NULL;
|
slaxemulator@5479
|
155 + OSSL_MORE_CONST SSL_METHOD *method = NULL;
|
slaxemulator@5479
|
156 const char *s;
|
slaxemulator@5479
|
157 int i;
|
slaxemulator@5479
|
158
|
slaxemulator@5479
|
159 @@ -585,7 +591,7 @@
|
slaxemulator@5479
|
160 }
|
slaxemulator@5479
|
161
|
slaxemulator@5479
|
162 static VALUE
|
slaxemulator@5479
|
163 -ossl_ssl_cipher_to_ary(SSL_CIPHER *cipher)
|
slaxemulator@5479
|
164 +ossl_ssl_cipher_to_ary(OSSL_MORE_CONST SSL_CIPHER *cipher)
|
slaxemulator@5479
|
165 {
|
slaxemulator@5479
|
166 VALUE ary;
|
slaxemulator@5479
|
167 int bits, alg_bits;
|
slaxemulator@5479
|
168 @@ -1213,7 +1219,7 @@
|
slaxemulator@5479
|
169 ossl_ssl_get_cipher(VALUE self)
|
slaxemulator@5479
|
170 {
|
slaxemulator@5479
|
171 SSL *ssl;
|
slaxemulator@5479
|
172 - SSL_CIPHER *cipher;
|
slaxemulator@5479
|
173 + OSSL_MORE_CONST SSL_CIPHER *cipher;
|
slaxemulator@5479
|
174
|
slaxemulator@5479
|
175 Data_Get_Struct(self, SSL, ssl);
|
slaxemulator@5479
|
176 if (!ssl) {
|