Fix safestack issues in asn1t.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)
This commit is contained in:
Matt Caswell 2020-09-03 15:56:05 +01:00
parent 9d01ac71a0
commit 0b28254015
7 changed files with 13 additions and 9 deletions

1
.gitignore vendored
View File

@ -23,6 +23,7 @@
/crypto/buildinf.h /crypto/buildinf.h
/include/crypto/*_conf.h /include/crypto/*_conf.h
/include/openssl/asn1.h /include/openssl/asn1.h
/include/openssl/asn1t.h
/include/openssl/cmp.h /include/openssl/cmp.h
/include/openssl/cms.h /include/openssl/cms.h
/include/openssl/configuration.h /include/openssl/configuration.h

View File

@ -14,6 +14,7 @@ DEPEND[libssl]=libcrypto
# Empty DEPEND "indices" means the dependencies are expected to be built # Empty DEPEND "indices" means the dependencies are expected to be built
# unconditionally before anything else. # unconditionally before anything else.
DEPEND[]=include/openssl/asn1.h \ DEPEND[]=include/openssl/asn1.h \
include/openssl/asn1t.h \
include/openssl/cmp.h \ include/openssl/cmp.h \
include/openssl/cms.h \ include/openssl/cms.h \
include/openssl/configuration.h \ include/openssl/configuration.h \
@ -33,6 +34,7 @@ DEPEND[]=include/openssl/asn1.h \
doc/man7/openssl_user_macros.pod doc/man7/openssl_user_macros.pod
GENERATE[include/openssl/asn1.h]=include/openssl/asn1.h.in GENERATE[include/openssl/asn1.h]=include/openssl/asn1.h.in
GENERATE[include/openssl/asn1t.h]=include/openssl/asn1t.h.in
GENERATE[include/openssl/cmp.h]=include/openssl/cmp.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/cms.h]=include/openssl/cms.h.in
GENERATE[include/openssl/configuration.h]=include/openssl/configuration.h.in GENERATE[include/openssl/configuration.h]=include/openssl/configuration.h.in

View File

@ -17,8 +17,6 @@
#include "internal/numbers.h" #include "internal/numbers.h"
#include "asn1_local.h" #include "asn1_local.h"
DEFINE_STACK_OF(ASN1_VALUE)
/* /*
* Constructed types with a recursive definition (such as can be found in PKCS7) * Constructed types with a recursive definition (such as can be found in PKCS7)
* could eventually exceed the stack given malicious input with excessive * could eventually exceed the stack given malicious input with excessive

View File

@ -13,8 +13,6 @@
#include <openssl/objects.h> #include <openssl/objects.h>
#include "asn1_local.h" #include "asn1_local.h"
DEFINE_STACK_OF(ASN1_VALUE)
/* Free up an ASN1 structure */ /* Free up an ASN1 structure */
void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it) void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)

View File

@ -15,8 +15,6 @@
#include <string.h> #include <string.h>
#include "asn1_local.h" #include "asn1_local.h"
DEFINE_STACK_OF(ASN1_VALUE)
static int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it, static int asn1_item_embed_new(ASN1_VALUE **pval, const ASN1_ITEM *it,
int embed); int embed);
static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it, static int asn1_primitive_new(ASN1_VALUE **pval, const ASN1_ITEM *it,

View File

@ -16,8 +16,6 @@
#include "crypto/asn1.h" #include "crypto/asn1.h"
#include "x509_local.h" #include "x509_local.h"
DEFINE_STACK_OF(ASN1_VALUE)
/* /*
* Maximum length of X509_NAME: much larger than anything we should * Maximum length of X509_NAME: much larger than anything we should
* ever see in practice. * ever see in practice.

View File

@ -1,4 +1,6 @@
/* /*
* {- join("\n * ", @autowarntext) -}
*
* Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved. * Copyright 2000-2020 The OpenSSL Project Authors. All Rights Reserved.
* *
* Licensed under the Apache License 2.0 (the "License"). You may not use * Licensed under the Apache License 2.0 (the "License"). You may not use
@ -7,6 +9,10 @@
* https://www.openssl.org/source/license.html * https://www.openssl.org/source/license.html
*/ */
{-
use OpenSSL::stackhash qw(generate_stack_macros);
-}
#ifndef OPENSSL_ASN1T_H #ifndef OPENSSL_ASN1T_H
# define OPENSSL_ASN1T_H # define OPENSSL_ASN1T_H
# pragma once # pragma once
@ -880,7 +886,10 @@ DECLARE_ASN1_ITEM(LONG)
DECLARE_ASN1_ITEM(ZLONG) DECLARE_ASN1_ITEM(ZLONG)
# endif # endif
DEFINE_OR_DECLARE_STACK_OF(ASN1_VALUE) {-
generate_stack_macros("ASN1_VALUE");
-}
/* Functions used internally by the ASN1 code */ /* Functions used internally by the ASN1 code */