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

ruby-changes:43214

From: rhe <ko1@a...>
Date: Mon, 6 Jun 2016 01:18:45 +0900 (JST)
Subject: [ruby-changes:43214] rhe:r55288 (trunk): openssl: avoid d2i_ASN1_BOOLEAN()

rhe	2016-06-06 01:18:38 +0900 (Mon, 06 Jun 2016)

  New Revision: 55288

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

  Log:
    openssl: avoid d2i_ASN1_BOOLEAN()
    
    * ext/openssl/ossl_asn1.c (decode_bool): Do the same thing as
      d2i_ASN1_BOOLEAN() does by ourselves. This function is removed in
      OpenSSL 1.1.0.
      [ruby-core:75225] [Feature #12324]

  Modified files:
    trunk/ChangeLog
    trunk/ext/openssl/ossl_asn1.c
Index: ext/openssl/ossl_asn1.c
===================================================================
--- ext/openssl/ossl_asn1.c	(revision 55287)
+++ ext/openssl/ossl_asn1.c	(revision 55288)
@@ -357,14 +357,15 @@ obj_to_asn1derstr(VALUE obj) https://github.com/ruby/ruby/blob/trunk/ext/openssl/ossl_asn1.c#L357
 static VALUE
 decode_bool(unsigned char* der, long length)
 {
-    int val;
-    const unsigned char *p;
+    const unsigned char *p = der;
 
-    p = der;
-    if((val = d2i_ASN1_BOOLEAN(NULL, &p, length)) < 0)
-	ossl_raise(eASN1Error, NULL);
+    assert(length == 3);
+    if (*p++ != 1)
+	ossl_raise(eASN1Error, "not a boolean");
+    if (*p++ != 1)
+	ossl_raise(eASN1Error, "length is not 1");
 
-    return val ? Qtrue : Qfalse;
+    return *p ? Qtrue : Qfalse;
 }
 
 static VALUE
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55287)
+++ ChangeLog	(revision 55288)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Mon Jun  6 01:18:10 2016  Kazuki Yamaguchi  <k@r...>
+
+	* ext/openssl/ossl_asn1.c (decode_bool): Do the same thing as
+	  d2i_ASN1_BOOLEAN() does by ourselves. This function is removed in
+	  OpenSSL 1.1.0.
+	  [ruby-core:75225] [Feature #12324]
+
 Mon Jun  6 00:34:16 2016  Kazuki Yamaguchi  <k@r...>
 
 	* ext/openssl/extconf.rb: Check existence of accessor functions that

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

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