1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* ext/openssl/ossl_config.c: OpenSSL 1.0.0 support.

* ext/openssl/extconf.rb: check some functions added/removed at
  OpenSSL 1.0.0.

* ext/openssl/ossl_engine.c (ossl_engine_s_load): use engines which
  exists.

* ext/openssl/ossl_ssl_session (SSL_SESSION_cmp): removed at 1.0.0,
  so implement compatible fuction here.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27457 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2010-04-23 08:37:55 +00:00
parent a909ff22c8
commit 6f7b5ffe6f
5 changed files with 64 additions and 9 deletions

View file

@ -1,3 +1,16 @@
Fri Apr 23 17:29:35 2010 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/openssl/ossl_config.c: OpenSSL 1.0.0 support.
* ext/openssl/extconf.rb: check some functions added/removed at
OpenSSL 1.0.0.
* ext/openssl/ossl_engine.c (ossl_engine_s_load): use engines which
exists.
* ext/openssl/ossl_ssl_session (SSL_SESSION_cmp): removed at 1.0.0,
so implement compatible fuction here.
Fri Apr 23 14:37:22 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
* gem_prelude.rb (Gem::QuickLoader.load_full_rubygems_library):

View file

@ -95,6 +95,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("SSL_SESSION_cmp")
have_func("OPENSSL_cleanse")
unless have_func("SSL_set_tlsext_host_name", ['openssl/ssl.h'])
have_macro("SSL_set_tlsext_host_name", ['openssl/ssl.h']) && $defs.push("-DHAVE_SSL_SET_TLSEXT_HOST_NAME")
@ -109,6 +110,14 @@ if have_header("openssl/engine.h")
have_func("ENGINE_get_digest")
have_func("ENGINE_get_cipher")
have_func("ENGINE_cleanup")
have_func("ENGINE_load_4758cca")
have_func("ENGINE_load_aep")
have_func("ENGINE_load_atalla")
have_func("ENGINE_load_chil")
have_func("ENGINE_load_cswift")
have_func("ENGINE_load_nuron")
have_func("ENGINE_load_sureware")
have_func("ENGINE_load_ubsec")
end
if try_compile(<<SRC)
#include <openssl/opensslv.h>

View file

@ -314,13 +314,14 @@ ossl_config_get_section_old(VALUE self, VALUE section)
#ifdef IMPLEMENT_LHASH_DOALL_ARG_FN
static void
get_conf_section(CONF_VALUE *cv, VALUE ary)
get_conf_section_doall_arg(CONF_VALUE *cv, void *tmp)
{
VALUE ary = (VALUE)tmp;
if(cv->name) return;
rb_ary_push(ary, rb_str_new2(cv->section));
}
static IMPLEMENT_LHASH_DOALL_ARG_FN(get_conf_section, CONF_VALUE*, VALUE)
static IMPLEMENT_LHASH_DOALL_ARG_FN(get_conf_section, CONF_VALUE, void)
static VALUE
ossl_config_get_sections(VALUE self)
@ -330,14 +331,16 @@ ossl_config_get_sections(VALUE self)
GetConfig(self, conf);
ary = rb_ary_new();
lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(get_conf_section), (void*)ary);
lh_doall_arg((_LHASH *)conf->data, LHASH_DOALL_ARG_FN(get_conf_section),
(void*)ary);
return ary;
}
static void
dump_conf_value(CONF_VALUE *cv, VALUE str)
dump_conf_value_doall_arg(CONF_VALUE *cv, void *tmp)
{
VALUE str = (VALUE)tmp;
STACK_OF(CONF_VALUE) *sk;
CONF_VALUE *v;
int i, num;
@ -358,7 +361,7 @@ dump_conf_value(CONF_VALUE *cv, VALUE str)
rb_str_cat2(str, "\n");
}
static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_conf_value, CONF_VALUE*, VALUE)
static IMPLEMENT_LHASH_DOALL_ARG_FN(dump_conf_value, CONF_VALUE, void)
static VALUE
dump_conf(CONF *conf)
@ -366,7 +369,8 @@ dump_conf(CONF *conf)
VALUE str;
str = rb_str_new(0, 0);
lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(dump_conf_value), (void*)str);
lh_doall_arg((_LHASH *)conf->data, LHASH_DOALL_ARG_FN(dump_conf_value),
(void*)str);
return str;
}
@ -382,7 +386,7 @@ ossl_config_to_s(VALUE self)
}
static void
each_conf_value(CONF_VALUE *cv, void* dummy)
each_conf_value_doall_arg(CONF_VALUE *cv, void *dummy)
{
STACK_OF(CONF_VALUE) *sk;
CONF_VALUE *v;
@ -402,7 +406,7 @@ each_conf_value(CONF_VALUE *cv, void* dummy)
}
}
static IMPLEMENT_LHASH_DOALL_ARG_FN(each_conf_value, CONF_VALUE*, void*)
static IMPLEMENT_LHASH_DOALL_ARG_FN(each_conf_value, CONF_VALUE, void *)
static VALUE
ossl_config_each(VALUE self)
@ -412,7 +416,8 @@ ossl_config_each(VALUE self)
RETURN_ENUMERATOR(self, 0, 0);
GetConfig(self, conf);
lh_doall_arg(conf->data, LHASH_DOALL_ARG_FN(each_conf_value), (void*)NULL);
lh_doall_arg((_LHASH *)conf->data, LHASH_DOALL_ARG_FN(each_conf_value),
(void*)NULL);
return self;
}

