]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix safestack issues in cmp.h
authorMatt Caswell <matt@openssl.org>
Thu, 3 Sep 2020 13:45:54 +0000 (14:45 +0100)
committerMatt Caswell <matt@openssl.org>
Sun, 13 Sep 2020 10:10:40 +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)

16 files changed:
.gitignore
apps/cmp.c
apps/cmp_mock_srv.c
build.info
crypto/cmp/cmp_asn.c
crypto/cmp/cmp_client.c
crypto/cmp/cmp_ctx.c
crypto/cmp/cmp_hdr.c
crypto/cmp/cmp_msg.c
crypto/cmp/cmp_server.c
fuzz/cmp.c
include/openssl/cmp.h.in [moved from include/openssl/cmp.h with 98% similarity]
test/cmp_client_test.c
test/cmp_ctx_test.c
test/cmp_hdr_test.c
test/cmp_msg_test.c

index 0565a0c3d3305bc80085bd99ad917baef11ff234..edf56c7f3fa5829f1927e71a99bc7bd788358e3e 100644 (file)
@@ -23,6 +23,7 @@
 /crypto/buildinf.h
 /include/crypto/*_conf.h
 /include/openssl/asn1.h
+/include/openssl/cmp.h
 /include/openssl/configuration.h
 /include/openssl/fipskey.h
 /include/openssl/opensslv.h
index 4d77b541c417b32f67bf57700054bf5eaced11cc..083425c08f457e5024d6f001901bb1eb2ef90f7e 100644 (file)
@@ -42,8 +42,6 @@
 #include <openssl/objects.h>
 #include <openssl/x509.h>
 
-DEFINE_STACK_OF(OSSL_CMP_ITAV)
-
 static char *opt_config = NULL;
 #define CMP_SECTION "cmp"
 #define SECTION_NAME_MAX 40 /* max length of section name */
index 89db709f9468117960846eeef88f876885ef1ed5..057f9d9a5e0a1c9257a625905cc220f9fd16dd5a 100644 (file)
@@ -14,8 +14,6 @@
 #include <openssl/cmp.h>
 #include <openssl/err.h>
 #include <openssl/cmperr.h>
-
-DEFINE_STACK_OF(OSSL_CMP_ITAV)
  
 /* the context for the CMP mock server */
 typedef struct
index 33022e8bb30b61c0aa42b29e3a68f04f7e5a113d..97b882af7f73bf1a55d576ed361fef464a1ef58d 100644 (file)
@@ -14,6 +14,7 @@ DEPEND[libssl]=libcrypto
 # Empty DEPEND "indices" means the dependencies are expected to be built
 # unconditionally before anything else.
 DEPEND[]=include/openssl/asn1.h \
+         include/openssl/cmp.h \
          include/openssl/configuration.h \
          include/openssl/fipskey.h \
          include/openssl/opensslv.h \
@@ -26,6 +27,7 @@ DEPEND[]=include/openssl/asn1.h \
 
 GENERATE[include/openssl/asn1.h]=include/openssl/asn1.h.in
 GENERATE[include/openssl/configuration.h]=include/openssl/configuration.h.in
+GENERATE[include/openssl/cmp.h]=include/openssl/cmp.h.in
 GENERATE[include/openssl/fipskey.h]=include/openssl/fipskey.h.in
 GENERATE[include/openssl/opensslv.h]=include/openssl/opensslv.h.in
 GENERATE[include/openssl/safestack.h]=include/openssl/safestack.h.in
index f109af0502f2284a841672e945fe9577fbe59482..d9013911a07d743e748b7aa81387aeaa0164b946 100644 (file)
@@ -17,8 +17,6 @@
 #include <openssl/cmp.h>
 #include <openssl/crmf.h>
 
