Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

ruby-1.8.4 suppport

  • Loading branch information...
commit 48d2b405bd380affa3efb21cb9c3a42f3180ddb4 1 parent 5282c23
@mpapis mpapis authored
View
334 patches/ruby/1.8.4/backported-ossl-fixes.diff
@@ -0,0 +1,334 @@
+diff -r -u ruby-1.8.5-p231/ext/openssl/extconf.rb ruby-1.8.5-p231-fixed/ext/openssl/extconf.rb
+--- ruby-1.8.5-p231/ext/openssl/extconf.rb 2007-02-13 08:01:19.000000000 +0900
++++ ruby-1.8.5-p231-fixed/ext/openssl/extconf.rb 2010-07-13 02:18:18.000000000 +0800
+@@ -36,8 +36,6 @@
+ message "=== Checking for system dependent stuff... ===\n"
+ have_library("nsl", "t_open")
+ have_library("socket", "socket")
+-have_header("unistd.h")
+-have_header("sys/time.h")
+ have_header("assert.h")
+
+ message "=== Checking for required stuff... ===\n"
+@@ -61,6 +59,8 @@
+ exit 1
+ end
+
++%w"rb_str_set_len rb_block_call".each {|func| have_func(func, "ruby.h")}
++
+ message "=== Checking for OpenSSL features... ===\n"
+ have_func("ERR_peek_last_error")
+ have_func("BN_mod_add")
+@@ -83,6 +83,8 @@
+ have_func("HMAC_CTX_copy")
+ have_func("HMAC_CTX_init")
+ have_func("PEM_def_callback")
++have_func("PKCS5_PBKDF2_HMAC")
++have_func("PKCS5_PBKDF2_HMAC_SHA1")
+ have_func("X509V3_set_nconf")
+ have_func("X509V3_EXT_nconf_nid")
+ have_func("X509_CRL_add0_revoked")
+@@ -92,6 +94,7 @@
+ have_func("X509_STORE_get_ex_data")
+ have_func("X509_STORE_set_ex_data")
+ have_func("OBJ_NAME_do_all_sorted")
++have_func("SSL_SESSION_get_id")
+ have_func("OPENSSL_cleanse")
+ if try_compile("#define FOO(a, ...) foo(a, ##__VA_ARGS__)\n int x(){FOO(1);FOO(1,2);FOO(1,2,3);}\n")
+ $defs.push("-DHAVE_VA_ARGS_MACRO")
+diff -r -u ruby-1.8.5-p231/ext/openssl/openssl_missing.c ruby-1.8.5-p231-fixed/ext/openssl/openssl_missing.c
+--- ruby-1.8.5-p231/ext/openssl/openssl_missing.c 2007-02-13 08:01:19.000000000 +0900
++++ ruby-1.8.5-p231-fixed/ext/openssl/openssl_missing.c 2010-07-13 02:22:10.000000000 +0800
+@@ -22,17 +22,15 @@
+ #include "openssl_missing.h"
+
+ #if !defined(HAVE_HMAC_CTX_COPY)
+-int
++void
+ HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in)
+ {
+- if (!out || !in) return 0;
++ if (!out || !in) return;
+ memcpy(out, in, sizeof(HMAC_CTX));
+
+- if (!EVP_MD_CTX_copy(&out->md_ctx, &in->md_ctx)
+- || !EVP_MD_CTX_copy(&out->i_ctx, &in->i_ctx)
+- || !EVP_MD_CTX_copy(&out->o_ctx, &in->o_ctx))
+- return 0;
+- return 1;
++ EVP_MD_CTX_copy(&out->md_ctx, &in->md_ctx);
++ EVP_MD_CTX_copy(&out->i_ctx, &in->i_ctx);
++ EVP_MD_CTX_copy(&out->o_ctx, &in->o_ctx);
+ }
+ #endif /* HAVE_HMAC_CTX_COPY */
+ #endif /* NO_HMAC */
+diff -r -u ruby-1.8.5-p231/ext/openssl/openssl_missing.h ruby-1.8.5-p231-fixed/ext/openssl/openssl_missing.h
+--- ruby-1.8.5-p231/ext/openssl/openssl_missing.h 2007-02-13 08:01:19.000000000 +0900
++++ ruby-1.8.5-p231-fixed/ext/openssl/openssl_missing.h 2010-07-13 02:22:10.000000000 +0800
+@@ -15,6 +15,10 @@
+ extern "C" {
+ #endif
+
++#ifndef TYPEDEF_D2I_OF
++typedef char *d2i_of_void();
++#endif
++
+ /*
+ * These functions are not included in headers of OPENSSL <= 0.9.6b
+ */
+@@ -56,14 +60,33 @@
+ (char *(*)())d2i_PKCS7_RECIP_INFO, (char *)ri)
+ #endif
+
++#if !defined(HAVE_EVP_MD_CTX_INIT)
+ void HMAC_CTX_init(HMAC_CTX *ctx);
+-int HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
++#endif
++
++#if !defined(HAVE_HMAC_CTX_COPY)
++void HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *in);
++#endif
++
++#if !defined(HAVE_HMAC_CTX_CLEANUP)
+ void HMAC_CTX_cleanup(HMAC_CTX *ctx);
++#endif
+
++#if !defined(HAVE_EVP_MD_CTX_CREATE)
+ EVP_MD_CTX *EVP_MD_CTX_create(void);
++#endif
++
++#if !defined(HAVE_EVP_MD_CTX_INIT)
+ void EVP_MD_CTX_init(EVP_MD_CTX *ctx);
++#endif
++
++#if !defined(HAVE_EVP_MD_CTX_CLEANUP)
+ int EVP_MD_CTX_cleanup(EVP_MD_CTX *ctx);
++#endif
++
++#if !defined(HAVE_EVP_MD_CTX_DESTROY)
+ void EVP_MD_CTX_destroy(EVP_MD_CTX *ctx);
++#endif
+
+ #if !defined(HAVE_EVP_CIPHER_CTX_COPY)
+ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX *out, EVP_CIPHER_CTX *in);
+@@ -107,19 +130,54 @@
+ #define OPENSSL_cleanse(p, l) memset(p, 0, l)
+ #endif
+
++#if !defined(HAVE_X509_STORE_SET_EX_DATA)
+ void *X509_STORE_get_ex_data(X509_STORE *str, int idx);
+ int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data);
++#endif
++
++#if !defined(HAVE_X509_CRL_SET_VERSION)
+ int X509_CRL_set_version(X509_CRL *x, long version);
++#endif
++
++#if !defined(HAVE_X509_CRL_SET_ISSUER_NAME)
+ int X509_CRL_set_issuer_name(X509_CRL *x, X509_NAME *name);
++#endif
++
++#if !defined(HAVE_X509_CRL_SORT)
+ int X509_CRL_sort(X509_CRL *c);
++#endif
++
++#if !defined(HAVE_X509_CRL_ADD0_REVOKED)
+ int X509_CRL_add0_revoked(X509_CRL *crl, X509_REVOKED *rev);
++#endif
++
++#if !defined(HAVE_BN_MOD_SQR)
+ int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx);
++#endif
++
++#if !defined(HAVE_BN_MOD_ADD)
+ int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
++#endif
++
++#if !defined(HAVE_BN_MOD_SUB)
+ int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, BN_CTX *ctx);
++#endif
++
++#if !defined(HAVE_BN_RAND_RANGE)
+ int BN_rand_range(BIGNUM *r, BIGNUM *range);
++#endif
++
++#if !defined(HAVE_BN_PSEUDO_RAND_RANGE)
+ int BN_pseudo_rand_range(BIGNUM *r, BIGNUM *range);
++#endif
++
++#if !defined(HAVE_CONF_GET1_DEFAULT_CONFIG_FILE)
+ char *CONF_get1_default_config_file(void);
++#endif
++
++#if !defined(HAVE_PEM_DEF_CALLBACK)
+ int PEM_def_callback(char *buf, int num, int w, void *key);
++#endif
+
+ #if defined(__cplusplus)
+ }
+diff -r -u ruby-1.8.5-p231/ext/openssl/ossl_hmac.c ruby-1.8.5-p231-fixed/ext/openssl/ossl_hmac.c
+--- ruby-1.8.5-p231/ext/openssl/ossl_hmac.c 2007-02-13 08:01:19.000000000 +0900
++++ ruby-1.8.5-p231-fixed/ext/openssl/ossl_hmac.c 2010-07-13 02:18:36.000000000 +0800
+@@ -57,6 +57,12 @@
+ return obj;
+ }
+
++
++/*
++ * call-seq:
++ * HMAC.new(key, digest) -> hmac
++ *
++ */
+ static VALUE
+ ossl_hmac_initialize(VALUE self, VALUE key, VALUE digest)
+ {
+@@ -64,7 +70,7 @@
+
+ StringValue(key);
+ GetHMAC(self, ctx);
+- HMAC_Init_ex(ctx, RSTRING(key)->ptr, RSTRING(key)->len,
++ HMAC_Init_ex(ctx, RSTRING_PTR(key), RSTRING_LEN(key),
+ GetDigestPtr(digest), NULL);
+
+ return self;
+@@ -81,12 +87,15 @@
+ GetHMAC(self, ctx1);
+ SafeGetHMAC(other, ctx2);
+
+- if (!HMAC_CTX_copy(ctx1, ctx2)) {
+- ossl_raise(eHMACError, NULL);
+- }
++ HMAC_CTX_copy(ctx1, ctx2);
+ return self;
+ }
+
++/*
++ * call-seq:
++ * hmac.update(string) -> self
++ *
++ */
+ static VALUE
+ ossl_hmac_update(VALUE self, VALUE data)
+ {
+@@ -94,7 +103,7 @@
+
+ StringValue(data);
+ GetHMAC(self, ctx);
+- HMAC_Update(ctx, RSTRING(data)->ptr, RSTRING(data)->len);
++ HMAC_Update(ctx, RSTRING_PTR(data), RSTRING_LEN(data));
+
+ return self;
+ }
+@@ -104,9 +113,7 @@
+ {
+ HMAC_CTX final;
+
+- if (!HMAC_CTX_copy(&final, ctx)) {
+- ossl_raise(eHMACError, NULL);
+- }
++ HMAC_CTX_copy(&final, ctx);
+ if (!(*buf = OPENSSL_malloc(HMAC_size(&final)))) {
+ HMAC_CTX_cleanup(&final);
+ OSSL_Debug("Allocating %d mem", HMAC_size(&final));
+@@ -116,6 +123,11 @@
+ HMAC_CTX_cleanup(&final);
+ }
+
++/*
++ * call-seq:
++ * hmac.digest -> aString
++ *
++ */
+ static VALUE
+ ossl_hmac_digest(VALUE self)
+ {
+@@ -131,6 +143,11 @@
+ return digest;
+ }
+
++/*
++ * call-seq:
++ * hmac.hexdigest -> aString
++ *
++ */
+ static VALUE
+ ossl_hmac_hexdigest(VALUE self)
+ {
+@@ -151,6 +168,27 @@
+ return hexdigest;
+ }
+
++/*
++ * call-seq:
++ * hmac.reset -> self
++ *
++ */
++static VALUE
++ossl_hmac_reset(VALUE self)
++{
++ HMAC_CTX *ctx;
++
++ GetHMAC(self, ctx);
++ HMAC_Init_ex(ctx, NULL, 0, NULL, NULL);
++
++ return self;
++}
++
++/*
++ * call-seq:
++ * HMAC.digest(digest, key, data) -> aString
++ *
++ */
+ static VALUE
+ ossl_hmac_s_digest(VALUE klass, VALUE digest, VALUE key, VALUE data)
+ {
+@@ -159,12 +197,17 @@
+
+ StringValue(key);
+ StringValue(data);
+- buf = HMAC(GetDigestPtr(digest), RSTRING(key)->ptr, RSTRING(key)->len,
+- RSTRING(data)->ptr, RSTRING(data)->len, NULL, &buf_len);
++ buf = HMAC(GetDigestPtr(digest), RSTRING_PTR(key), RSTRING_LEN(key),
++ RSTRING_PTR(data), RSTRING_LEN(data), NULL, &buf_len);
+
+ return rb_str_new(buf, buf_len);
+ }
+
++/*
++ * call-seq:
++ * HMAC.digest(digest, key, data) -> aString
++ *
++ */
+ static VALUE
+ ossl_hmac_s_hexdigest(VALUE klass, VALUE digest, VALUE key, VALUE data)
+ {
+@@ -175,8 +218,8 @@
+ StringValue(key);
+ StringValue(data);
+
+- buf = HMAC(GetDigestPtr(digest), RSTRING(key)->ptr, RSTRING(key)->len,
+- RSTRING(data)->ptr, RSTRING(data)->len, NULL, &buf_len);
++ buf = HMAC(GetDigestPtr(digest), RSTRING_PTR(key), RSTRING_LEN(key),
++ RSTRING_PTR(data), RSTRING_LEN(data), NULL, &buf_len);
+ if (string2hex(buf, buf_len, &hexbuf, NULL) != 2 * buf_len) {
+ ossl_raise(eHMACError, "Cannot convert buf to hexbuf");
+ }
+@@ -191,6 +234,10 @@
+ void
+ Init_ossl_hmac()
+ {
++#if 0 /* let rdoc know about mOSSL */
++ mOSSL = rb_define_module("OpenSSL");
++#endif
++
+ eHMACError = rb_define_class_under(mOSSL, "HMACError", eOSSLError);
+
+ cHMAC = rb_define_class_under(mOSSL, "HMAC", rb_cObject);
+@@ -202,6 +249,7 @@
+ rb_define_method(cHMAC, "initialize", ossl_hmac_initialize, 2);
+ rb_define_copy_func(cHMAC, ossl_hmac_copy);
+
++ rb_define_method(cHMAC, "reset", ossl_hmac_reset, 0);
+ rb_define_method(cHMAC, "update", ossl_hmac_update, 1);
+ rb_define_alias(cHMAC, "<<", "update");
+ rb_define_method(cHMAC, "digest", ossl_hmac_digest, 0);
View
17 patches/ruby/1.8.4/no_sslv2.diff
@@ -0,0 +1,17 @@
+Index: ossl_ssl.c
+===================================================================
+--- a/ext/openssl/ossl_ssl.c (revision 32381)
++++ b/ext/openssl/ossl_ssl.c (revision 32382)
+@@ -107,9 +107,12 @@
+ OSSL_SSL_METHOD_ENTRY(TLSv1),
+ OSSL_SSL_METHOD_ENTRY(TLSv1_server),
+ OSSL_SSL_METHOD_ENTRY(TLSv1_client),
++#if defined(HAVE_SSLV2_METHOD) && defined(HAVE_SSLV2_SERVER_METHOD) && \
++ defined(HAVE_SSLV2_CLIENT_METHOD)
+ OSSL_SSL_METHOD_ENTRY(SSLv2),
+ OSSL_SSL_METHOD_ENTRY(SSLv2_server),
+ OSSL_SSL_METHOD_ENTRY(SSLv2_client),
++#endif
+ OSSL_SSL_METHOD_ENTRY(SSLv3),
+ OSSL_SSL_METHOD_ENTRY(SSLv3_server),
+ OSSL_SSL_METHOD_ENTRY(SSLv3_client),
View
232 patches/ruby/1.8.4/openssl-1.0.patch
@@ -0,0 +1,232 @@
+From 46b84175dfac14a92fd6bcf3b03bc3c3715ab6cb Mon Sep 17 00:00:00 2001
+From: nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>
+Date: Sat, 6 Mar 2010 21:47:30 +0000
+Subject: [PATCH] backport the commit from trunk:
+ Sun Feb 28 11:49:35 2010 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * openssl/ossl.c (OSSL_IMPL_SK2ARY): for OpenSSL 1.0.
+ patched by Jeroen van Meeuwen at [ruby-core:25210]
+ fixed by Nobuyoshi Nakada [ruby-core:25238],
+ Hongli Lai [ruby-core:27417],
+ and Motohiro KOSAKI [ruby-core:28063]
+
+ * ext/openssl/ossl_ssl.c (ossl_ssl_method_tab),
+ (ossl_ssl_cipher_to_ary): constified.
+
+ * ext/openssl/ossl_pkcs7.c (pkcs7_get_certs, pkcs7_get_crls):
+ split pkcs7_get_certs_or_crls.
+
+
+git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@26838 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
+---
+ ext/openssl/ossl.c | 6 +++---
+ ext/openssl/ossl.h | 7 +++++++
+ ext/openssl/ossl_pkcs7.c | 40 ++++++++++++++++++++++++++++++----------
+ ext/openssl/ossl_ssl.c | 4 ++--
+ ext/openssl/ossl_x509attr.c | 5 +++--
+ ext/openssl/ossl_x509crl.c | 4 ++--
+ 6 files changed, 47 insertions(+), 19 deletions(-)
+
+diff --git a/ext/openssl/ossl.c b/ext/openssl/ossl.c
+index d4a2dc1..85ba654 100644
+--- a/ext/openssl/ossl.c
++++ b/ext/openssl/ossl.c
+@@ -92,7 +92,7 @@ ossl_x509_ary2sk(VALUE ary)
+
+ #define OSSL_IMPL_SK2ARY(name, type) \
+ VALUE \
+-ossl_##name##_sk2ary(STACK *sk) \
++ossl_##name##_sk2ary(STACK_OF(type) *sk) \
+ { \
+ type *t; \
+ int i, num; \
+@@ -102,7 +102,7 @@ ossl_##name##_sk2ary(STACK *sk) \
+ OSSL_Debug("empty sk!"); \
+ return Qnil; \
+ } \
+- num = sk_num(sk); \
++ num = sk_##type##_num(sk); \
+ if (num < 0) { \
+ OSSL_Debug("items in sk < -1???"); \
+ return rb_ary_new(); \
+@@ -110,7 +110,7 @@ ossl_##name##_sk2ary(STACK *sk) \
+ ary = rb_ary_new2(num); \
+ \
+ for (i=0; i<num; i++) { \
+- t = (type *)sk_value(sk, i); \
++ t = sk_##type##_value(sk, i); \
+ rb_ary_push(ary, ossl_##name##_new(t)); \
+ } \
+ return ary; \
+diff --git a/ext/openssl/ossl.h b/ext/openssl/ossl.h
+index 9215dc4..d0edb7d 100644
+--- a/ext/openssl/ossl.h
++++ b/ext/openssl/ossl.h
+@@ -108,6 +108,13 @@ extern VALUE eOSSLError;
+ } while (0)
+
+ /*
++ * Compatibility
++ */
++#if OPENSSL_VERSION_NUMBER >= 0x10000000L
++#define STACK _STACK
++#endif
++
++/*
+ * String to HEXString conversion
+ */
+ int string2hex(const unsigned char *, int, char **, int *);
+diff --git a/ext/openssl/ossl_pkcs7.c b/ext/openssl/ossl_pkcs7.c
+index fe1ef7c..b0cc656 100644
+--- a/ext/openssl/ossl_pkcs7.c
++++ b/ext/openssl/ossl_pkcs7.c
+@@ -572,12 +572,11 @@ ossl_pkcs7_add_certificate(VALUE self, VALUE cert)
+ return self;
+ }
+
+-static STACK *
+-pkcs7_get_certs_or_crls(VALUE self, int want_certs)
++static STACK_OF(X509) *
++pkcs7_get_certs(VALUE self)
+ {
+ PKCS7 *pkcs7;
+ STACK_OF(X509) *certs;
+- STACK_OF(X509_CRL) *crls;
+ int i;
+
+ GetPKCS7(self, pkcs7);
+@@ -585,17 +584,38 @@ pkcs7_get_certs_or_crls(VALUE self, int want_certs)
+ switch(i){
+ case NID_pkcs7_signed:
+ certs = pkcs7->d.sign->cert;
+- crls = pkcs7->d.sign->crl;
+ break;
+ case NID_pkcs7_signedAndEnveloped:
+ certs = pkcs7->d.signed_and_enveloped->cert;
++ break;
++ default:
++ certs = NULL;
++ }
++
++ return certs;
++}
++
++static STACK_OF(X509_CRL) *
++pkcs7_get_crls(VALUE self)
++{
++ PKCS7 *pkcs7;
++ STACK_OF(X509_CRL) *crls;
++ int i;
++
++ GetPKCS7(self, pkcs7);
++ i = OBJ_obj2nid(pkcs7->type);
++ switch(i){
++ case NID_pkcs7_signed:
++ crls = pkcs7->d.sign->crl;
++ break;
++ case NID_pkcs7_signedAndEnveloped:
+ crls = pkcs7->d.signed_and_enveloped->crl;
+ break;
+ default:
+- certs = crls = NULL;
++ crls = NULL;
+ }
+
+- return want_certs ? certs : crls;
++ return crls;
+ }
+
+ static VALUE
+@@ -610,7 +630,7 @@ ossl_pkcs7_set_certificates(VALUE self, VALUE ary)
+ STACK_OF(X509) *certs;
+ X509 *cert;
+
+- certs = pkcs7_get_certs_or_crls(self, 1);
++ certs = pkcs7_get_certs(self);
+ while((cert = sk_X509_pop(certs))) X509_free(cert);
+ rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_certs_i, self);
+
+@@ -620,7 +640,7 @@ ossl_pkcs7_set_certificates(VALUE self, VALUE ary)
+ static VALUE
+ ossl_pkcs7_get_certificates(VALUE self)
+ {
+- return ossl_x509_sk2ary(pkcs7_get_certs_or_crls(self, 1));
++ return ossl_x509_sk2ary(pkcs7_get_certs(self));
+ }
+
+ static VALUE
+@@ -650,7 +670,7 @@ ossl_pkcs7_set_crls(VALUE self, VALUE ary)
+ STACK_OF(X509_CRL) *crls;
+ X509_CRL *crl;
+
+- crls = pkcs7_get_certs_or_crls(self, 0);
++ crls = pkcs7_get_crls(self);
+ while((crl = sk_X509_CRL_pop(crls))) X509_CRL_free(crl);
+ rb_block_call(ary, rb_intern("each"), 0, 0, ossl_pkcs7_set_crls_i, self);
+
+@@ -660,7 +680,7 @@ ossl_pkcs7_set_crls(VALUE self, VALUE ary)
+ static VALUE
+ ossl_pkcs7_get_crls(VALUE self)
+ {
+- return ossl_x509crl_sk2ary(pkcs7_get_certs_or_crls(self, 0));
++ return ossl_x509crl_sk2ary(pkcs7_get_crls(self));
+ }
+
+ static VALUE
+diff --git a/ext/openssl/ossl_ssl.c b/ext/openssl/ossl_ssl.c
+index 432ca21..facf6ca 100644
+--- a/ext/openssl/ossl_ssl.c
++++ b/ext/openssl/ossl_ssl.c
+@@ -1291,10 +1291,10 @@ ossl_ssl_get_peer_cert_chain(VALUE self)
+ }
+ chain = SSL_get_peer_cert_chain(ssl);
+ if(!chain) return Qnil;
+- num = sk_num(chain);
++ num = sk_X509_num(chain);
+ ary = rb_ary_new2(num);
+ for (i = 0; i < num; i++){
+- cert = (X509*)sk_value(chain, i);
++ cert = sk_X509_value(chain, i);
+ rb_ary_push(ary, ossl_x509_new(cert));
+ }
+
+diff --git a/ext/openssl/ossl_x509attr.c b/ext/openssl/ossl_x509attr.c
+index 1f817cd..2a4c481 100644
+--- a/ext/openssl/ossl_x509attr.c
++++ b/ext/openssl/ossl_x509attr.c
+@@ -218,8 +218,9 @@ ossl_x509attr_get_value(VALUE self)
+ ossl_str_adjust(str, p);
+ }
+ else{
+- length = i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, NULL,
+- i2d_ASN1_TYPE, V_ASN1_SET, V_ASN1_UNIVERSAL, 0);
++ length = i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set,
++ (unsigned char **) NULL, i2d_ASN1_TYPE,
++ V_ASN1_SET, V_ASN1_UNIVERSAL, 0);
+ str = rb_str_new(0, length);
+ p = (unsigned char *)RSTRING_PTR(str);
+ i2d_ASN1_SET_OF_ASN1_TYPE(attr->value.set, &p,
+diff --git a/ext/openssl/ossl_x509crl.c b/ext/openssl/ossl_x509crl.c
+index 1be9640..818fdba 100644
+--- a/ext/openssl/ossl_x509crl.c
++++ b/ext/openssl/ossl_x509crl.c
+@@ -264,7 +264,7 @@ ossl_x509crl_get_revoked(VALUE self)
+ VALUE ary, revoked;
+
+ GetX509CRL(self, crl);
+- num = sk_X509_CRL_num(X509_CRL_get_REVOKED(crl));
++ num = sk_X509_REVOKED_num(X509_CRL_get_REVOKED(crl));
+ if (num < 0) {
+ OSSL_Debug("num < 0???");
+ return rb_ary_new();
+@@ -272,7 +272,7 @@ ossl_x509crl_get_revoked(VALUE self)
+ ary = rb_ary_new2(num);
+ for(i=0; i<num; i++) {
+ /* NO DUP - don't free! */
+- rev = (X509_REVOKED *)sk_X509_CRL_value(X509_CRL_get_REVOKED(crl), i);
++ rev = sk_X509_REVOKED_value(X509_CRL_get_REVOKED(crl), i);
+ revoked = ossl_x509revoked_new(rev);
+ rb_ary_push(ary, revoked);
+ }
+--
+1.7.0.3
View
32 patches/ruby/1.8.4/stdout-rouge-fix.patch
@@ -0,0 +1,32 @@
+--- a/lib/mkmf.rb 2009-06-10 09:09:22.000000000 +0200
++++ b/lib/mkmf.rb 2011-11-12 02:53:05.862766935 +0100
+@@ -168,19 +168,25 @@
+ module Logging
+ @log = nil
+ @logfile = 'mkmf.log'
+- @orgerr = $stderr.dup
+- @orgout = $stdout.dup
+ @postpone = 0
+
+ def self::open
+ @log ||= File::open(@logfile, 'w')
+ @log.sync = true
++ orgerr = $stderr.dup
++ orgout = $stdout.dup
+ $stderr.reopen(@log)
+ $stdout.reopen(@log)
+ yield
+ ensure
+- $stderr.reopen(@orgerr)
+- $stdout.reopen(@orgout)
++ if orgerr
++ $stderr.reopen(orgerr)
++ orgerr.close
++ end
++ if orgout
++ $stdout.reopen(orgout)
++ orgout.close
++ end
+ end
+
+ def self::message(*s)
View
20 patches/ruby/1.8.4/syck.patch
@@ -0,0 +1,20 @@
+diff --git a/ext/syck/rubyext.c b/ext/syck/rubyext.c
+index 078de4f..8c4027f 100644
+--- a/ext/syck/rubyext.c
++++ b/ext/syck/rubyext.c
+@@ -268,9 +268,13 @@ rb_syck_mktime(str, len)
+ {
+ char padded[] = "000000";
+ char *end = ptr + 1;
++ char *p = end;
+ while ( isdigit( *end ) ) end++;
+- MEMCPY(padded, ptr + 1, char, end - (ptr + 1));
+- usec = strtol(padded, NULL, 10);
++ if (end - p < sizeof(padded)) {
++ MEMCPY(padded, ptr + 1, char, end - (ptr + 1));
++ p = padded;
++ }
++ usec = strtol(p, NULL, 10);
+ }
+ else
+ {
View
5 patchsets/ruby/1.8.4/default
@@ -0,0 +1,5 @@
+openssl-1.0
+stdout-rouge-fix
+no_sslv2
+syck
+backported-ossl-fixes
View
20 scripts/functions/manage/base
@@ -242,7 +242,7 @@ __rvm_install_source()
fi
case "${rvm_ruby_string:-""}" in
- ruby-1.8.5-*)
+ ruby-1.8.4|ruby-1.8.5-*)
typeset libdir
libdir="$rvm_ruby_home/lib"
if [[ -d "${libdir}64" ]]
@@ -467,12 +467,18 @@ __rvm_fetch_ruby()
rvm_ruby_package_file="${rvm_ruby_package_file:-"$rvm_ruby_package_name"}"
- if [[ "ruby" == "$rvm_ruby_interpreter" ]]
- then
- rvm_archive_extension="${rvm_archive_extension:-tar.bz2}"
- else
- rvm_archive_extension="${rvm_archive_extension:-tar.gz}"
- fi
+
+ case "$rvm_ruby_string" in
+ (ruby-1.8.4*)
+ rvm_archive_extension="${rvm_archive_extension:-tar.gz}"
+ ;;
+ (ruby-*)
+ rvm_archive_extension="${rvm_archive_extension:-tar.bz2}"
+ ;;
+ (*)
+ rvm_archive_extension="${rvm_archive_extension:-tar.gz}"
+ ;;
+ esac
if [[ ! -s "${rvm_archives_path}/$rvm_ruby_package_file.$rvm_archive_extension" ]]
then
View
19 scripts/selector
@@ -282,8 +282,14 @@ __rvm_select()
;;
ruby)
- rvm_ruby_package_file="${rvm_ruby_interpreter}-${rvm_ruby_version}-${rvm_ruby_patch_level}"
- rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}-${rvm_ruby_patch_level}"
+ if [[ -n "${rvm_ruby_patch_level}" ]]
+ then
+ rvm_ruby_package_file="${rvm_ruby_interpreter}-${rvm_ruby_version}-${rvm_ruby_patch_level}"
+ rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}-${rvm_ruby_patch_level}"
+ else
+ rvm_ruby_package_file="${rvm_ruby_interpreter}-${rvm_ruby_version}"
+ rvm_ruby_package_name="${rvm_ruby_interpreter}-${rvm_ruby_version}"
+ fi
if [[ -z "${rvm_ruby_version:-""}" ]] && (( ${rvm_head_flag:=0} == 0 ))
then
@@ -292,7 +298,14 @@ __rvm_select()
rvm_ruby_repo_url="${rvm_ruby_repo_url:-"$(__rvm_db "ruby_repo_url")"}"
if (( ${rvm_head_flag:=0} == 0 ))
then
- rvm_archive_extension="tar.bz2"
+ case "${rvm_ruby_version}" in
+ (1.8.4)
+ rvm_archive_extension="tar.gz"
+ ;;
+ (*)
+ rvm_archive_extension="tar.bz2"
+ ;;
+ esac
fi
fi
;;
Please sign in to comment.
Something went wrong with that request. Please try again.