diff options
author | Florian Franzmann | 2010-04-01 20:06:38 +0200 |
---|---|---|
committer | Florian Franzmann | 2010-04-01 20:06:38 +0200 |
commit | 71a38c17218087e38b3afeb5d09c2f1945737191 (patch) | |
tree | a115ba5dd1ccc65d9f60c8318b7a46f38aae8ba6 | |
parent | 346675acb5ddfb2f271e14ebeceebd4a78127c10 (diff) |
ruby-raa/ruby-1.9: added patch to fix build with openssl 1.0.0
-rw-r--r-- | ruby-raa/ruby-1.9/HISTORY | 4 | ||||
-rwxr-xr-x | ruby-raa/ruby-1.9/PRE_BUILD | 3 | ||||
-rw-r--r-- | ruby-raa/ruby-1.9/ruby-1.9.2pre1-openssl1-patch | 463 |
3 files changed, 470 insertions, 0 deletions
diff --git a/ruby-raa/ruby-1.9/HISTORY b/ruby-raa/ruby-1.9/HISTORY index 8d16dd5511..7ba3941dee 100644 --- a/ruby-raa/ruby-1.9/HISTORY +++ b/ruby-raa/ruby-1.9/HISTORY @@ -1,3 +1,7 @@ +2010-04-01 Florian Franzmann <siflfran@hawo.stw.uni-erlangen.de> + * PRE_BUILD, ruby-1.9.2pre1-openssl1-patch: + added patch to fix build issue with openssl 1.0.0 + 2010-02-26 Remko van der Vossen <wich@sourcemage.org> * DETAILS: fixed SPELL != PACKAGE issue diff --git a/ruby-raa/ruby-1.9/PRE_BUILD b/ruby-raa/ruby-1.9/PRE_BUILD new file mode 100755 index 0000000000..f04549ffdf --- /dev/null +++ b/ruby-raa/ruby-1.9/PRE_BUILD @@ -0,0 +1,3 @@ +default_pre_build && +cd ${SOURCE_DIRECTORY} && +patch -p0 < ${SCRIPT_DIRECTORY}/ruby-1.9.2pre1-openssl1-patch diff --git a/ruby-raa/ruby-1.9/ruby-1.9.2pre1-openssl1-patch b/ruby-raa/ruby-1.9/ruby-1.9.2pre1-openssl1-patch new file mode 100644 index 0000000000..d2a44b15d4 --- /dev/null +++ b/ruby-raa/ruby-1.9/ruby-1.9.2pre1-openssl1-patch @@ -0,0 +1,463 @@ + +Index: ext/openssl/ossl.c + +--- ext/openssl/ossl.c.orig 2009-03-19 20:40:38.000000000 +0900 ++++ 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; \ +Index: ext/openssl/ossl_asn1.c + +--- ext/openssl/ossl_asn1.c.orig 2009-03-13 10:42:21.000000000 +0900 ++++ ext/openssl/ossl_asn1.c +@@ -304,7 +304,7 @@ obj_to_asn1derstr(VALUE obj) + * DER to Ruby converters + */ + static VALUE +-decode_bool(unsigned char* der, int length) ++decode_bool(const unsigned char* der, int length) + { + int val; + const unsigned char *p; +@@ -317,7 +317,7 @@ decode_bool(unsigned char* der, int leng + } + + static VALUE +-decode_int(unsigned char* der, int length) ++decode_int(const unsigned char* der, int length) + { + ASN1_INTEGER *ai; + const unsigned char *p; +@@ -336,7 +336,7 @@ decode_int(unsigned char* der, int lengt + } + + static VALUE +-decode_bstr(unsigned char* der, int length, long *unused_bits) ++decode_bstr(const unsigned char* der, int length, long *unused_bits) + { + ASN1_BIT_STRING *bstr; + const unsigned char *p; +@@ -357,7 +357,7 @@ decode_bstr(unsigned char* der, int leng + } + + static VALUE +-decode_enum(unsigned char* der, int length) ++decode_enum(const unsigned char* der, int length) + { + ASN1_ENUMERATED *ai; + const unsigned char *p; +@@ -376,7 +376,7 @@ decode_enum(unsigned char* der, int leng + } + + static VALUE +-decode_null(unsigned char* der, int length) ++decode_null(const unsigned char* der, int length) + { + ASN1_NULL *null; + const unsigned char *p; +@@ -390,7 +390,7 @@ decode_null(unsigned char* der, int leng + } + + static VALUE +-decode_obj(unsigned char* der, int length) ++decode_obj(const unsigned char* der, int length) + { + ASN1_OBJECT *obj; + const unsigned char *p; +@@ -419,7 +419,7 @@ decode_obj(unsigned char* der, int lengt + } + + static VALUE +-decode_time(unsigned char* der, int length) ++decode_time(const unsigned char* der, int length) + { + ASN1_TIME *time; + const unsigned char *p; +@@ -707,10 +707,10 @@ ossl_asn1data_to_der(VALUE self) + } + + static VALUE +-ossl_asn1_decode0(unsigned char **pp, long length, long *offset, long depth, +- int once, int yield) ++ossl_asn1_decode0(const unsigned char **pp, long length, long *offset, ++ long depth, int once, int yield) + { +- unsigned char *start, *p; ++ const unsigned char *start, *p; + const unsigned char *p0; + long len, off = *offset; + int hlen, tag, tc, j; +@@ -816,7 +816,7 @@ ossl_asn1_decode0(unsigned char **pp, lo + static VALUE + ossl_asn1_traverse(VALUE self, VALUE obj) + { +- unsigned char *p; ++ const unsigned char *p; + long offset = 0; + volatile VALUE tmp; + +@@ -832,7 +832,7 @@ static VALUE + ossl_asn1_decode(VALUE self, VALUE obj) + { + VALUE ret, ary; +- unsigned char *p; ++ const unsigned char *p; + long offset = 0; + volatile VALUE tmp; + +@@ -849,7 +849,7 @@ static VALUE + ossl_asn1_decode_all(VALUE self, VALUE obj) + { + VALUE ret; +- unsigned char *p; ++ const unsigned char *p; + long offset = 0; + volatile VALUE tmp; + +Index: ext/openssl/ossl_config.c + +--- ext/openssl/ossl_config.c.orig 2009-04-18 23:10:06.000000000 +0900 ++++ ext/openssl/ossl_config.c +@@ -304,8 +304,17 @@ ossl_config_get_section_old(VALUE self, + + #ifdef IMPLEMENT_LHASH_DOALL_ARG_FN + static void +-get_conf_section(CONF_VALUE *cv, VALUE ary) ++#if OPENSSL_VERSION_NUMBER >= 0x10000000L ++get_conf_section_doall_arg(void *arg1, void *arg2) ++#else ++get_conf_section(void *arg1, void *arg2) ++#endif + { ++ CONF_VALUE *cv; ++ VALUE ary; ++ ++ cv = arg1; ++ ary = (VALUE)arg2; + if(cv->name) return; + rb_ary_push(ary, rb_str_new2(cv->section)); + } +@@ -320,19 +329,31 @@ ossl_config_get_sections(VALUE self) + + GetConfig(self, conf); + ary = rb_ary_new(); ++#if OPENSSL_VERSION_NUMBER >= 0x10000000L ++ LHM_lh_doall_arg(CONF_VALUE, conf->data, ++ LHASH_DOALL_ARG_FN(get_conf_section), void, (void*)ary); ++#else + lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(get_conf_section), (void*)ary); ++#endif + + return ary; + } + + static void +-dump_conf_value(CONF_VALUE *cv, VALUE str) ++#if OPENSSL_VERSION_NUMBER >= 0x10000000L ++dump_conf_value_doall_arg(void *arg1, void *arg2) ++#else ++dump_conf_value(void *arg1, void *arg2) ++#endif + { + STACK_OF(CONF_VALUE) *sk; +- CONF_VALUE *v; ++ CONF_VALUE *cv, *v; ++ VALUE str; + int i, num; + ++ cv = arg1; + if (cv->name) return; ++ str = (VALUE)arg2; + sk = (STACK_OF(CONF_VALUE)*)cv->value; + num = sk_CONF_VALUE_num(sk); + rb_str_cat2(str, "[ "); +@@ -356,7 +377,12 @@ dump_conf(CONF *conf) + VALUE str; + + str = rb_str_new(0, 0); ++#if OPENSSL_VERSION_NUMBER >= 0x10000000L ++ LHM_lh_doall_arg(CONF_VALUE, conf->data, ++ LHASH_DOALL_ARG_FN(dump_conf_value), void, (void*)str); ++#else + lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_conf_value), (void*)str); ++#endif + + return str; + } +@@ -372,13 +398,18 @@ ossl_config_to_s(VALUE self) + } + + static void +-each_conf_value(CONF_VALUE *cv, void* dummy) ++#if OPENSSL_VERSION_NUMBER >= 0x10000000L ++each_conf_value_doall_arg(void *arg1, void* dummy) ++#else ++each_conf_value(void *arg1, void* dummy) ++#endif + { + STACK_OF(CONF_VALUE) *sk; +- CONF_VALUE *v; ++ CONF_VALUE *cv, *v; + VALUE section, name, value, args; + int i, num; + ++ cv = arg1; + if (cv->name) return; + sk = (STACK_OF(CONF_VALUE)*)cv->value; + num = sk_CONF_VALUE_num(sk); +@@ -402,7 +433,12 @@ ossl_config_each(VALUE self) + RETURN_ENUMERATOR(self, 0, 0); + + GetConfig(self, conf); ++#if OPENSSL_VERSION_NUMBER >= 0x10000000L ++ LHM_lh_doall_arg(CONF_VALUE, conf->data, ++ LHASH_DOALL_ARG_FN(each_conf_value), void, (void*)NULL); ++#else + lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(each_conf_value), (void*)NULL); ++#endif + + return self; + } +Index: ext/openssl/ossl_pkcs7.c + +--- ext/openssl/ossl_pkcs7.c.orig 2008-07-23 00:34:23.000000000 +0900 ++++ ext/openssl/ossl_pkcs7.c +@@ -572,12 +572,11 @@ ossl_pkcs7_add_certificate(VALUE self, V + 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 + 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, + 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, + 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 ar + 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 ar + 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 +Index: ext/openssl/ossl_ssl.c + +--- ext/openssl/ossl_ssl.c.orig 2009-03-21 17:08:52.000000000 +0900 ++++ ext/openssl/ossl_ssl.c +@@ -16,6 +16,12 @@ + # include <unistd.h> /* for read(), and write() */ + #endif + ++#if OPENSSL_VERSION_NUMBER >= 0x00909000L ++#define OSSL_CONST const ++#else ++#define OSSL_CONST ++#endif ++ + #define numberof(ary) (sizeof(ary)/sizeof(ary[0])) + + #ifdef _WIN32 +@@ -101,7 +107,7 @@ ID ID_callback_state; + */ + struct { + const char *name; +- SSL_METHOD *(*func)(void); ++ OSSL_CONST SSL_METHOD *(*func)(void); + } ossl_ssl_method_tab[] = { + #define OSSL_SSL_METHOD_ENTRY(name) { #name, name##_method } + OSSL_SSL_METHOD_ENTRY(TLSv1), +@@ -150,7 +156,7 @@ ossl_sslctx_s_alloc(VALUE klass) + static VALUE + ossl_sslctx_set_ssl_version(VALUE self, VALUE ssl_method) + { +- SSL_METHOD *method = NULL; ++ OSSL_CONST SSL_METHOD *method = NULL; + const char *s; + int i; + +@@ -662,7 +668,7 @@ ossl_sslctx_setup(VALUE self) + } + + static VALUE +-ossl_ssl_cipher_to_ary(SSL_CIPHER *cipher) ++ossl_ssl_cipher_to_ary(const SSL_CIPHER *cipher) + { + VALUE ary; + int bits, alg_bits; +@@ -700,10 +706,10 @@ ossl_sslctx_get_ciphers(VALUE self) + if (!ciphers) + return rb_ary_new(); + +- num = sk_num((STACK*)ciphers); ++ num = sk_SSL_CIPHER_num(ciphers); + ary = rb_ary_new2(num); + for(i = 0; i < num; i++){ +- cipher = (SSL_CIPHER*)sk_value((STACK*)ciphers, i); ++ cipher = sk_SSL_CIPHER_value(ciphers, i); + rb_ary_push(ary, ossl_ssl_cipher_to_ary(cipher)); + } + return ary; +@@ -1400,10 +1406,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)); + } + +@@ -1418,7 +1424,7 @@ static VALUE + ossl_ssl_get_cipher(VALUE self) + { + SSL *ssl; +- SSL_CIPHER *cipher; ++ const SSL_CIPHER *cipher; + + Data_Get_Struct(self, SSL, ssl); + if (!ssl) { +Index: ext/openssl/ossl_ssl_session.c + +--- ext/openssl/ossl_ssl_session.c.orig 2009-03-13 16:45:35.000000000 +0900 ++++ ext/openssl/ossl_ssl_session.c +@@ -84,10 +84,12 @@ static VALUE ossl_ssl_session_eq(VALUE v + GetSSLSession(val1, ctx1); + SafeGetSSLSession(val2, ctx2); + +- switch (SSL_SESSION_cmp(ctx1, ctx2)) { +- case 0: return Qtrue; +- default: return Qfalse; +- } ++ if ((ctx1->ssl_version == ctx2->ssl_version) && ++ (ctx1->session_id_length == ctx2->session_id_length) && ++ memcmp(ctx1->session_id, ctx2->session_id, ctx1->session_id_length) == 0) ++ return Qtrue; ++ else ++ return Qfalse; + } + + /* +Index: ext/openssl/ossl_x509crl.c + +--- ext/openssl/ossl_x509crl.c.orig 2008-07-23 00:34:23.000000000 +0900 ++++ 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); + } |