openssl: Fix 'const' issues that came up with OpenSSL 4

This commit is contained in:
Tobias Brunner
2026-05-06 10:46:43 +02:00
parent 528e5f07c3
commit 374b17fe88
3 changed files with 21 additions and 6 deletions
@@ -287,14 +287,18 @@ chunk_t openssl_asn1_int2chunk(const ASN1_INTEGER *asn1)
/**
* Convert a X509 name to a ID_DER_ASN1_DN identification_t
*/
identification_t *openssl_x509_name2id(X509_NAME *name)
identification_t *openssl_x509_name2id(const X509_NAME *name)
{
if (name)
{
identification_t *id;
chunk_t chunk;
#if OPENSSL_VERSION_NUMBER < 0x30000000L
chunk = openssl_i2chunk(X509_NAME, (X509_NAME*)name);
#else
chunk = openssl_i2chunk(X509_NAME, name);
#endif
if (chunk.len)
{
id = identification_create_from_encoding(ID_DER_ASN1_DN, chunk);
@@ -326,15 +330,21 @@ int openssl_asn1_known_oid(const ASN1_OBJECT *obj)
time_t openssl_asn1_to_time(const ASN1_TIME *time)
{
chunk_t chunk;
int type;
if (time)
{
chunk = openssl_asn1_str2chunk(time);
switch (ASN1_STRING_type(time))
#if OPENSSL_VERSION_NUMBER < 0x30000000L
type = ASN1_STRING_type((ASN1_TIME*)time);
#else
type = ASN1_STRING_type(time);
#endif
switch (type)
{
case V_ASN1_UTCTIME:
case V_ASN1_GENERALIZEDTIME:
return asn1_to_time(&chunk, ASN1_STRING_type(time));
return asn1_to_time(&chunk, type);
default:
break;
}