Skip to content

Commit ba3d1cc

Browse files
committed
Convert some of ossl_asn1.c to opaque ASN1_STRING
This uses the normal accessors but leaves out BIT STRINGS, which will need compat implementations for ASN1_BIT_STRING_get_length() and ASN1_BIT_STRING_set1() for older libcryptos. openssl/openssl#29184 openssl/openssl#29185
1 parent 3742624 commit ba3d1cc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ext/openssl/ossl_asn1.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ ossl_time_split(VALUE time, time_t *sec, int *days)
114114
VALUE
115115
asn1str_to_str(const ASN1_STRING *str)
116116
{
117-
return rb_str_new((const char *)str->data, str->length);
117+
return rb_str_new((const char *)ASN1_STRING_get0_data(str),
118+
ASN1_STRING_length(str));
118119
}
119120

120121
/*
@@ -129,7 +130,7 @@ asn1integer_to_num(const ASN1_INTEGER *ai)
129130
if (!ai) {
130131
ossl_raise(rb_eTypeError, "ASN1_INTEGER is NULL!");
131132
}
132-
if (ai->type == V_ASN1_ENUMERATED)
133+
if (ASN1_STRING_type(ai) == V_ASN1_ENUMERATED)
133134
/* const_cast: workaround for old OpenSSL */
134135
bn = ASN1_ENUMERATED_to_BN((ASN1_ENUMERATED *)ai, NULL);
135136
else

0 commit comments

Comments
 (0)