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

ruby-changes:44492

From: nagachika <ko1@a...>
Date: Sat, 5 Nov 2016 11:48:40 +0900 (JST)
Subject: [ruby-changes:44492] nagachika:r56565 (ruby_2_3): merge revision(s) 55074: [Backport #12868]

nagachika	2016-11-05 11:48:35 +0900 (Sat, 05 Nov 2016)

  New Revision: 56565

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56565

  Log:
    merge revision(s) 55074: [Backport #12868]
    
    * ext/openssl/ossl.c (Init_openssl): register an ex_data index for
      X509_STORE and X509_STORE_CTX respectively. Since they don't share
      the ex_data index registry, we can't use the same index.
      (ossl_verify_cb): use the the correct index.
    
    * ext/openssl/ossl_ssl.c (ossl_ssl_verify_callback): ditto.
    
    * ext/openssl/ossl_x509store.c (ossl_x509store_set_vfy_cb): ditto.
      (ossl_x509stctx_verify): ditto.
    
    * ext/openssl/ossl.h (void ossl_clear_error): add extern declarations
      of ossl_store_{ctx_,}ex_verify_cb_idx.
    
    * ext/openssl/openssl_missing.c: remove X509_STORE_set_ex_data and
      X509_STORE_get_ex_data.
    
    * ext/openssl/openssl_missing.h: implement X509_STORE_get_ex_data,
      X509_STORE_set_ex_data and X509_STORE_get_ex_new_index as macros.

  Modified directories:
    branches/ruby_2_3/
  Modified files:
    branches/ruby_2_3/ChangeLog
    branches/ruby_2_3/ext/openssl/openssl_missing.c
    branches/ruby_2_3/ext/openssl/openssl_missing.h
    branches/ruby_2_3/ext/openssl/ossl.c
    branches/ruby_2_3/ext/openssl/ossl.h
    branches/ruby_2_3/ext/openssl/ossl_ssl.c
    branches/ruby_2_3/ext/openssl/ossl_x509store.c
    branches/ruby_2_3/version.h
Index: ruby_2_3/ChangeLog
===================================================================
--- ruby_2_3/ChangeLog	(revision 56564)
+++ ruby_2_3/ChangeLog	(revision 56565)
@@ -1,3 +1,24 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1
+Sat Nov  5 11:45:32 2016  Kazuki Yamaguchi  <k@r...>
+
+	* ext/openssl/ossl.c (Init_openssl): register an ex_data index for
+	  X509_STORE and X509_STORE_CTX respectively. Since they don't share
+	  the ex_data index registry, we can't use the same index.
+	  (ossl_verify_cb): use the the correct index.
+
+	* ext/openssl/ossl_ssl.c (ossl_ssl_verify_callback): ditto.
+
+	* ext/openssl/ossl_x509store.c (ossl_x509store_set_vfy_cb): ditto.
+	  (ossl_x509stctx_verify): ditto.
+
+	* ext/openssl/ossl.h (void ossl_clear_error): add extern declarations
+	  of ossl_store_{ctx_,}ex_verify_cb_idx.
+
+	* ext/openssl/openssl_missing.c: remove X509_STORE_set_ex_data and
+	  X509_STORE_get_ex_data.
+
+	* ext/openssl/openssl_missing.h: implement X509_STORE_get_ex_data,
+	  X509_STORE_set_ex_data and X509_STORE_get_ex_new_index as macros.
+
 Sat Nov  5 11:35:58 2016  Nobuyoshi Nakada  <nobu@r...>
 
 	* thread.c (rb_thread_pending_interrupt_p): no pending interrupt
Index: ruby_2_3/version.h
===================================================================
--- ruby_2_3/version.h	(revision 56564)
+++ ruby_2_3/version.h	(revision 56565)
@@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1
 #define RUBY_VERSION "2.3.2"
 #define RUBY_RELEASE_DATE "2016-11-05"
-#define RUBY_PATCHLEVEL 202
+#define RUBY_PATCHLEVEL 203
 
 #define RUBY_RELEASE_YEAR 2016
 #define RUBY_RELEASE_MONTH 11
Index: ruby_2_3/ext/openssl/ossl_ssl.c
===================================================================
--- ruby_2_3/ext/openssl/ossl_ssl.c	(revision 56564)
+++ ruby_2_3/ext/openssl/ossl_ssl.c	(revision 56565)
@@ -307,7 +307,7 @@ ossl_ssl_verify_callback(int preverify_o https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/openssl/ossl_ssl.c#L307
 
     ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx());
     cb = (VALUE)SSL_get_ex_data(ssl, ossl_ssl_ex_vcb_idx);
-    X509_STORE_CTX_set_ex_data(ctx, ossl_verify_cb_idx, (void*)cb);
+    X509_STORE_CTX_set_ex_data(ctx, ossl_store_ctx_ex_verify_cb_idx, (void *)cb);
     return ossl_verify_cb(preverify_ok, ctx);
 }
 
Index: ruby_2_3/ext/openssl/openssl_missing.c
===================================================================
--- ruby_2_3/ext/openssl/openssl_missing.c	(revision 56564)
+++ ruby_2_3/ext/openssl/openssl_missing.c	(revision 56565)
@@ -34,20 +34,6 @@ HMAC_CTX_copy(HMAC_CTX *out, HMAC_CTX *i https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/openssl/openssl_missing.c#L34
 #endif /* HAVE_HMAC_CTX_COPY */
 #endif /* NO_HMAC */
 
-#if !defined(HAVE_X509_STORE_SET_EX_DATA)
-int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data)
-{
-    return CRYPTO_set_ex_data(&str->ex_data, idx, data);
-}
-#endif
-
-#if !defined(HAVE_X509_STORE_GET_EX_DATA)
-void *X509_STORE_get_ex_data(X509_STORE *str, int idx)
-{
-    return CRYPTO_get_ex_data(&str->ex_data, idx);
-}
-#endif
-
 #if !defined(HAVE_EVP_MD_CTX_CREATE)
 EVP_MD_CTX *
 EVP_MD_CTX_create(void)
Index: ruby_2_3/ext/openssl/ossl.c
===================================================================
--- ruby_2_3/ext/openssl/ossl.c	(revision 56564)
+++ ruby_2_3/ext/openssl/ossl.c	(revision 56565)
@@ -198,7 +198,8 @@ ossl_pem_passwd_cb(char *buf, int max_le https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/openssl/ossl.c#L198
 /*
  * Verify callback
  */
-int ossl_verify_cb_idx;
+int ossl_store_ctx_ex_verify_cb_idx;
+int ossl_store_ex_verify_cb_idx;
 
 VALUE
 ossl_call_verify_cb_proc(struct ossl_verify_cb_args *args)
@@ -214,10 +215,10 @@ ossl_verify_cb(int ok, X509_STORE_CTX *c https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/openssl/ossl.c#L215
     struct ossl_verify_cb_args args;
     int state = 0;
 
-    proc = (VALUE)X509_STORE_CTX_get_ex_data(ctx, ossl_verify_cb_idx);
-    if ((void*)proc == 0)
-	proc = (VALUE)X509_STORE_get_ex_data(ctx->ctx, ossl_verify_cb_idx);
-    if ((void*)proc == 0)
+    proc = (VALUE)X509_STORE_CTX_get_ex_data(ctx, ossl_store_ctx_ex_verify_cb_idx);
+    if (!proc)
+	proc = (VALUE)X509_STORE_get_ex_data(ctx->ctx, ossl_store_ex_verify_cb_idx);
+    if (!proc)
 	return ok;
     if (!NIL_P(proc)) {
 	ret = Qfalse;
@@ -1127,8 +1128,10 @@ Init_openssl(void) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/openssl/ossl.c#L1128
     /*
      * Verify callback Proc index for ext-data
      */
-    if ((ossl_verify_cb_idx = X509_STORE_CTX_get_ex_new_index(0, (void *)"ossl_verify_cb_idx", 0, 0, 0)) < 0)
+    if ((ossl_store_ctx_ex_verify_cb_idx = X509_STORE_CTX_get_ex_new_index(0, (void *)"ossl_store_ctx_ex_verify_cb_idx", 0, 0, 0)) < 0)
         ossl_raise(eOSSLError, "X509_STORE_CTX_get_ex_new_index");
+    if ((ossl_store_ex_verify_cb_idx = X509_STORE_get_ex_new_index(0, (void *)"ossl_store_ex_verify_cb_idx", 0, 0, 0)) < 0)
+        ossl_raise(eOSSLError, "X509_STORE_get_ex_new_index");
 
     /*
      * Init debug core
Index: ruby_2_3/ext/openssl/openssl_missing.h
===================================================================
--- ruby_2_3/ext/openssl/openssl_missing.h	(revision 56564)
+++ ruby_2_3/ext/openssl/openssl_missing.h	(revision 56565)
@@ -133,11 +133,16 @@ int EVP_CIPHER_CTX_copy(EVP_CIPHER_CTX * https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/openssl/openssl_missing.h#L133
 #endif
 
 #if !defined(HAVE_X509_STORE_GET_EX_DATA)
-void *X509_STORE_get_ex_data(X509_STORE *str, int idx);
+#  define X509_STORE_get_ex_data(x, idx) \
+	CRYPTO_get_ex_data(&(x)->ex_data, (idx))
 #endif
 
 #if !defined(HAVE_X509_STORE_SET_EX_DATA)
-int X509_STORE_set_ex_data(X509_STORE *str, int idx, void *data);
+#  define X509_STORE_set_ex_data(x, idx, data) \
+	CRYPTO_set_ex_data(&(x)->ex_data, (idx), (data))
+#  define X509_STORE_get_ex_new_index(l, p, newf, dupf, freef) \
+	CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_X509_STORE, (l), (p), \
+				(newf), (dupf), (freef))
 #endif
 
 #if !defined(HAVE_X509_CRL_SET_VERSION)
Index: ruby_2_3/ext/openssl/ossl_x509store.c
===================================================================
--- ruby_2_3/ext/openssl/ossl_x509store.c	(revision 56564)
+++ ruby_2_3/ext/openssl/ossl_x509store.c	(revision 56565)
@@ -130,7 +130,7 @@ ossl_x509store_set_vfy_cb(VALUE self, VA https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/openssl/ossl_x509store.c#L130
     X509_STORE *store;
 
     GetX509Store(self, store);
-    X509_STORE_set_ex_data(store, ossl_verify_cb_idx, (void*)cb);
+    X509_STORE_set_ex_data(store, ossl_store_ex_verify_cb_idx, (void *)cb);
     rb_iv_set(self, "@verify_callback", cb);
 
     return cb;
@@ -467,7 +467,7 @@ ossl_x509stctx_verify(VALUE self) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/openssl/ossl_x509store.c#L467
     int result;
 
     GetX509StCtx(self, ctx);
-    X509_STORE_CTX_set_ex_data(ctx, ossl_verify_cb_idx,
+    X509_STORE_CTX_set_ex_data(ctx, ossl_store_ctx_ex_verify_cb_idx,
                                (void*)rb_iv_get(self, "@verify_callback"));
     result = X509_verify_cert(ctx);
 
Index: ruby_2_3/ext/openssl/ossl.h
===================================================================
--- ruby_2_3/ext/openssl/ossl.h	(revision 56564)
+++ ruby_2_3/ext/openssl/ossl.h	(revision 56565)
@@ -167,7 +167,8 @@ VALUE ossl_exc_new(VALUE, const char *, https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/openssl/ossl.h#L167
 /*
  * Verify callback
  */
-extern int ossl_verify_cb_idx;
+extern int ossl_store_ctx_ex_verify_cb_idx;
+extern int ossl_store_ex_verify_cb_idx;
 
 struct ossl_verify_cb_args {
     VALUE proc;

Property changes on: ruby_2_3
___________________________________________________________________
Modified: svn:mergeinfo
   Merged /trunk:r55074


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

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