[前][次][番号順一覧][スレッド一覧]

ruby-changes:15553

From: usa <ko1@a...>
Date: Fri, 23 Apr 2010 17:38:15 +0900 (JST)
Subject: [ruby-changes:15553] Ruby:r27457 (trunk): * ext/openssl/ossl_config.c: OpenSSL 1.0.0 support.

usa	2010-04-23 17:37:55 +0900 (Fri, 23 Apr 2010)

  New Revision: 27457

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27457

  Log:
    * 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.

  Modified files:
    trunk/ChangeLog
    trunk/ext/openssl/extconf.rb
    trunk/ext/openssl/ossl_config.c
    trunk/ext/openssl/ossl_engine.c
    trunk/ext/openssl/ossl_ssl_session.c

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 27456)
+++ ChangeLog	(revision 27457)
@@ -1,3 +1,16 @@
+Fri Apr 23 17:29:35 2010  NAKAMURA Usaku  <usa@r...>
+
+	* 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@r...>
 
 	* gem_prelude.rb (Gem::QuickLoader.load_full_rubygems_library):
Index: ext/openssl/ossl_engine.c
===================================================================
--- ext/openssl/ossl_engine.c	(revision 27456)
+++ ext/openssl/ossl_engine.c	(revision 27457)
@@ -61,16 +61,34 @@
     }
     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
Index: ext/openssl/ossl_config.c
===================================================================
--- ext/openssl/ossl_config.c	(revision 27456)
+++ ext/openssl/ossl_config.c	(revision 27457)
@@ -314,13 +314,14 @@
 
 #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 @@
 
     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 @@
     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 @@
     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 @@
 }
 
 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 @@
     }
 }
 
-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 @@
     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;
 }
Index: ext/openssl/ossl_ssl_session.c
===================================================================
--- ext/openssl/ossl_ssl_session.c	(revision 27456)
+++ ext/openssl/ossl_ssl_session.c	(revision 27457)
@@ -72,6 +72,16 @@
 	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
Index: ext/openssl/extconf.rb
===================================================================
--- ext/openssl/extconf.rb	(revision 27456)
+++ ext/openssl/extconf.rb	(revision 27457)
@@ -95,6 +95,7 @@
 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 @@
   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>

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]