aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-04-21 18:38:43 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-04-27 23:07:41 +0900
commit435fe7bdd0980e3fdb5483986a784fa2ba4bc46a (patch)
tree43c3b271d08810d9a253a295e79cf121e4abf1de
parent4c726635566caf0772f253baeb7b1b86b1711c8f (diff)
downloadruby-435fe7bdd0980e3fdb5483986a784fa2ba4bc46a.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 ed71509..2867f64 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