-DEFINE_STACK_OF(OSSL_CMP_ITAV)
-
 /* ASN.1 declarations from RFC4210 */
 ASN1_SEQUENCE(OSSL_CMP_REVANNCONTENT) = {
     /* OSSL_CMP_PKISTATUS is effectively ASN1_INTEGER so it is used directly */
index 3889d63fcdbeb638f930018972a46fdf43701db0..ad34b978c7c3a162a5bda9ff065879543c42f589 100644 (file)
@@ -21,8 +21,6 @@
 
 #include "openssl/cmp_util.h"
 
-DEFINE_STACK_OF(OSSL_CMP_CERTRESPONSE)
-DEFINE_STACK_OF(OSSL_CMP_PKISI)
 DEFINE_STACK_OF(OSSL_CRMF_CERTID)
 
 #define IS_CREP(t) ((t) == OSSL_CMP_PKIBODY_IP || (t) == OSSL_CMP_PKIBODY_CP \
index fdbd90a0766e607c915e36ae36bf5b095e0d2808..d960167bc03e12ca4fab0a1511302b6ef4feffde 100644 (file)
@@ -21,8 +21,6 @@
 #include <openssl/crmf.h>
 #include <openssl/err.h>
 
-DEFINE_STACK_OF(OSSL_CMP_ITAV)
-
 /*
  * Get current certificate store containing trusted root CA certs
  */
index 2691fce1b501bfdbd6880952852467f8c924d676..947f9845050283369d92feca0891b976076b6d72 100644 (file)
@@ -20,8 +20,6 @@
 #include <openssl/cmp.h>
 #include <openssl/err.h>
 
-DEFINE_STACK_OF(OSSL_CMP_ITAV)
-
 int ossl_cmp_hdr_set_pvno(OSSL_CMP_PKIHEADER *hdr, int pvno)
 {
     if (!ossl_assert(hdr != NULL))
index c11fe4ca93145412ee8640e1dd35ed6404d5588b..73246ffaee5d51c08ad7558657c9efda8f38c162 100644 (file)
 #include <openssl/x509.h>
 #include "crypto/x509.h" /* for x509_set0_libctx() */
 
-DEFINE_STACK_OF(OSSL_CMP_CERTSTATUS)
-DEFINE_STACK_OF(OSSL_CMP_ITAV)
-DEFINE_STACK_OF(OSSL_CMP_PKISI)
 DEFINE_STACK_OF(OSSL_CRMF_MSG)
-DEFINE_STACK_OF(OSSL_CMP_CERTRESPONSE)
 DEFINE_STACK_OF(OSSL_CRMF_CERTID)
 
 OSSL_CMP_PKIHEADER *OSSL_CMP_MSG_get0_header(const OSSL_CMP_MSG *msg)
index 3c247336fccb47180acc6a206ac53400369958e3..94aa9aac8b38b54b1da9e80eb864a8812ef8d1ba 100644 (file)
@@ -20,8 +20,6 @@
 #include <openssl/err.h>
 
 DEFINE_STACK_OF(OSSL_CRMF_MSG)
-DEFINE_STACK_OF(OSSL_CMP_ITAV)
-DEFINE_STACK_OF(OSSL_CMP_CERTSTATUS)
 
 /* the context for the generic CMP server */
 struct ossl_cmp_srv_ctx_st
index 44a0c1adebfb52a5a76b1096849aa14151e24540..a0dc20c61946c0eb7dfda110104a6a8ef94867be 100644 (file)
@@ -18,8 +18,6 @@
 #include "fuzzer.h"
 #include "rand.inc"
 
-DEFINE_STACK_OF(OSSL_CMP_ITAV)
-
 int FuzzerInitialize(int *argc, char ***argv)
 {
     OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL);
similarity index 98%
rename from include/openssl/cmp.h
rename to include/openssl/cmp.h.in
index 9fc281a705c6659e8b3d778349aa0a10b212d1f9..0df3777e3c913aa2d31b186928552c5f0e009a7b 100644 (file)
@@ -1,4 +1,6 @@
 /*
+ * {- join("\n * ", @autowarntext) -}
+ *
  * Copyright 2007-2020 The OpenSSL Project Authors. All Rights Reserved.
  * Copyright Nokia 2007-2019
  * Copyright Siemens AG 2015-2019
@@ -9,6 +11,10 @@
  * https://www.openssl.org/source/license.html
  */
 
+{-
+use OpenSSL::stackhash qw(generate_stack_macros);
+-}
+
 #ifndef OPENSSL_CMP_H
 # define OPENSSL_CMP_H
 
@@ -210,21 +216,31 @@ typedef struct ossl_cmp_msg_st OSSL_CMP_MSG;
 DECLARE_ASN1_DUP_FUNCTION(OSSL_CMP_MSG)
 DECLARE_ASN1_ENCODE_FUNCTIONS(OSSL_CMP_MSG, OSSL_CMP_MSG, OSSL_CMP_MSG)
 typedef struct ossl_cmp_certstatus_st OSSL_CMP_CERTSTATUS;
-DEFINE_OR_DECLARE_STACK_OF(OSSL_CMP_CERTSTATUS)
+{-
+    generate_stack_macros("OSSL_CMP_CERTSTATUS");
+-}
 typedef struct ossl_cmp_itav_st OSSL_CMP_ITAV;
 DECLARE_ASN1_DUP_FUNCTION(OSSL_CMP_ITAV)
-DEFINE_OR_DECLARE_STACK_OF(OSSL_CMP_ITAV)
+{-
+    generate_stack_macros("OSSL_CMP_ITAV");
+-}
 typedef struct ossl_cmp_revrepcontent_st OSSL_CMP_REVREPCONTENT;
 typedef struct ossl_cmp_pkisi_st OSSL_CMP_PKISI;
 DECLARE_ASN1_FUNCTIONS(OSSL_CMP_PKISI)
 DECLARE_ASN1_DUP_FUNCTION(OSSL_CMP_PKISI)
-DEFINE_OR_DECLARE_STACK_OF(OSSL_CMP_PKISI)
+{-
+    generate_stack_macros("OSSL_CMP_PKISI");
+-}
 typedef struct ossl_cmp_certrepmessage_st OSSL_CMP_CERTREPMESSAGE;
-DEFINE_OR_DECLARE_STACK_OF(OSSL_CMP_CERTREPMESSAGE)
+{-
+    generate_stack_macros("OSSL_CMP_CERTREPMESSAGE");
+-}
 typedef struct ossl_cmp_pollrep_st OSSL_CMP_POLLREP;
 typedef STACK_OF(OSSL_CMP_POLLREP) OSSL_CMP_POLLREPCONTENT;
 typedef struct ossl_cmp_certresponse_st OSSL_CMP_CERTRESPONSE;
-DEFINE_OR_DECLARE_STACK_OF(OSSL_CMP_CERTRESPONSE)
+{-
+    generate_stack_macros("OSSL_CMP_CERTRESPONSE");
+-}
 typedef STACK_OF(ASN1_UTF8STRING) OSSL_CMP_PKIFREETEXT;
 
 /*
index 9c72c58ad367dbfc938f12e970818ebe308e9caf..169f63a82273c5b6c18156676680552891a08ccf 100644 (file)
@@ -15,8 +15,6 @@
 
 #ifndef NDEBUG /* tests need mock server, which is available only if !NDEBUG */
 
-DEFINE_STACK_OF(OSSL_CMP_ITAV)
-
 static const char *server_key_f;
 static const char *server_cert_f;
 static const char *client_key_f;
index 58c3fc85f797a548ebbc3a9ec2d4963dfba7a382..72972fbaca47e25d5838532779d388675d6ebaa3 100644 (file)
@@ -13,8 +13,6 @@
 
 #include <openssl/x509_vfy.h>
 
-DEFINE_STACK_OF(OSSL_CMP_ITAV)
-
 typedef struct test_fixture {
     const char *test_case_name;
     OSSL_CMP_CTX *ctx;
index 344df43fea9593240e6943c87b7d3f1f7370670f..75baefb7b98082829a3c049255a25bb4ab918588 100644 (file)
@@ -11,8 +11,6 @@
 
 #include "cmp_testlib.h"
 
-DEFINE_STACK_OF(OSSL_CMP_ITAV)
-
 static unsigned char rand_data[OSSL_CMP_TRANSACTIONID_LENGTH];
 
 typedef struct test_fixture {
index a593f37cfce021e5fe2a23a9409668f8d330c376..3a0db7ece30bb0768dbd1dffc53b645a594443f0 100644 (file)
@@ -11,8 +11,6 @@
 
 #include "cmp_testlib.h"
 
-DEFINE_STACK_OF(OSSL_CMP_CERTRESPONSE)
-
 static const char *newkey_f;
 static const char *server_cert_f;
 static const char *pkcs10_f;