Fix nested NO_TLS.

This commit is contained in:
David Garske
2024-12-10 14:10:15 -08:00
parent 16b2884cf1
commit a2b5da8651
2 changed files with 9 additions and 17 deletions

View File

@@ -11904,14 +11904,9 @@ static int BuildFinished(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
if (ssl == NULL) if (ssl == NULL)
return BAD_FUNC_ARG; return BAD_FUNC_ARG;
#ifndef NO_TLS
if (ssl->options.tls) { if (ssl->options.tls) {
ret = BuildTlsFinished(ssl, hashes, sender); ret = BuildTlsFinished(ssl, hashes, sender);
} }
#else
(void)hashes;
(void)sender;
#endif
#ifndef NO_OLD_TLS #ifndef NO_OLD_TLS
if (!ssl->options.tls) { if (!ssl->options.tls) {
ret = BuildMD5(ssl, hashes, sender); ret = BuildMD5(ssl, hashes, sender);
@@ -22903,8 +22898,8 @@ int BuildMessage(WOLFSSL* ssl, byte* output, int outSz, const byte* input,
int inSz, int type, int hashOutput, int sizeOnly, int asyncOkay, int inSz, int type, int hashOutput, int sizeOnly, int asyncOkay,
int epochOrder) int epochOrder)
{ {
#ifndef WOLFSSL_NO_TLS12
int ret; int ret;
#if !defined(NO_TLS) && !defined(WOLFSSL_NO_TLS12)
BuildMsgArgs* args; BuildMsgArgs* args;
BuildMsgArgs lcl_args; BuildMsgArgs lcl_args;
#endif #endif
@@ -22924,12 +22919,12 @@ int BuildMessage(WOLFSSL* ssl, byte* output, int outSz, const byte* input,
(void)epochOrder; (void)epochOrder;
#ifndef NO_TLS
#if defined(WOLFSSL_NO_TLS12) && defined(WOLFSSL_TLS13) #if defined(WOLFSSL_NO_TLS12) && defined(WOLFSSL_TLS13)
/* TLS v1.3 only */
return BuildTls13Message(ssl, output, outSz, input, inSz, type, return BuildTls13Message(ssl, output, outSz, input, inSz, type,
hashOutput, sizeOnly, asyncOkay); hashOutput, sizeOnly, asyncOkay);
#else #else
/* TLS v1.2 or v1.3 */
#ifdef WOLFSSL_TLS13 #ifdef WOLFSSL_TLS13
if (ssl->options.tls1_3) { if (ssl->options.tls1_3) {
return BuildTls13Message(ssl, output, outSz, input, inSz, type, return BuildTls13Message(ssl, output, outSz, input, inSz, type,
@@ -23450,19 +23445,16 @@ exit_buildmsg:
/* Final cleanup */ /* Final cleanup */
FreeBuildMsgArgs(ssl, args); FreeBuildMsgArgs(ssl, args);
#endif /* !WOLFSSL_NO_TLS12 */ return ret;
#endif /* !WOLFSSL_NO_TLS12 || WOLFSSL_TLS13 */ #else
#endif /* !NO_TLS */
#if defined(NO_TLS) || (defined(WOLFSSL_NO_TLS12) && !defined(WOLFSSL_TLS13))
(void)outSz; (void)outSz;
(void)inSz; (void)inSz;
(void)type; (void)type;
(void)hashOutput; (void)hashOutput;
(void)asyncOkay; (void)asyncOkay;
ret = NOT_COMPILED_IN; return NOT_COMPILED_IN;
#endif /* !WOLFSSL_NO_TLS12 */
#endif #endif
return ret;
} }
#ifndef WOLFSSL_NO_TLS12 #ifndef WOLFSSL_NO_TLS12

View File

@@ -28,7 +28,7 @@
#include <wolfssl/wolfcrypt/settings.h> #include <wolfssl/wolfcrypt/settings.h>
#ifndef WOLFCRYPT_ONLY #if !defined(WOLFCRYPT_ONLY) && !defined(NO_TLS)
#include <wolfssl/internal.h> #include <wolfssl/internal.h>
#include <wolfssl/error-ssl.h> #include <wolfssl/error-ssl.h>
@@ -4109,4 +4109,4 @@ int MakeMasterSecret(WOLFSSL* ssl)
#endif #endif
} }
#endif /* WOLFCRYPT_ONLY */ #endif /* !WOLFCRYPT_ONLY && !NO_TLS */