aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-04-21 18:38:43 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-05-05 16:58:14 +0900
commit9bcdc891c810a1c267171d717d593ae2790ef59a (patch)
tree11b46c509d8c95c9b3d6270de8005a38b74fdac5
parentd83b523723a23530f2cd85ddffa8d9860d36e209 (diff)
downloadruby-9bcdc891c810a1c267171d717d593ae2790ef59a.tar.gz
ext/openssl: d2i_ASN1_BOOLEAN is removed
-rw-r--r--ext/openssl/ossl_asn1.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index ed715097d4..2867f64ec1 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -330,14 +330,15 @@ obj_to_asn1derstr(VALUE obj)
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 boolean");
+ if (*p++ != 1)
+ ossl_raise(eASN1Error, "length is not 1");
- return val ? Qtrue : Qfalse;
+ return *p ? Qtrue : Qfalse;
}
static VALUE