diff --git a/cyassl/internal.h b/cyassl/internal.h index 1142528db..6bc38919a 100644 --- a/cyassl/internal.h +++ b/cyassl/internal.h @@ -474,6 +474,14 @@ enum Misc { }; +/* don't use extra 3/4k stack space unless need to */ +#ifdef HAVE_NTRU + #define MAX_ENCRYPT_SZ MAX_NTRU_ENCRYPT_SZ +#else + #define MAX_ENCRYPT_SZ ENCRYPT_LEN +#endif + + /* states */ enum states { NULL_STATE = 0, diff --git a/src/internal.c b/src/internal.c index 92041b559..d60257960 100644 --- a/src/internal.c +++ b/src/internal.c @@ -5088,7 +5088,7 @@ int SetCipherList(Suites* s, const char* list) int SendClientKeyExchange(CYASSL* ssl) { - byte encSecret[MAX_NTRU_ENCRYPT_SZ]; + byte encSecret[MAX_ENCRYPT_SZ]; word32 encSz = 0; word32 idx = 0; int ret = 0;