Fix stacks of OPENSSL_STRING, OPENSSL_CSTRING and OPENSSL_BLOCK

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 14:10:41 +01:00
parent e144fd36ce
commit 24c4ea958e
39 changed files with 34 additions and 63 deletions

1
.gitignore vendored
View File

@ -25,6 +25,7 @@
/include/openssl/configuration.h
/include/openssl/opensslv.h
/include/openssl/fipskey.h
/include/openssl/safestack.h
/include/openssl/ssl.h
/include/openssl/x509.h
/include/openssl/x509v3.h

View File

@ -19,7 +19,6 @@
#include <openssl/asn1t.h>
DEFINE_STACK_OF(ASN1_OBJECT)
DEFINE_STACK_OF_STRING()
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,

View File

@ -35,7 +35,6 @@
#include "progs.h"
DEFINE_STACK_OF(CONF_VALUE)
DEFINE_STACK_OF_STRING()
#ifndef W_OK
# define F_OK 0

View File

@ -24,7 +24,6 @@
# include <openssl/cms.h>
DEFINE_STACK_OF(CMS_SignerInfo)
DEFINE_STACK_OF_STRING()
static int save_certs(char *signerfile, STACK_OF(X509) *signers);
static int cms_cb(int ok, X509_STORE_CTX *ctx);

View File

