Merge pull request #330 from danielinux/fix_no_dh

Fix configuration WOLFSSH_NO_DH
pull/334/head
JacobBarthelmeh 2021-03-26 21:49:57 +07:00 committed by GitHub
commit c75216118f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions

View File

@ -6556,7 +6556,7 @@ int SendKexDhReply(WOLFSSH* ssh)
{
int ret = WS_SUCCESS;
byte *f_ptr = NULL, *sig_ptr = NULL;
byte *y_ptr = NULL, *r_ptr = NULL, *s_ptr = NULL;
byte *r_ptr = NULL, *s_ptr = NULL;
byte scratchLen[LENGTH_SZ];
word32 fSz = KEX_F_SIZE;
word32 sigSz = KEX_SIG_SIZE;
@ -6571,12 +6571,13 @@ int SendKexDhReply(WOLFSSH* ssh)
byte msgId = MSGID_KEXDH_REPLY;
enum wc_HashType enmhashId;
#ifndef WOLFSSH_NO_DH
byte *y_ptr = NULL;
const byte* primeGroup = NULL;
word32 primeGroupSz = 0;
const byte* generator = NULL;
word32 generatorSz = 0;
struct wolfSSH_sigKeyBlockFull *sigKeyBlock_ptr;
#endif
struct wolfSSH_sigKeyBlockFull *sigKeyBlock_ptr;
#ifdef WOLFSSH_SMALL_STACK
sigKeyBlock_ptr = WMALLOC(sizeof(struct wolfSSH_sigKeyBlockFull),
ssh->ctx->heap, DYNTYPE_PRIVKEY);
@ -7242,8 +7243,10 @@ int SendKexDhReply(WOLFSSH* ssh)
WFREE(f_ptr, ssh->ctx->heap, DYNTYPE_BUFFER);
if (sig_ptr)
WFREE(sig_ptr, ssh->ctx->heap, DYNTYPE_BUFFER);
#ifndef WOLFSSH_NO_DH
if (y_ptr)
WFREE(r_ptr, ssh->ctx->heap, DYNTYPE_PRIVKEY);
#endif
if (r_ptr)
WFREE(r_ptr, ssh->ctx->heap, DYNTYPE_BUFFER);
if (s_ptr)