Skip to content

Commit e74e6da

Browse files
notrojclaude
andcommitted
mod_ssl: use ASN1_STRING accessor API in dump_extn_value:
* modules/ssl/ssl_engine_vars.c (dump_extn_value): Use ASN1_STRING_get0_data() and ASN1_STRING_length() rather than directly dereferencing the ASN1_OCTET_STRING structure, which is opaque in OpenSSL 4.0. * modules/ssl/ssl_private.h: Add compat macros for ASN1_STRING_get0_data and ASN1_STRING_length for pre-1.1 API. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 86b7cf2 commit e74e6da

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

modules/ssl/ssl_engine_vars.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1244,17 +1244,17 @@ void modssl_var_extract_san_entries(apr_table_t *t, SSL *ssl, apr_pool_t *p)
12441244
* success and writes the string to the given bio. */
12451245
static int dump_extn_value(BIO *bio, ASN1_OCTET_STRING *str)
12461246
{
1247-
const unsigned char *pp = str->data;
1247+
const unsigned char *pp = ASN1_STRING_get0_data(str);
12481248
ASN1_STRING *ret = ASN1_STRING_new();
12491249
int rv = 0;
12501250

1251-
if(!ret) {
1252-
return rv;
1251+
if (!ret) {
1252+
return rv;
12531253
}
12541254

12551255
/* This allows UTF8String, IA5String, VisibleString, or BMPString;
12561256
* conversion to UTF-8 is forced. */
1257-
if (d2i_DISPLAYTEXT(&ret, &pp, str->length)) {
1257+
if (d2i_DISPLAYTEXT(&ret, &pp, ASN1_STRING_length(str))) {
12581258
ASN1_STRING_print_ex(bio, ret, ASN1_STRFLGS_UTF8_CONVERT);
12591259
rv = 1;
12601260
}

modules/ssl/ssl_private.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,8 @@
282282
#define DH_bits(x) (BN_num_bits(x->p))
283283
#define X509_up_ref(x) (CRYPTO_add(&(x)->references, +1, CRYPTO_LOCK_X509))
284284
#define EVP_PKEY_up_ref(pk) (CRYPTO_add(&(pk)->references, +1, CRYPTO_LOCK_EVP_PKEY))
285+
#define ASN1_STRING_get0_data(x) ((x)->data)
286+
#define ASN1_STRING_length(x) ((int)(x)->length)
285287
#else
286288
void init_bio_methods(void);
287289
void free_bio_methods(void);

0 commit comments

Comments
 (0)