Commit ec6a52168c for asterisk.org
commit ec6a52168ca50077f9853f6efc3ce2ad33bb2d30
Author: Naveen Albert <asterisk@phreaknet.org>
Date: Wed Dec 2 19:52:17 2026 -0500
res_stir_shaken: Avoid deprecated ASN1_STRING_length in >= OpenSSL 4.1.
ASN1_STRING_length is deprecated starting in OpenSSL 4.1;
ASN1_STRING_get_length should be used instead.
Resolves: #2370
diff --git a/res/res_stir_shaken/verification.c b/res/res_stir_shaken/verification.c
index 43072e90ad..4a8c42a40e 100644
--- a/res/res_stir_shaken/verification.c
+++ b/res/res_stir_shaken/verification.c
@@ -269,7 +269,11 @@ static enum ast_stir_shaken_vs_response_code
octet_str_data = ASN1_STRING_get0_data(tn_exten);
/* The first call to ASN1_get_object should return a SEQUENCE */
+#if (OPENSSL_VERSION_NUMBER >= 0x040100000)
+ ret = ASN1_get_object(&octet_str_data, &xlen, &tag, &xclass, ASN1_STRING_get_length(tn_exten));
+#else
ret = ASN1_get_object(&octet_str_data, &xlen, &tag, &xclass, ASN1_STRING_length(tn_exten));
+#endif
if (IS_GET_OBJ_ERR(ret)) {
crypto_log_openssl(LOG_ERROR, "%s: Cert '%s' has malformed TNAuthList extension\n",
ctx->tag, ctx->public_url);
@@ -293,7 +297,11 @@ static enum ast_stir_shaken_vs_response_code
* ATIS-1000080 however limits this to only ASN1_TAG_TNAUTH_SPC
*
*/
+#if (OPENSSL_VERSION_NUMBER >= 0x040100000)
+ ret = ASN1_get_object(&octet_str_data, &xlen, &tag, &xclass, ASN1_STRING_get_length(tn_exten));
+#else
ret = ASN1_get_object(&octet_str_data, &xlen, &tag, &xclass, ASN1_STRING_length(tn_exten));
+#endif
if (IS_GET_OBJ_ERR(ret)) {
crypto_log_openssl(LOG_ERROR, "%s: Cert '%s' has malformed TNAuthList extension\n",
ctx->tag, ctx->public_url);
@@ -307,7 +315,11 @@ static enum ast_stir_shaken_vs_response_code
}
/* The third call to ASN1_get_object should contain the SPC */
+#if (OPENSSL_VERSION_NUMBER >= 0x040100000)
+ ret = ASN1_get_object(&octet_str_data, &xlen, &tag, &xclass, ASN1_STRING_get_length(tn_exten));
+#else
ret = ASN1_get_object(&octet_str_data, &xlen, &tag, &xclass, ASN1_STRING_length(tn_exten));
+#endif
if (ret != 0) {
SCOPE_EXIT_LOG_RTN_VALUE(AST_STIR_SHAKEN_VS_CERT_NO_SPC_IN_TN_AUTH_EXT,
LOG_ERROR, "%s: Cert '%s' has malformed TNAuthList extension (no SPC)\n",