aboutsummaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-09-08 19:36:54 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-09-22 19:33:24 +0900
commit803bc4e494c68776fdc3a6ce0fb3f3ce53f7257f (patch)
treeac4cfecb292908c95a2513d99698c93b70892d69 /ext
parent5903527f182b4707976e782a1877e444d4e4d3b9 (diff)
downloadruby-openssl-803bc4e494c68776fdc3a6ce0fb3f3ce53f7257f.tar.gz
asn1: remove dead code
Remove code relating DO_IT_VIA_RUBY. If DO_IT_VIA_RUBY is set to 1, OpenSSL::ASN1.decode will decode ASN.1 INTEGER values into a Ruby's Integer instead of OpenSSL::BN. However it would be too late to change now. Anyway, if we change out mind, we will rewrite it to avoid unnecessary conversions between BIGNUM.
Diffstat (limited to 'ext')
-rw-r--r--ext/openssl/ossl_asn1.c37
1 files changed, 0 insertions, 37 deletions
diff --git a/ext/openssl/ossl_asn1.c b/ext/openssl/ossl_asn1.c
index c6cd71f4..2b8a85f0 100644
--- a/ext/openssl/ossl_asn1.c
+++ b/ext/openssl/ossl_asn1.c
@@ -110,16 +110,11 @@ asn1str_to_str(const ASN1_STRING *str)
/*
* ASN1_INTEGER conversions
- * TODO: Make a decision what's the right way to do this.
*/
-#define DO_IT_VIA_RUBY 0
VALUE
asn1integer_to_num(const ASN1_INTEGER *ai)
{
BIGNUM *bn;
-#if DO_IT_VIA_RUBY
- char *txt;
-#endif
VALUE num;
if (!ai) {
@@ -133,43 +128,12 @@ asn1integer_to_num(const ASN1_INTEGER *ai)
if (!bn)
ossl_raise(eOSSLError, NULL);
-#if DO_IT_VIA_RUBY
- if (!(txt = BN_bn2dec(bn))) {
- BN_free(bn);
- ossl_raise(eOSSLError, NULL);
- }
- num = rb_cstr_to_inum(txt, 10, Qtrue);
- OPENSSL_free(txt);
-#else
num = ossl_bn_new(bn);
-#endif
BN_free(bn);
return num;
}
-#if DO_IT_VIA_RUBY
-ASN1_INTEGER *
-num_to_asn1integer(VALUE obj, ASN1_INTEGER *ai)
-{
- BIGNUM *bn = NULL;
-
- if (RTEST(rb_obj_is_kind_of(obj, cBN))) {
- bn = GetBNPtr(obj);
- } else {
- obj = rb_String(obj);
- if (!BN_dec2bn(&bn, StringValueCStr(obj))) {
- ossl_raise(eOSSLError, NULL);
- }
- }
- if (!(ai = BN_to_ASN1_INTEGER(bn, ai))) {
- BN_free(bn);
- ossl_raise(eOSSLError, NULL);
- }
- BN_free(bn);
- return ai;
-}
-#else
ASN1_INTEGER *
num_to_asn1integer(VALUE obj, ASN1_INTEGER *ai)
{
@@ -185,7 +149,6 @@ num_to_asn1integer(VALUE obj, ASN1_INTEGER *ai)
return ai;
}
-#endif
/********/
/*