Skip to content

Commit 3742624

Browse files
committed
Convert ossl_ocsp.c to opaque ASN1_STRING
OpenSSL plans to make asn1_string_st opaque, the struct underlying most ASN.1 types such as ASN1_*STRING, ASN1_ENUMERATED, ASN1_INTEGER, etc. Most of ruby/openssl's C code can be straigtforwardly converted to use accessors available since OpenSS
1 parent 970d576 commit 3742624

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ext/openssl/ossl_ocsp.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,8 +1550,9 @@ ossl_ocspcid_get_issuer_name_hash(VALUE self)
15501550
GetOCSPCertId(self, id);
15511551
OCSP_id_get0_info(&name_hash, NULL, NULL, NULL, id);
15521552

1553-
ret = rb_str_new(NULL, name_hash->length * 2);
1554-
ossl_bin2hex(name_hash->data, RSTRING_PTR(ret), name_hash->length);
1553+
ret = rb_str_new(NULL, ASN1_STRING_length(name_hash) * 2);
1554+
ossl_bin2hex(ASN1_STRING_get0_data(name_hash), RSTRING_PTR(ret),
1555+
ASN1_STRING_length(name_hash));
15551556

15561557
return ret;
15571558
}
@@ -1573,8 +1574,9 @@ ossl_ocspcid_get_issuer_key_hash(VALUE self)
15731574
GetOCSPCertId(self, id);
15741575
OCSP_id_get0_info(NULL, NULL, &key_hash, NULL, id);
15751576

1576-
ret = rb_str_new(NULL, key_hash->length * 2);
1577-
ossl_bin2hex(key_hash->data, RSTRING_PTR(ret), key_hash->length);
1577+
ret = rb_str_new(NULL, ASN1_STRING_length(key_hash) * 2);
1578+
ossl_bin2hex(ASN1_STRING_get0_data(key_hash), RSTRING_PTR(ret),
1579+
ASN1_STRING_length(key_hash));
15781580

15791581
return ret;
15801582
}

0 commit comments

Comments
 (0)