@ -19,8 +19,6 @@
#include <openssl/pem.h>
#include <openssl/objects.h>
DEFINE_STACK_OF_STRING()
static int add_certs_from_file(STACK_OF(X509) *stack, char *certfile);
typedef enum OPTION_choice {

View File

@ -21,8 +21,6 @@
#include <openssl/hmac.h>
#include <ctype.h>
DEFINE_STACK_OF_STRING()
#undef BUFSIZE
#define BUFSIZE 1024*8

View File

@ -22,9 +22,6 @@
#include <openssl/ssl.h>
#include <openssl/store.h>
DEFINE_STACK_OF_STRING()
DEFINE_STACK_OF_CSTRING()
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_C, OPT_T, OPT_TT, OPT_PRE, OPT_POST,

View File

@ -19,8 +19,6 @@
#include "apps.h"
#include "progs.h"
DEFINE_STACK_OF_STRING()
#define BUFSIZE 4096
/* Configuration file values */

View File

@ -17,8 +17,6 @@
#include <openssl/kdf.h>
#include <openssl/params.h>
DEFINE_STACK_OF_STRING()
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_KDFOPT, OPT_BIN, OPT_KEYLEN, OPT_OUT,

View File

@ -63,7 +63,6 @@ static int WIN32_rename(const char *from, const char *to);
DEFINE_STACK_OF(CONF)
DEFINE_STACK_OF(CONF_VALUE)
DEFINE_STACK_OF_STRING()
typedef struct {
const char *name;

View File

@ -12,8 +12,6 @@
#include <openssl/safestack.h>
#include "names.h"
DEFINE_STACK_OF_CSTRING()
#ifdef _WIN32
# define strcasecmp _stricmp
#endif

View File

@ -26,8 +26,6 @@
#define COOKIE_SECRET_LENGTH 16
DEFINE_STACK_OF_STRING()
VERIFY_CB_ARGS verify_args = { -1, 0, X509_V_OK, 0 };
#ifndef OPENSSL_NO_SOCK

View File

@ -25,8 +25,6 @@
#include "opt.h"
#include "names.h"
DEFINE_STACK_OF_CSTRING()
static int verbose = 0;
static void legacy_cipher_fn(const EVP_CIPHER *c,

View File

@ -16,8 +16,6 @@
#include <openssl/evp.h>
#include <openssl/params.h>
DEFINE_STACK_OF_STRING()
#undef BUFSIZE
#define BUFSIZE 1024*8

View File

@ -35,7 +35,6 @@
DEFINE_STACK_OF(OCSP_CERTID)
DEFINE_STACK_OF(CONF_VALUE)
DEFINE_STACK_OF_STRING()
#if defined(__TANDEM)
# if defined(OPENSSL_TANDEM_FLOSS)

View File

@ -22,7 +22,6 @@
DEFINE_STACK_OF(PKCS7)
DEFINE_STACK_OF(PKCS12_SAFEBAG)
DEFINE_STACK_OF_STRING()
#define NOKEYS 0x1
#define NOCERTS 0x2

View File

@ -15,8 +15,6 @@
#include <openssl/evp.h>
#include <sys/stat.h>
DEFINE_STACK_OF_STRING()
#define KEY_NONE 0
#define KEY_PRIVKEY 1
#define KEY_PUBKEY 2

View File

@ -24,8 +24,6 @@
# include <string.h> /* memset */
#endif
DEFINE_STACK_OF_CSTRING()
typedef enum OPTION_choice {
OPT_ERR = -1, OPT_EOF = 0, OPT_HELP,
OPT_V = 100, OPT_VV, OPT_VVV

View File

@ -42,8 +42,6 @@
# include <openssl/pem.h>
# include <openssl/x509.h>
DEFINE_STACK_OF_STRING()
# ifndef PATH_MAX
# define PATH_MAX 4096
# endif

View File

@ -36,7 +36,6 @@
#endif
DEFINE_STACK_OF(CONF_VALUE)
DEFINE_STACK_OF_STRING()
#define BITS "default_bits"
#define KEYFILE "default_keyfile"

View File

@ -60,7 +60,6 @@ typedef unsigned int u_int;
#endif
DEFINE_STACK_OF(SCT)
DEFINE_STACK_OF_STRING()
#undef BUFSIZZ
#define BUFSIZZ 1024*8

View File

@ -60,8 +60,6 @@ typedef unsigned int u_int;
#endif
#include "internal/sockets.h"
DEFINE_STACK_OF_STRING()
static int not_resumable_sess_cb(SSL *s, int is_forward_secure);
static int sv_body(int s, int stype, int prot, unsigned char *context);
static int www_body(int s, int stype, int prot, unsigned char *context);

View File

@ -19,8 +19,6 @@
#include <openssl/x509_vfy.h>
#include <openssl/x509v3.h>
DEFINE_STACK_OF_STRING()
static int save_certs(char *signerfile, STACK_OF(X509) *signers);
static int smime_cb(int ok, X509_STORE_CTX *ctx);

View File

@ -18,8 +18,6 @@
#include <openssl/x509v3.h>
#include <openssl/pem.h>
DEFINE_STACK_OF_STRING()
static int cb(int ok, X509_STORE_CTX *ctx);
static int check(X509_STORE *ctx, const char *file,
STACK_OF(X509) *uchain, STACK_OF(X509) *tchain,

View File

@ -29,7 +29,6 @@
#endif
DEFINE_STACK_OF(ASN1_OBJECT)
DEFINE_STACK_OF_STRING()
#undef POSTFIX
#define POSTFIX ".srl"

View File

@ -15,6 +15,7 @@ DEPEND[libssl]=libcrypto
# unconditionally before anything else.
DEPEND[]=include/openssl/configuration.h include/openssl/opensslv.h \
include/openssl/fipskey.h \
include/openssl/safestack.h \
include/openssl/ssl.h \
include/openssl/x509.h \
include/openssl/x509v3.h \
@ -24,6 +25,7 @@ DEPEND[]=include/openssl/configuration.h include/openssl/opensslv.h \
GENERATE[include/openssl/configuration.h]=include/openssl/configuration.h.in
GENERATE[include/openssl/opensslv.h]=include/openssl/opensslv.h.in
GENERATE[include/openssl/fipskey.h]=include/openssl/fipskey.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
GENERATE[include/openssl/x509v3.h]=include/openssl/x509v3.h.in

View File

@ -187,8 +187,6 @@ static void decoder_clean_EVP_PKEY_construct_arg(void *construct_data)
}
}
DEFINE_STACK_OF_CSTRING()
struct collected_data_st {
struct decoder_EVP_PKEY_data_st *process_data;
STACK_OF(OPENSSL_CSTRING) *names;

View File

@ -18,8 +18,6 @@
#include "crypto/evp.h"
#include "encoder_local.h"
DEFINE_STACK_OF_CSTRING()
int OSSL_ENCODER_CTX_set_cipher(OSSL_ENCODER_CTX *ctx,
const char *cipher_name,
const char *propquery)

View File

@ -20,8 +20,6 @@
* prototypes.
*/
DEFINE_STACK_OF_STRING()
/* Our ENGINE handlers */
static int dynamic_init(ENGINE *e);
static int dynamic_finish(ENGINE *e);

View File

@ -12,8 +12,6 @@
#include "crypto/x509.h"
#include "x509_local.h"
DEFINE_STACK_OF_STRING()
/* Generic object loader, given expected type and criterion */
static int cache_objects(X509_LOOKUP *lctx, const char *uri,
const OSSL_STORE_SEARCH *criterion,

View File

@ -22,7 +22,6 @@
#include "x509_local.h"
DEFINE_STACK_OF(CONF_VALUE)
DEFINE_STACK_OF_STRING()
static char *strip_spaces(char *name);
static int sk_strcmp(const char *const *a, const char *const *b);

View File

@ -25,8 +25,6 @@
#include "crypto/x509.h"
#include "x509_local.h"
DEFINE_STACK_OF_STRING()
/* CRL score values */
/* No unhandled critical extensions */

View File

@ -20,7 +20,6 @@
DEFINE_STACK_OF(ASN1_OBJECT)
DEFINE_STACK_OF(X509_VERIFY_PARAM)
DEFINE_STACK_OF_STRING()
/* X509_VERIFY_PARAM functions */

View File

@ -1,4 +1,6 @@
/*
* {- join("\n * ", @autowarntext) -}
*
* Copyright 1999-2020 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
@ -7,6 +9,12 @@
* https://www.openssl.org/source/license.html
*/
{-
use OpenSSL::stackhash qw(generate_stack_string_macros
generate_stack_const_string_macros
generate_stack_block_macros);
-}
#ifndef OPENSSL_SAFESTACK_H
# define OPENSSL_SAFESTACK_H
# pragma once
@ -184,8 +192,10 @@ typedef const char *OPENSSL_CSTRING;
* chars. So, we have to implement STRING specially for STACK_OF. This is
* dealt with in the autogenerated macros below.
*/
DEFINE_OR_DECLARE_STACK_OF_STRING()
DEFINE_OR_DECLARE_STACK_OF_CSTRING()
{-
generate_stack_string_macros()
.generate_stack_const_string_macros();
-}
#if !defined(OPENSSL_NO_DEPRECATED_3_0)
/*
@ -193,7 +203,9 @@ DEFINE_OR_DECLARE_STACK_OF_CSTRING()
* These should also be distinguished from "normal" stacks.
*/
typedef void *OPENSSL_BLOCK;
DEFINE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void)
{-
generate_stack_block_macros();
-}
#endif
/*

View File

@ -15,7 +15,6 @@
#include <openssl/err.h>
DEFINE_STACK_OF(CONF_VALUE)
DEFINE_STACK_OF_CSTRING()
static STACK_OF(OPENSSL_CSTRING) *section_names = NULL;

View File

@ -31,8 +31,6 @@
#include "crypto/bn_dh.h" /* _bignum_ffdhe2048_p */
#include "../e_os.h" /* strcasecmp */
DEFINE_STACK_OF_CSTRING()
static OPENSSL_CTX *libctx = NULL;
static OSSL_PROVIDER *nullprov = NULL;
static OSSL_PROVIDER *libprov = NULL;

View File

@ -27,8 +27,6 @@
#include "testutil.h"
#include "evp_test.h"
DEFINE_STACK_OF_STRING()
#define AAD_NUM 4
typedef struct evp_test_method_st EVP_TEST_METHOD;

View File

@ -81,8 +81,6 @@
# include <unistd.h>
#endif
DEFINE_STACK_OF_STRING()
static SSL_CTX *s_ctx = NULL;
static SSL_CTX *s_ctx2 = NULL;

View File

@ -13,7 +13,10 @@ use warnings;
require Exporter;
our @ISA = qw(Exporter);
our @EXPORT_OK = qw(generate_stack_macros generate_const_stack_macros);
our @EXPORT_OK = qw(generate_stack_macros generate_const_stack_macros
generate_stack_string_macros
generate_stack_const_string_macros
generate_stack_block_macros);
sub generate_stack_macros_int {
my $nametype = shift;
@ -89,4 +92,16 @@ sub generate_const_stack_macros {
return generate_stack_macros_int($type, "const $type", $type);
}
sub generate_stack_string_macros {
return generate_stack_macros_int("OPENSSL_STRING", "char", "char");
}
sub generate_stack_const_string_macros {
return generate_stack_macros_int("OPENSSL_CSTRING", "const char", "char");
}
sub generate_stack_block_macros {
return generate_stack_macros_int("OPENSSL_BLOCK", "void", "void");
}
1;