From e1cc1e831e05ebf9f8d1eaf41bdf088df4f57cf7 Mon Sep 17 00:00:00 2001 From: Anthony Hu Date: Tue, 2 Nov 2021 10:16:38 -0400 Subject: [PATCH] Fix for being able to build with LIBOQS but without DH The following configuration yielded a compile error: ./configure --with-liboqs --disable-dh This fixes bug reported on ZD13028. --- src/tls.c | 2 +- wolfssl/internal.h | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/tls.c b/src/tls.c index 8f0b7104c..e2d1cc2c6 100644 --- a/src/tls.c +++ b/src/tls.c @@ -7783,7 +7783,7 @@ static int TLSX_KeyShare_Parse(WOLFSSL* ssl, const byte* input, word16 length, /* Not in list sent if there isn't a private key. */ if (keyShareEntry == NULL || (keyShareEntry->key == NULL - #ifndef NO_DH + #if !defined(NO_DH) || defined(HAVE_LIBOQS) && keyShareEntry->privKey == NULL #endif )) { diff --git a/wolfssl/internal.h b/wolfssl/internal.h index 9edbf21eb..428d92a32 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -2571,15 +2571,15 @@ WOLFSSL_LOCAL int TLSX_Cookie_Use(WOLFSSL* ssl, const byte* data, word16 len, /* The KeyShare extension information - entry in a linked list. */ typedef struct KeyShareEntry { - word16 group; /* NamedGroup */ - byte* ke; /* Key exchange data */ - word32 keLen; /* Key exchange data length */ - void* key; /* Key struct */ - word32 keyLen; /* Key size (bytes) */ - byte* pubKey; /* Public key */ - word32 pubKeyLen; /* Public key length */ -#ifndef NO_DH - byte* privKey; /* Private key - DH only */ + word16 group; /* NamedGroup */ + byte* ke; /* Key exchange data */ + word32 keLen; /* Key exchange data length */ + void* key; /* Key struct */ + word32 keyLen; /* Key size (bytes) */ + byte* pubKey; /* Public key */ + word32 pubKeyLen; /* Public key length */ +#if !defined(NO_DH) || defined(HAVE_LIBOQS) + byte* privKey; /* Private key - DH ond PQ KEMs only */ #endif #ifdef WOLFSSL_ASYNC_CRYPT int lastRet;