From: Matt Caswell Date: Thu, 3 Sep 2020 14:31:44 +0000 (+0100) Subject: Fix safestack issues in srp.h X-Git-Tag: openssl-3.0.0-alpha7~261 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fopenssl.git;a=commitdiff_plain;h=22fbfe6a7d13c7c9417f8a10103d28fe70991e94 Fix safestack issues in srp.h Reviewed-by: Richard Levitte Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/12781) --- diff --git a/.gitignore b/.gitignore index 263a748e3a..4a29456053 100644 --- a/.gitignore +++ b/.gitignore @@ -31,6 +31,7 @@ /include/openssl/opensslv.h /include/openssl/pkcs7.h /include/openssl/safestack.h +/include/openssl/srp.h /include/openssl/ssl.h /include/openssl/x509.h /include/openssl/x509v3.h diff --git a/build.info b/build.info index 876135a6c7..722d886911 100644 --- a/build.info +++ b/build.info @@ -22,6 +22,7 @@ DEPEND[]=include/openssl/asn1.h \ include/openssl/ocsp.h \ include/openssl/pkcs7.h \ include/openssl/safestack.h \ + include/openssl/srp.h \ include/openssl/ssl.h \ include/openssl/x509.h \ include/openssl/x509v3.h \ @@ -37,6 +38,7 @@ GENERATE[include/openssl/ocsp.h]=include/openssl/ocsp.h.in GENERATE[include/openssl/opensslv.h]=include/openssl/opensslv.h.in GENERATE[include/openssl/pkcs7.h]=include/openssl/pkcs7.h.in GENERATE[include/openssl/safestack.h]=include/openssl/safestack.h.in +GENERATE[include/openssl/srp.h]=include/openssl/srp.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 diff --git a/crypto/srp/srp_vfy.c b/crypto/srp/srp_vfy.c index f0ed6da6f6..6c50d06457 100644 --- a/crypto/srp/srp_vfy.c +++ b/crypto/srp/srp_vfy.c @@ -25,10 +25,6 @@ # define SRP_RANDOM_SALT_LEN 20 # define MAX_LEN 2500 -DEFINE_STACK_OF(SRP_user_pwd) -DEFINE_STACK_OF(SRP_gN_cache) -DEFINE_STACK_OF(SRP_gN) - /* * Note that SRP uses its own variant of base 64 encoding. A different base64 * alphabet is used and no padding '=' characters are added. Instead we pad to diff --git a/include/openssl/srp.h b/include/openssl/srp.h.in similarity index 95% rename from include/openssl/srp.h rename to include/openssl/srp.h.in index 5c8f5368f8..7ea855d9a0 100644 --- a/include/openssl/srp.h +++ b/include/openssl/srp.h.in @@ -1,4 +1,6 @@ /* + * {- join("\n * ", @autowarntext) -} + * * Copyright 2004-2020 The OpenSSL Project Authors. All Rights Reserved. * Copyright (c) 2004, EdelKey Project. All Rights Reserved. * @@ -11,6 +13,10 @@ * for the EdelKey project. */ +{- +use OpenSSL::stackhash qw(generate_stack_macros); +-} + #ifndef OPENSSL_SRP_H # define OPENSSL_SRP_H # pragma once @@ -37,7 +43,10 @@ typedef struct SRP_gN_cache_st { char *b64_bn; BIGNUM *bn; } SRP_gN_cache; -DEFINE_OR_DECLARE_STACK_OF(SRP_gN_cache) +{- + generate_stack_macros("SRP_gN_cache"); +-} + typedef struct SRP_user_pwd_st { /* Owned by us. */ @@ -50,7 +59,9 @@ typedef struct SRP_user_pwd_st { /* Owned by us. */ char *info; } SRP_user_pwd; -DEFINE_OR_DECLARE_STACK_OF(SRP_user_pwd) +{- + generate_stack_macros("SRP_user_pwd"); +-} SRP_user_pwd *SRP_user_pwd_new(void); void SRP_user_pwd_free(SRP_user_pwd *user_pwd); @@ -76,7 +87,10 @@ typedef struct SRP_gN_st { const BIGNUM *g; const BIGNUM *N; } SRP_gN; -DEFINE_OR_DECLARE_STACK_OF(SRP_gN) +{- + generate_stack_macros("SRP_gN"); +-} + SRP_VBASE *SRP_VBASE_new(char *seed_key); void SRP_VBASE_free(SRP_VBASE *vb); diff --git a/test/sslapitest.c b/test/sslapitest.c index 7f444c5456..75d3c6fbfc 100644 --- a/test/sslapitest.c +++ b/test/sslapitest.c @@ -5939,8 +5939,6 @@ static int test_pha_key_update(void) static SRP_VBASE *vbase = NULL; -DEFINE_STACK_OF(SRP_user_pwd) - static int ssl_srp_cb(SSL *s, int *ad, void *arg) { int ret = SSL3_AL_FATAL;