summaryrefslogtreecommitdiff
path: root/crypto/asn1
diff options
context:
space:
mode:
authorRich Salz <rsalz@akamai.com>2019-12-19 17:30:24 -0500
committerTomas Mraz <tmraz@fedoraproject.org>2020-04-24 16:42:46 +0200
commit852c2ed260860b6b85c84f9fe96fb4d23d49c9f2 (patch)
treed8104686e0a02217c13f51e5d10d7434fa13e3dc /crypto/asn1
parent4692e98bdbaebb6f078e89a75c54395839e68b24 (diff)
downloadopenssl-new-852c2ed260860b6b85c84f9fe96fb4d23d49c9f2.tar.gz
In OpenSSL builds, declare STACK for datatypes ...
... and only *define* them in the source files that need them. Use DEFINE_OR_DECLARE which is set appropriately for internal builds and not non-deprecated builds. Deprecate stack-of-block Better documentation Move some ASN1 struct typedefs to types.h Update ParseC to handle this. Most of all, ParseC needed to be more consistent. The handlers are "recursive", in so far that they are called again and again until they terminate, which depends entirely on what the "massager" returns. There's a comment at the beginning of ParseC that explains how that works. {Richard Levtte} Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com> Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org> (Merged from https://github.com/openssl/openssl/pull/10669)
Diffstat (limited to 'crypto/asn1')
-rw-r--r--crypto/asn1/a_strnid.c2
-rw-r--r--crypto/asn1/asn1_gen.c3
-rw-r--r--crypto/asn1/asn1_lib.c2
-rw-r--r--crypto/asn1/asn_mime.c3
-rw-r--r--crypto/asn1/asn_moid.c2
-rw-r--r--crypto/asn1/asn_mstbl.c1
-rw-r--r--crypto/asn1/d2i_pr.c1
-rw-r--r--crypto/asn1/tasn_dec.c1
-rw-r--r--crypto/asn1/tasn_fre.c2
-rw-r--r--crypto/asn1/tasn_new.c2
10 files changed, 19 insertions, 0 deletions
diff --git a/crypto/asn1/a_strnid.c b/crypto/asn1/a_strnid.c
index ab54739714..518d408937 100644
--- a/crypto/asn1/a_strnid.c
+++ b/crypto/asn1/a_strnid.c
@@ -12,6 +12,8 @@
#include <openssl/asn1.h>
#include <openssl/objects.h>
+DEFINE_STACK_OF(ASN1_STRING_TABLE)
+
static STACK_OF(ASN1_STRING_TABLE) *stable = NULL;
static void st_free(ASN1_STRING_TABLE *tbl);
static int sk_table_cmp(const ASN1_STRING_TABLE *const *a,
diff --git a/crypto/asn1/asn1_gen.c b/crypto/asn1/asn1_gen.c
index 7b50a0ce63..c5fb8f91b1 100644
--- a/crypto/asn1/asn1_gen.c
+++ b/crypto/asn1/asn1_gen.c
@@ -23,6 +23,9 @@
#define ASN1_GEN_STR(str,val) {str, sizeof(str) - 1, val}
+DEFINE_STACK_OF(ASN1_TYPE)
+DEFINE_STACK_OF(CONF_VALUE)
+
#define ASN1_FLAG_EXP_MAX 20
/* Maximum number of nested sequences */
#define ASN1_GEN_SEQ_MAX_DEPTH 50
diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c
index 1331f608f4..47ae801b94 100644
--- a/crypto/asn1/asn1_lib.c
+++ b/crypto/asn1/asn1_lib.c
@@ -13,6 +13,8 @@
#include <openssl/asn1.h>
#include "asn1_local.h"
+DEFINE_STACK_OF(ASN1_UTF8STRING)
+
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
long max);
static void asn1_put_length(unsigned char **pp, int length);
diff --git a/crypto/asn1/asn_mime.c b/crypto/asn1/asn_mime.c
index 30da0298c0..4eb92d6844 100644
--- a/crypto/asn1/asn_mime.c
+++ b/crypto/asn1/asn_mime.c
@@ -18,6 +18,9 @@
#include "internal/bio.h"
#include "asn1_local.h"
+DEFINE_STACK_OF(BIO)
+DEFINE_STACK_OF(X509_ALGOR)
+
/*
* Generalised MIME like utilities for streaming ASN1. Although many have a
* PKCS7/CMS like flavour others are more general purpose.
diff --git a/crypto/asn1/asn_moid.c b/crypto/asn1/asn_moid.c
index 90f8076048..02ca99db79 100644
--- a/crypto/asn1/asn_moid.c
+++ b/crypto/asn1/asn_moid.c
@@ -16,6 +16,8 @@
#include "crypto/asn1.h"
#include "crypto/objects.h"
+DEFINE_STACK_OF(CONF_VALUE)
+
/* Simple ASN1 OID module: add all objects in a given section */
static int do_create(const char *value, const char *name);
diff --git a/crypto/asn1/asn_mstbl.c b/crypto/asn1/asn_mstbl.c
index 3139ab07cc..dedf1c3240 100644
--- a/crypto/asn1/asn_mstbl.c
+++ b/crypto/asn1/asn_mstbl.c
@@ -13,6 +13,7 @@
#include <openssl/conf.h>
#include <openssl/x509v3.h>
+DEFINE_STACK_OF(CONF_VALUE)
/* Multi string module: add table entries from a given section */
static int do_tcreate(const char *value, const char *name);
diff --git a/crypto/asn1/d2i_pr.c b/crypto/asn1/d2i_pr.c
index a4f3dd5359..c7346f5424 100644
--- a/crypto/asn1/d2i_pr.c
+++ b/crypto/asn1/d2i_pr.c
@@ -18,6 +18,7 @@
#include "crypto/asn1.h"
#include "crypto/evp.h"
+DEFINE_STACK_OF(ASN1_TYPE)
EVP_PKEY *d2i_PrivateKey_ex(int type, EVP_PKEY **a, const unsigned char **pp,
long length, OPENSSL_CTX *libctx, const char *propq)
{
diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c
index f720c6020a..421991146d 100644
--- a/crypto/asn1/tasn_dec.c
+++ b/crypto/asn1/tasn_dec.c
@@ -17,6 +17,7 @@
#include "internal/numbers.h"
#include "asn1_local.h"
+DEFINE_STACK_OF(ASN1_VALUE)
/*
* Constructed types with a recursive definition (such as can be found in PKCS7)
diff --git a/crypto/asn1/tasn_fre.c b/crypto/asn1/tasn_fre.c
index e8d57bdaad..a8cd914f4e 100644
--- a/crypto/asn1/tasn_fre.c
+++ b/crypto/asn1/tasn_fre.c
@@ -13,6 +13,8 @@
#include <openssl/objects.h>
#include "asn1_local.h"
+DEFINE_STACK_OF(ASN1_VALUE)
+
/* Free up an ASN1 structure */
void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
diff --git a/crypto/asn1/tasn_new.c b/crypto/asn1/tasn_new.c
index 155080dda1..a6335691a0 100644
--- a/crypto/asn1/tasn_new.c
+++ b/crypto/asn1/tasn_new.c
@@ -15,6 +15,8 @@
#include <string.h>
#include "asn1_local.h"
+DEFINE_STACK_OF(ASN1_VALUE)
+
static int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
int embed);
static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it,