]> git.ipfire.org Git - thirdparty/openssl.git/commit
Make X509_ATTRIBUTE accessor functions const-correct
authorkovan <xaum.io@gmail.com>
Wed, 28 Jan 2026 01:22:21 +0000 (02:22 +0100)
committerTomas Mraz <tomas@openssl.org>
Fri, 13 Feb 2026 14:45:37 +0000 (15:45 +0100)
commit0c841cd5aac5c9ee0c135689e131cd58c3fcea5d
tree08199dc8da8855106925a8ad8c8716637473e7c7
parent4eb8a222c9ecac52556060c645c3b7eb3178968d
Make X509_ATTRIBUTE accessor functions const-correct

The X509_ATTRIBUTE accessor functions were not const-correct, preventing
callers from usefully interacting with a const X509_ATTRIBUTE pointer.

Update the following functions to accept const X509_ATTRIBUTE * and
return const pointers where appropriate:

- X509_ATTRIBUTE_get0_object: returns const ASN1_OBJECT *
- X509_ATTRIBUTE_get0_type: returns const ASN1_TYPE *
- X509_ATTRIBUTE_get0_data: returns const void *

Also update dependent PKCS12 functions:
- PKCS12_get_attr_gen: returns const ASN1_TYPE *
- PKCS12_get_attr: returns const ASN1_TYPE * (deprecated)
- PKCS8_get_attr: returns const ASN1_TYPE *

Update all callers to use const pointers for the return values.

Fixes #29811

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
Reviewed-by: David von Oheimb <david.von.oheimb@siemens.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
MergeDate: Fri Feb 13 14:46:26 2026
(Merged from https://github.com/openssl/openssl/pull/29813)
15 files changed:
apps/pkcs12.c
crypto/pkcs12/p12_attr.c
crypto/pkcs12/p12_sbag.c
crypto/x509/t_acert.c
crypto/x509/t_req.c
crypto/x509/v3_aaa.c
crypto/x509/v3_sda.c
crypto/x509/x509_att.c
crypto/x509/x509_req.c
demos/cms/cms_ver.c
doc/man3/PKCS12_SAFEBAG_get0_attrs.pod
doc/man3/X509_ATTRIBUTE.pod
include/openssl/pkcs12.h.in
include/openssl/x509.h.in
test/helpers/pkcs12.c