From 66adaf2b31bb51e00ffad784f60bdf195e5dd736 Mon Sep 17 00:00:00 2001 From: "Dr. David von Oheimb" Date: Thu, 14 Dec 2023 12:48:33 +0100 Subject: [PATCH] X509_dup.pod: add caveat that extra data is not copied and hints, e.g., to use X509_up_ref() instead Reviewed-by: Tom Cosgrove Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/23043) --- doc/man3/X509_dup.pod | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/man3/X509_dup.pod b/doc/man3/X509_dup.pod index 9e70ffea13c60..c6206e1759093 100644 --- a/doc/man3/X509_dup.pod +++ b/doc/man3/X509_dup.pod @@ -359,6 +359,15 @@ algorithms from providers. This created object can then be used when loading binary data using B>(). B_dup>() copies an existing object, leaving it untouched. +Note, however, that the internal representation of the object +may contain (besides the ASN.1 structure) further data, which is not copied. +For instance, an B object usually is augmented by cached information +on X.509v3 extensions, etc., and losing it can lead to wrong validation results. +To avoid such situations, better use B_up_ref>() if available. +For the case of B objects, an alternative to using L +may be to still call B_dup>(), e.g., I, +followed by I, +which re-builds the cached data. B_free>() releases the object and all pointers and sub-objects within it. @@ -376,6 +385,10 @@ the object or NULL on failure. B_print_ctx>() returns 1 on success or zero on failure. +=head1 SEE ALSO + +L + =head1 HISTORY The functions X509_REQ_new_ex(), X509_CRL_new_ex(), PKCS7_new_ex() and