Fix safestack issues in pkcs7.h
authorMatt Caswell <matt@openssl.org>
Thu, 3 Sep 2020 14:20:03 +0000 (15:20 +0100)
committerMatt Caswell <matt@openssl.org>
Sun, 13 Sep 2020 10:10:41 +0000 (11:10 +0100)
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12781)

12 files changed:
.gitignore
apps/pkcs12.c
build.info
crypto/pkcs12/p12_crt.c
crypto/pkcs12/p12_kiss.c
crypto/pkcs12/p12_npas.c
crypto/pkcs7/pk7_doit.c
crypto/pkcs7/pk7_lib.c
crypto/pkcs7/pk7_smime.c
crypto/ts/ts_rsp_verify.c
include/openssl/pkcs7.h.in [moved from include/openssl/pkcs7.h with 98% similarity]
test/pkcs12_helper.c

index 6d6850c104b0b5d4380fc4d58bd41a437316b370..263a748e3a7bc97b6660938a7f34c82226392b81 100644 (file)
@@ -29,6 +29,7 @@
 /include/openssl/fipskey.h
 /include/openssl/ocsp.h
 /include/openssl/opensslv.h
+/include/openssl/pkcs7.h
 /include/openssl/safestack.h
 /include/openssl/ssl.h
 /include/openssl/x509.h
index dd08b96ff83a8ed37531347546a3f15564457384..fd626d9d0570df03372ca8dda420c8fdaa004efe 100644 (file)
@@ -20,7 +20,6 @@
 #include <openssl/pkcs12.h>
 #include <openssl/provider.h>
 
-DEFINE_STACK_OF(PKCS7)
 DEFINE_STACK_OF(PKCS12_SAFEBAG)
 
 #define NOKEYS          0x1
index 406ce29af072ee5143fea24b337283a6daeabc43..876135a6c7b86dcd972863f6c16a5225a5582753 100644 (file)
@@ -20,6 +20,7 @@ DEPEND[]=include/openssl/asn1.h \
          include/openssl/fipskey.h \
          include/openssl/opensslv.h \
          include/openssl/ocsp.h \
+         include/openssl/pkcs7.h \
          include/openssl/safestack.h \
          include/openssl/ssl.h \
          include/openssl/x509.h \
@@ -34,6 +35,7 @@ GENERATE[include/openssl/cms.h]=include/openssl/cms.h.in
 GENERATE[include/openssl/fipskey.h]=include/openssl/fipskey.h.in
 GENERATE[include/openssl/ocsp.h]=include/openssl/ocsp.h.in
 GENERATE[include/openssl/opensslv.h]=include/openssl/opensslv.h.in
+GENERATE[include/openssl/pkcs7.h]=include/openssl/pkcs7.h.in
 GENERATE[include/openssl/safestack.h]=include/openssl/safestack.h.in
 GENERATE[include/openssl/ssl.h]=include/openssl/ssl.h.in
 GENERATE[include/openssl/x509.h]=include/openssl/x509.h.in
index 757b6ae63148d5b447585eade798b7840ce864d1..d673c8b293c500c1cc28145c1a5048da7242c8e5 100644 (file)
@@ -12,7 +12,6 @@
 #include <openssl/pkcs12.h>
 #include "p12_local.h"
 
-DEFINE_STACK_OF(PKCS7)
 DEFINE_STACK_OF(PKCS12_SAFEBAG)
 
 static int pkcs12_add_bag(STACK_OF(PKCS12_SAFEBAG) **pbags,
index 433bccdb30fb6b8e685f3c97af6f331e2902ee41..a43091380cb0c2815133162991c39ffadc57d4f0 100644 (file)
@@ -12,7 +12,6 @@
 #include <openssl/pkcs12.h>
 #include "crypto/x509.h" /* for X509_add_cert_new() */
 
-DEFINE_STACK_OF(PKCS7)
 DEFINE_STACK_OF(PKCS12_SAFEBAG)
 
 /* Simplified PKCS#12 routines */
index a83d745bd50977ad9c7a93bb0241c6210450d99a..99e21489adb69f752fddd395fb91b881a30b880b 100644 (file)
@@ -15,7 +15,6 @@
 #include <openssl/pkcs12.h>
 #include "p12_local.h"
 
-DEFINE_STACK_OF(PKCS7)
 DEFINE_STACK_OF(PKCS12_SAFEBAG)
 
 /* PKCS#12 password change routine */
index 8362d77b7eac801861dfac325b72d9d8184d407e..bc9bfd8589da441807888526439b56ee8ae1078d 100644 (file)
@@ -16,9 +16,6 @@
 #include <openssl/err.h>
 #include "pk7_local.h"
 
-DEFINE_STACK_OF(PKCS7_RECIP_INFO)
-DEFINE_STACK_OF(PKCS7_SIGNER_INFO)
-
 static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype,
                          void *value);
 static ASN1_TYPE *get_attribute(STACK_OF(X509_ATTRIBUTE) *sk, int nid);
