d2i_X509: revert calling X509v3_cache_extensions()
authorDr. David von Oheimb <David.von.Oheimb@siemens.com>
Thu, 10 Jun 2021 17:36:35 +0000 (19:36 +0200)
committerDr. David von Oheimb <dev@ddvo.net>
Sat, 12 Jun 2021 08:37:04 +0000 (10:37 +0200)
Fixes #13754

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15705)

crypto/x509/x_x509.c

index 260bfda6830d01ca2eb097f0da67cfcc9f8c5208..d14de0e77e8978d85ace4f228f851ca9a4e88ff4 100644 (file)
@@ -150,32 +150,9 @@ ASN1_SEQUENCE_ref(X509, x509_cb) = {
         ASN1_EMBED(X509, signature, ASN1_BIT_STRING)
 } ASN1_SEQUENCE_END_ref(X509, X509)
 
-IMPLEMENT_ASN1_ALLOC_FUNCTIONS_fname(X509, X509, X509)
+IMPLEMENT_ASN1_FUNCTIONS(X509)
 IMPLEMENT_ASN1_DUP_FUNCTION(X509)
 
-X509 *d2i_X509(X509 **a, const unsigned char **in, long len)
-{
-    X509 *cert = NULL;
-    int free_on_error = a != NULL && *a == NULL;
-
-    cert = (X509 *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, (X509_it()));
-    /* Only cache the extensions if the cert object was passed in */
-    if (cert != NULL && a != NULL) { /* then cert == *a */
-        if (!ossl_x509v3_cache_extensions(cert)) {
-            if (free_on_error) {
-                *a = NULL;
-                X509_free(cert);
-            }
-            cert = NULL;
-        }
-    }
-    return cert;
-}
-int i2d_X509(const X509 *a, unsigned char **out)
-{
-    return ASN1_item_i2d((const ASN1_VALUE *)a, out, (X509_it()));
-}
-
 /*
  * This should only be used if the X509 object was embedded inside another
  * asn1 object and it needs a libctx to operate.