修复OpenSSL 3.6 X509_get_subject_name返回值类型变更兼容问题

This commit is contained in:
xiongziliang
2026-10-13 14:49:18 +08:00
parent 08329b39bf
commit bb83e697a6
2 changed files with 15 additions and 8 deletions

View File

@@ -244,7 +244,9 @@ namespace RTC
}
// Set certificate fields.
certName = X509_get_subject_name(certificate);
// OpenSSL 3.6+ 声明为 `const X509_NAME *X509_get_subject_name(const X509 *)`,
// 旧版本返回 `X509_NAME *`;用 const_cast 兼容两种签名(certificate 非 const,去 const 是安全的)。
certName = const_cast<X509_NAME*>(X509_get_subject_name(certificate));
if (!certName)
{