View file

@ -61,16 +61,34 @@ ossl_engine_s_load(int argc, VALUE *argv, VALUE klass)
}
StringValue(name);
#ifndef OPENSSL_NO_STATIC_ENGINE
#if HAVE_ENGINE_LOAD_DYNAMIC
OSSL_ENGINE_LOAD_IF_MATCH(dynamic);
#endif
#if HAVE_ENGINE_LOAD_CSWIFT
OSSL_ENGINE_LOAD_IF_MATCH(cswift);
#endif
#if HAVE_ENGINE_LOAD_CHIL
OSSL_ENGINE_LOAD_IF_MATCH(chil);
#endif
#if HAVE_ENGINE_LOAD_ATALLA
OSSL_ENGINE_LOAD_IF_MATCH(atalla);
#endif
#if HAVE_ENGINE_LOAD_NURON
OSSL_ENGINE_LOAD_IF_MATCH(nuron);
#endif
#if HAVE_ENGINE_LOAD_UBSEC
OSSL_ENGINE_LOAD_IF_MATCH(ubsec);
#endif
#if HAVE_ENGINE_LOAD_AEP
OSSL_ENGINE_LOAD_IF_MATCH(aep);
#endif
#if HAVE_ENGINE_LOAD_SUREWARE
OSSL_ENGINE_LOAD_IF_MATCH(sureware);
#endif
#if HAVE_ENGINE_LOAD_4758CCA
OSSL_ENGINE_LOAD_IF_MATCH(4758cca);
#endif
#endif
#ifdef HAVE_ENGINE_LOAD_OPENBSD_DEV_CRYPTO
OSSL_ENGINE_LOAD_IF_MATCH(openbsd_dev_crypto);
#endif

View file

@ -72,6 +72,16 @@ static VALUE ossl_ssl_session_initialize(VALUE self, VALUE arg1)
return self;
}
#if HAVE_SSL_SESSION_CMP == 0
static int SSL_SESSION_cmp(const SSL_SESSION *a,const SSL_SESSION *b)
{
if (a->ssl_version != b->ssl_version ||
a->session_id_length != b->session_id_length)
return 1;
return memcmp(a->session_id,b-> session_id, a->session_id_length);
}
#endif
/*
* call-seq:
* session1 == session2 -> boolean