summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2020-09-03 15:45:01 +0100
committerMatt Caswell <matt@openssl.org>2020-09-13 11:10:41 +0100
commit98c35dc48d36664c404fec2e12ce405ac0fbecc0 (patch)
tree8bfc1804c0714c88410608ef3e48f7f01d3fdd92
parentc5a5581127c75fe9e9d56d42dd6bd95eb679729f (diff)
Fix safestack issues in crmf.h
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/12781)
-rw-r--r--.gitignore1
-rw-r--r--build.info4
-rw-r--r--crypto/cmp/cmp_client.c2
-rw-r--r--crypto/cmp/cmp_msg.c3
-rw-r--r--crypto/cmp/cmp_server.c2
-rw-r--r--crypto/crmf/crmf_lib.c2
-rw-r--r--crypto/crmf/crmf_local.h1
-rw-r--r--include/openssl/crmf.h.in (renamed from include/openssl/crmf.h)14
-rw-r--r--test/cmp_vfy_test.c1
9 files changed, 16 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore
index f228f23604..aca011b2c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,6 +26,7 @@
/include/openssl/cmp.h
/include/openssl/cms.h
/include/openssl/configuration.h
+/include/openssl/crmf.h
/include/openssl/fipskey.h
/include/openssl/ocsp.h
/include/openssl/opensslv.h
diff --git a/build.info b/build.info
index 669ccf4c3a..828918c6c6 100644
--- a/build.info
+++ b/build.info
@@ -17,6 +17,7 @@ DEPEND[]=include/openssl/asn1.h \
include/openssl/cmp.h \
include/openssl/cms.h \
include/openssl/configuration.h \
+ include/openssl/crmf.h \
include/openssl/fipskey.h \
include/openssl/opensslv.h \
include/openssl/ocsp.h \
@@ -31,9 +32,10 @@ DEPEND[]=include/openssl/asn1.h \
doc/man7/openssl_user_macros.pod
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/cms.h]=include/openssl/cms.h.in
+GENERATE[include/openssl/configuration.h]=include/openssl/configuration.h.in
+GENERATE[include/openssl/crmf.h]=include/openssl/crmf.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
diff --git a/crypto/cmp/cmp_client.c b/crypto/cmp/cmp_client.c
index ad34b978c7..ef256e6c72 100644
--- a/crypto/cmp/cmp_client.c
+++ b/crypto/cmp/cmp_client.c
@@ -21,8 +21,6 @@
#include "openssl/cmp_util.h"
-DEFINE_STACK_OF(OSSL_CRMF_CERTID)
-
#define IS_CREP(t) ((t) == OSSL_CMP_PKIBODY_IP || (t) == OSSL_CMP_PKIBODY_CP \
|| (t) == OSSL_CMP_PKIBODY_KUP)
diff --git a/crypto/cmp/cmp_msg.c b/crypto/cmp/cmp_msg.c
index 73246ffaee..5ff8e9fc52 100644
--- a/crypto/cmp/cmp_msg.c
+++ b/crypto/cmp/cmp_msg.c
@@ -21,9 +21,6 @@
#include <openssl/x509.h>
#include "crypto/x509.h" /* for x509_set0_libctx() */
-DEFINE_STACK_OF(OSSL_CRMF_MSG)
-DEFINE_STACK_OF(OSSL_CRMF_CERTID)
-
OSSL_CMP_PKIHEADER *OSSL_CMP_MSG_get0_header(const OSSL_CMP_MSG *msg)
{
if (msg == NULL) {
diff --git a/crypto/cmp/cmp_server.c b/crypto/cmp/cmp_server.c
index 94aa9aac8b..e9ddf496f2 100644
--- a/crypto/cmp/cmp_server.c
+++ b/crypto/cmp/cmp_server.c
@@ -19,8 +19,6 @@
#include <openssl/cmp.h>
#include <openssl/err.h>
-DEFINE_STACK_OF(OSSL_CRMF_MSG)
-
/* the context for the generic CMP server */
struct ossl_cmp_srv_ctx_st
{
diff --git a/crypto/crmf/crmf_lib.c b/crypto/crmf/crmf_lib.c
index 5c3acaf4b2..5a6cdb7e82 100644
--- a/crypto/crmf/crmf_lib.c
+++ b/crypto/crmf/crmf_lib.c
@@ -36,8 +36,6 @@
#include <openssl/err.h>
#include <openssl/evp.h>
-DEFINE_STACK_OF(OSSL_CRMF_MSG)
-
/*-
* atyp = Attribute Type
* valt = Value Type
diff --git a/crypto/crmf/crmf_local.h b/crypto/crmf/crmf_local.h
index b4d669875c..ee1ec7b07a 100644
--- a/crypto/crmf/crmf_local.h
+++ b/crypto/crmf/crmf_local.h
@@ -389,5 +389,4 @@ struct ossl_crmf_msg_st {
/* 1 */
STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) *regInfo;
} /* OSSL_CRMF_MSG */;
-/* DEFINE_STACK_OF(OSSL_CRMF_MSG) */
#endif
diff --git a/include/openssl/crmf.h b/include/openssl/crmf.h.in
index 022f0bb9d2..bc81bf591a 100644
--- a/include/openssl/crmf.h
+++ b/include/openssl/crmf.h.in
@@ -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
@@ -11,6 +13,10 @@
* CRMF (RFC 4211) implementation by M. Peylo, M. Viljanen, and D. von Oheimb.
*/
+{-
+use OpenSSL::stackhash qw(generate_stack_macros);
+-}
+
#ifndef OPENSSL_CRMF_H
# define OPENSSL_CRMF_H
@@ -44,7 +50,9 @@ DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_ENCRYPTEDVALUE)
typedef struct ossl_crmf_msg_st OSSL_CRMF_MSG;
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_MSG)
DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_MSG)
-DEFINE_OR_DECLARE_STACK_OF(OSSL_CRMF_MSG)
+{-
+ generate_stack_macros("OSSL_CRMF_MSG");
+-}
typedef struct ossl_crmf_attributetypeandvalue_st OSSL_CRMF_ATTRIBUTETYPEANDVALUE;
typedef struct ossl_crmf_pbmparameter_st OSSL_CRMF_PBMPARAMETER;
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PBMPARAMETER)
@@ -53,7 +61,9 @@ typedef struct ossl_crmf_certrequest_st OSSL_CRMF_CERTREQUEST;
typedef struct ossl_crmf_certid_st OSSL_CRMF_CERTID;
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_CERTID)
DECLARE_ASN1_DUP_FUNCTION(OSSL_CRMF_CERTID)
-DEFINE_OR_DECLARE_STACK_OF(OSSL_CRMF_CERTID)
+{-
+ generate_stack_macros("OSSL_CRMF_CERTID");
+-}
typedef struct ossl_crmf_pkipublicationinfo_st OSSL_CRMF_PKIPUBLICATIONINFO;
DECLARE_ASN1_FUNCTIONS(OSSL_CRMF_PKIPUBLICATIONINFO)
diff --git a/test/cmp_vfy_test.c b/test/cmp_vfy_test.c
index 93d57dd8bb..0559ec47c3 100644
--- a/test/cmp_vfy_test.c
+++ b/test/cmp_vfy_test.c
@@ -11,7 +11,6 @@
#include "cmp_testlib.h"
#include "../crypto/crmf/crmf_local.h" /* for manipulating POPO signature */
-DEFINE_STACK_OF(OSSL_CRMF_MSG)
static const char *server_f;
static const char *client_f;