Fixed mixing declaration and code

pull/327/head
Daniele Lacamera 2021-03-09 10:04:37 +01:00
parent 40e12fd14d
commit cb2e988254
1 changed files with 6 additions and 10 deletions

View File

@ -3019,30 +3019,27 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx)
} }
} }
#ifdef WOLFSSH_SMALL_STACK
if (ret == WS_SUCCESS) { if (ret == WS_SUCCESS) {
#ifdef WOLFSSH_SMALL_STACK
sigKeyBlock_ptr = WMALLOC(sizeof(struct wolfSSH_sigKeyBlock), ssh->ctx->heap, DYNTYPE_PRIVKEY); sigKeyBlock_ptr = WMALLOC(sizeof(struct wolfSSH_sigKeyBlock), ssh->ctx->heap, DYNTYPE_PRIVKEY);
if (sigKeyBlock_ptr == NULL) { if (sigKeyBlock_ptr == NULL) {
ret = WS_MEMORY_E; ret = WS_MEMORY_E;
} }
}
#ifndef WOLFSSH_NO_ECDSA #ifndef WOLFSSH_NO_ECDSA
if (ret == WS_SUCCESS) {
key_ptr = WMALLOC(sizeof(ecc_key), ssh->ctx->heap, DYNTYPE_PRIVKEY); key_ptr = WMALLOC(sizeof(ecc_key), ssh->ctx->heap, DYNTYPE_PRIVKEY);
if (key_ptr == NULL) { if (key_ptr == NULL) {
ret = WS_MEMORY_E; ret = WS_MEMORY_E;
} }
}
#endif /* WOLFSSH_NO_ECDSA */ #endif /* WOLFSSH_NO_ECDSA */
#else /* ! WOLFSSH_SMALL_STACK */ #else /* ! WOLFSSH_SMALL_STACK */
#ifndef WOLFSSH_NO_ECDSA #ifndef WOLFSSH_NO_ECDSA
ecc_key key_s; ecc_key key_s;
key_ptr = &key_s; key_ptr = &key_s;
#endif #endif
sigKeyBlock_ptr = &s_sigKeyBlock; sigKeyBlock_ptr = &s_sigKeyBlock;
#endif #endif
if (ret == WS_SUCCESS) {
sig = buf + begin; sig = buf + begin;
tmpIdx = begin; tmpIdx = begin;
begin += sigSz; begin += sigSz;
@ -3092,8 +3089,7 @@ static int DoKexDhReply(WOLFSSH* ssh, byte* buf, word32 len, word32* idx)
(void)tmpIdx; (void)tmpIdx;
ret = WS_INVALID_ALGO_ID; ret = WS_INVALID_ALGO_ID;
#endif #endif
} } else {
else {
#ifndef WOLFSSH_NO_ECDSA #ifndef WOLFSSH_NO_ECDSA
byte* q; byte* q;
word32 qSz, pubKeyIdx = 0; word32 qSz, pubKeyIdx = 0;