Skip to content

Commit

Permalink
Fix safestack issues in srp.h
Browse files Browse the repository at this point in the history
Reviewed-by: Richard Levitte <[email protected]>
Reviewed-by: Paul Dale <[email protected]>
(Merged from openssl#12781)
  • Loading branch information
mattcaswell committed Sep 13, 2020
1 parent 02199cc commit 22fbfe6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions build.info
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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
Expand Down
4 changes: 0 additions & 4 deletions crypto/srp/srp_vfy.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 17 additions & 3 deletions include/openssl/srp.h → include/openssl/srp.h.in
Original file line number Diff line number Diff line change
@@ -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.
*
Expand All @@ -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
Expand All @@ -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. */
Expand All @@ -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);
Expand All @@ -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);
Expand Down
2 changes: 0 additions & 2 deletions test/sslapitest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 22fbfe6

Please sign in to comment.