Don't overwrite signing time.
authorDr. Stephen Henson <steve@openssl.org>
Fri, 7 Dec 2001 00:36:32 +0000 (00:36 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Fri, 7 Dec 2001 00:36:32 +0000 (00:36 +0000)
CHANGES
crypto/pkcs7/pk7_doit.c

diff --git a/CHANGES b/CHANGES
index ceceb0e03bd23981eeb5c2a741ceb9d192c418f0..1c9c7fd35c04544351d4b976111b101a1e645fbb 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -12,6 +12,9 @@
          *) applies to 0.9.6a/0.9.6b/0.9.6c and 0.9.7
          +) applies to 0.9.7 only
 
+  *) Only add signing time to PKCS7 structures if it is not already present.
+     [Steve Henson]
+
   *) Fix crypto/objects/objects.h: "ld-ce" should be "id-ce",
      OBJ_ld_ce should be OBJ_id_ce.
      Also some ip-pda OIDs in crypto/objects/objects.txt were
index 5b803b0266fa5a9a9aef9104bb9891ed87dd7b22..fce4a841a66bbeddddb084fcc915c26715dcb621 100644 (file)
@@ -557,11 +557,15 @@ int PKCS7_dataFinal(PKCS7 *p7, BIO *bio)
                                ASN1_UTCTIME *sign_time;
                                const EVP_MD *md_tmp;
 
-                               /* Add signing time */
-                               sign_time=X509_gmtime_adj(NULL,0);
-                               PKCS7_add_signed_attribute(si,
-                                       NID_pkcs9_signingTime,
-                                       V_ASN1_UTCTIME,sign_time);
+                               /* Add signing time if not already present */
+                               if (!PKCS7_get_signed_attribute(si,
+                                                       NID_pkcs9_signingTime))
+                                       {
+                                       sign_time=X509_gmtime_adj(NULL,0);
+                                       PKCS7_add_signed_attribute(si,
+                                               NID_pkcs9_signingTime,
+                                               V_ASN1_UTCTIME,sign_time);
+                                       }
 
                                /* Add digest */
                                md_tmp=EVP_MD_CTX_md(&ctx_tmp);