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-14 20:00:57 +0900
commit8b5f03e697510176d9a03e18ca058217221d7c46 (patch)
tree8a98f7c53ddc61213a852edaca4bbf877a4a784f
parent96cb4a26a5a6fcc45dda00aa67830c28a9220601 (diff)
downloadruby-8b5f03e697510176d9a03e18ca058217221d7c46.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