/[gentoo-x86]/dev-lang/ruby/files/ruby-1.8.6-openssl.patch
Gentoo

Contents of /dev-lang/ruby/files/ruby-1.8.6-openssl.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sun Jan 11 18:21:40 2009 UTC (8 years, 5 months ago) by graaff
Branch: MAIN
Backport fixes from ruby 1.8.7 to fix compilation with newer openssl versions, fixes #254307
(Portage version: 2.1.6.4/cvs/Linux 2.6.27-gentoo-r7 x86_64)

1 This patch backports changes from ruby 1.8.7 which only includes the
2 openssl prototypes for functions that are not in the system openssl
3 library. This fixes #254307 and protects against similar issues with
4 future openssl versions.
5
6 diff -u ruby-1.8.6_p287-r10/work/ruby-1.8.6-p287/ext/openssl/extconf.rb ruby-1.8.7_p72-r1/work/ruby-1.8.7-p72/ext/openssl/extconf.rb
7 --- ruby-1.8.6_p287-r10/work/ruby-1.8.6-p287/ext/openssl/openssl_missing.c 2007-02-13 00:01:19.000000000 +0100
8 +++ ruby-1.8.7_p72-r1/work/ruby-1.8.7-p72/ext/openssl/openssl_missing.c 2008-05-19 05:00:52.000000000 +0200
9 @@ -22,17 +22,15 @@
10 #include "openssl_missing.h"
11
12 #if !defined(HAVE_HMAC_CTX_COPY)
13 -int
14 +void
15 HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in)
16 {
17 - if (!out || !in) return 0;
18 + if (!out || !in) return;
19 memcpy(out, in, sizeof(HMAC_CTX));
20
21 - if (!EVP_MD_CTX_copy(&out->md_ctx, &in->md_ctx)
22 - || !EVP_MD_CTX_copy(&out->i_ctx, &in->i_ctx)
23 - || !EVP_MD_CTX_copy(&out->o_ctx, &in->o_ctx))
24 - return 0;
25 - return 1;
26 + EVP_MD_CTX_copy(&out->md_ctx, &in->md_ctx);
27 + EVP_MD_CTX_copy(&out->i_ctx, &in->i_ctx);
28 + EVP_MD_CTX_copy(&out->o_ctx, &in->o_ctx);
29 }
30 #endif /* HAVE_HMAC_CTX_COPY */
31 #endif /* NO_HMAC */
32 diff -u ruby-1.8.6_p287-r10/work/ruby-1.8.6-p287/ext/openssl/openssl_missing.h ruby-1.8.7_p72-r1/work/ruby-1.8.7-p72/ext/openssl/openssl_missing.h
33 --- ruby-1.8.6_p287-r10/work/ruby-1.8.6-p287/ext/openssl/openssl_missing.h 2008-08-04 06:43:34.000000000 +0200
34 +++ ruby-1.8.7_p72-r1/work/ruby-1.8.7-p72/ext/openssl/openssl_missing.h 2008-08-04 06:44:17.000000000 +0200
35 @@ -60,14 +60,33 @@
36 (char *(*)())d2i_PKCS7_RECIP_INFO, (char *)ri)
37 #endif
38
39 +#if !defined(HAVE_EVP_MD_CTX_INIT)
40 void HMAC_CTX_init(HMAC_CTX *ctx);
41 -int HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
42 +#endif
43 +
44 +#if !defined(HAVE_HMAC_CTX_COPY)
45 +void HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
46 +#endif
47 +
48 +#if !defined(HAVE_HMAC_CTX_CLEANUP)
49 void HMAC_CTX_cleanup(HMAC_CTX *ctx);
50 +#endif
51
52 +#if !defined(HAVE_EVP_MD_CTX_CREATE)
53 EVP_MD_CTX *EVP_MD_CTX_create(void);
54 +#endif
55 +
56 +#if !defined(HAVE_EVP_MD_CTX_INIT)
57 void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
58 +#endif
59 +
60 +#if !defined(HAVE_EVP_MD_CTX_CLEANUP)
61 int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
62 +#endif
63 +
64 +#if !defined(HAVE_EVP_MD_CTX_DESTROY)
65 void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
66 +#endif
67
68 #if !defined(HAVE_EVP_CIPHER_CTX_COPY)
69 int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in);
70 @@ -111,19 +130,54 @@
71 #define OPENSSL_cleanse(p, l) memset(p, 0, l)
72 #endif
73
74 +#if !defined(HAVE_X509_STORE_SET_EX_DATA)
75 void *X509_STORE_get_ex_data(X509_STORE *str, int idx);
76 int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data);
77 +#endif
78 +
79 +#if !defined(HAVE_X509_CRL_SET_VERSION)
80 int X509_CRL_set_version(X509_CRL *x, long version);
81 +#endif
82 +
83 +#if !defined(HAVE_X509_CRL_SET_ISSUER_NAME)
84 int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
85 +#endif
86 +
87 +#if !defined(HAVE_X509_CRL_SORT)
88 int X509_CRL_sort(X509_CRL *c);
89 +#endif
90 +
91 +#if !defined(HAVE_X509_CRL_ADD0_REVOKED)
92 int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
93 +#endif
94 +
95 +#if !defined(HAVE_BN_MOD_SQR)
96 int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
97 +#endif
98 +
99 +#if !defined(HAVE_BN_MOD_ADD)
100 int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
101 +#endif
102 +
103 +#if !defined(HAVE_BN_MOD_SUB)
104 int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
105 +#endif
106 +
107 +#if !defined(HAVE_BN_RAND_RANGE)
108 int BN_rand_range(BIGNUM *r, BIGNUM *range);
109 +#endif
110 +
111 +#if !defined(HAVE_BN_PSEUDO_RAND_RANGE)
112 int BN_pseudo_rand_range(BIGNUM *r, BIGNUM *range);
113 +#endif
114 +
115 +#if !defined(HAVE_CONF_GET1_DEFAULT_CONFIG_FILE)
116 char *CONF_get1_default_config_file(void);
117 +#endif
118 +
119 +#if !defined(HAVE_PEM_DEF_CALLBACK)
120 int PEM_def_callback(char *buf, int num, int w, void *key);
121 +#endif
122
123 #if defined(__cplusplus)
124 }
125 diff -u ruby-1.8.6_p287-r10/work/ruby-1.8.6-p287/ext/openssl/ossl_hmac.c ruby-1.8.7_p72-r1/work/ruby-1.8.7-p72/ext/openssl/ossl_hmac.c
126 --- ruby-1.8.6_p287-r10/work/ruby-1.8.6-p287/ext/openssl/ossl_hmac.c 2007-03-12 05:12:32.000000000 +0100
127 +++ ruby-1.8.7_p72-r1/work/ruby-1.8.7-p72/ext/openssl/ossl_hmac.c 2008-05-19 05:00:52.000000000 +0200
128 @@ -81,12 +87,15 @@
129 GetHMAC(self, ctx1);
130 SafeGetHMAC(other, ctx2);
131
132 - if (!HMAC_CTX_copy(ctx1, ctx2)) {
133 - ossl_raise(eHMACError, NULL);
134 - }
135 + HMAC_CTX_copy(ctx1, ctx2);
136 return self;
137 }
138
139 +/*
140 + * call-seq:
141 + * hmac.update(string) -> self
142 + *
143 + */
144 static VALUE
145 ossl_hmac_update(VALUE self, VALUE data)
146 {
147 @@ -104,9 +113,7 @@
148 {
149 HMAC_CTX final;
150
151 - if (!HMAC_CTX_copy(&final, ctx)) {
152 - ossl_raise(eHMACError, NULL);
153 - }
154 + HMAC_CTX_copy(&final, ctx);
155 if (!(*buf = OPENSSL_malloc(HMAC_size(&final)))) {
156 HMAC_CTX_cleanup(&final);
157 OSSL_Debug("Allocating %d mem", HMAC_size(&final));

  ViewVC Help
Powered by ViewVC 1.1.20