index e169783e52016106faae2e1a6f9d47906feec2dc..8f92424ad75ccbc95231e0a0b12063f9c7bf8c0a 100644 (file)
@@ -16,9 +16,6 @@
 #include "crypto/x509.h" /* for sk_X509_add1_cert() */
 #include "pk7_local.h"
 
-DEFINE_STACK_OF(PKCS7_RECIP_INFO)
-DEFINE_STACK_OF(PKCS7_SIGNER_INFO)
-
 long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg)
 {
     int nid;
index de8c0568dbaa899145c89971d225aa3d153209a7..3347544bb8a6560f1e2388cdcf8d13439f22f396 100644 (file)
@@ -17,7 +17,6 @@
 
 #define BUFFERSIZE 4096
 
-DEFINE_STACK_OF(PKCS7_SIGNER_INFO)
 
 static int pkcs7_copy_existing_digest(PKCS7 *p7, PKCS7_SIGNER_INFO *si);
 
index 0077798c43e861494c48a59349b52c33eebf8ed1..cec15bd09404560aa624b80d411340c938624e83 100644 (file)
@@ -15,7 +15,6 @@
 #include "ts_local.h"
 #include "crypto/ess.h"
 
-DEFINE_STACK_OF(PKCS7_SIGNER_INFO)
 DEFINE_STACK_OF(ESS_CERT_ID)
 DEFINE_STACK_OF(ESS_CERT_ID_V2)
 
similarity index 98%
rename from include/openssl/pkcs7.h
rename to include/openssl/pkcs7.h.in
index f4b75cca36b3140d20a46cf12db236b956a3bd55..93e1f9dbef31d8fc79bc89451e0006ec47a62ce1 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * {- join("\n * ", @autowarntext) -}
+ *
  * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
@@ -7,6 +9,10 @@
  * https://www.openssl.org/source/license.html
  */
 
+{-
+use OpenSSL::stackhash qw(generate_stack_macros);
+-}
+
 #ifndef OPENSSL_PKCS7_H
 # define OPENSSL_PKCS7_H
 # pragma once
@@ -58,7 +64,9 @@ typedef struct pkcs7_signer_info_st {
     EVP_PKEY *pkey;
     const PKCS7_CTX *ctx;
 } PKCS7_SIGNER_INFO;
-DEFINE_OR_DECLARE_STACK_OF(PKCS7_SIGNER_INFO)
+{-
+    generate_stack_macros("PKCS7_SIGNER_INFO");
+-}
 
 typedef struct pkcs7_recip_info_st {
     ASN1_INTEGER *version;      /* version 0 */
@@ -68,7 +76,9 @@ typedef struct pkcs7_recip_info_st {
     X509 *cert;                 /* get the pub-key from this */
     const PKCS7_CTX *ctx;
 } PKCS7_RECIP_INFO;
-DEFINE_OR_DECLARE_STACK_OF(PKCS7_RECIP_INFO)
+{-
+    generate_stack_macros("PKCS7_RECIP_INFO");
+-}
 
 
 typedef struct pkcs7_signed_st {
@@ -157,7 +167,9 @@ typedef struct pkcs7_st {
     } d;
     PKCS7_CTX ctx;
 } PKCS7;
-DEFINE_OR_DECLARE_STACK_OF(PKCS7)
+{-
+    generate_stack_macros("PKCS7");
+-}
 
 
 # define PKCS7_OP_SET_DETACHED_SIGNATURE 1
index a3490e74e3032da8c5a9969083b3c7ee3e4d43d2..d3b7a63917659db5c3fcbdbe7fd064a9af044490 100644 (file)
@@ -21,7 +21,6 @@
 #include "testutil.h"
 #include "pkcs12_helper.h"
 
-DEFINE_STACK_OF(PKCS7)
 DEFINE_STACK_OF(PKCS12_SAFEBAG)
 
 /* Set this to > 0 write test data to file */