Skip to content

Commit 75a6621

Browse files
committed
hand edits for small stack compress
1 parent 7a3db09 commit 75a6621

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

src/tls.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,8 @@ int BuildTlsFinished(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
174174
#if !defined(WOLFSSL_ASYNC_CRYPT) || defined(WC_ASYNC_NO_HASH)
175175
byte handshake_hash[HSHASH_SZ];
176176
#else
177-
WC_DECLARE_VAR(handshake_hash, byte, HSHASH_SZ, ssl->heap);
178-
WC_ALLOC_VAR(handshake_hash, byte, HSHASH_SZ, ssl->heap);
177+
byte* handshake_hash = NULL;
178+
handshake_hash = XMALLOC(HSHASH_SZ, ssl->heap, DYNAMIC_TYPE_DIGEST);
179179
if (handshake_hash == NULL)
180180
return MEMORY_E;
181181
#endif
@@ -230,7 +230,7 @@ int BuildTlsFinished(WOLFSSL* ssl, Hashes* hashes, const byte* sender)
230230
}
231231

232232
#if defined(WOLFSSL_ASYNC_CRYPT) && !defined(WC_ASYNC_NO_HASH)
233-
WC_FREE_VAR(handshake_hash, ssl->heap);
233+
XFREE(handshake_hash, ssl->heap, DYNAMIC_TYPE_DIGEST);
234234
#elif defined(WOLFSSL_CHECK_MEM_ZERO)
235235
wc_MemZero_Check(handshake_hash, HSHASH_SZ);
236236
#endif
@@ -403,8 +403,8 @@ static int _DeriveTlsKeys(byte* key_dig, word32 key_dig_len,
403403
{
404404
int ret;
405405
#if defined(WOLFSSL_ASYNC_CRYPT) && !defined(WC_ASYNC_NO_HASH)
406-
WC_DECLARE_VAR(seed, byte, SEED_LEN, heap);
407-
WC_ALLOC_VAR(seed, byte, SEED_LEN, heap);
406+
byte* seed = NULL;
407+
seed = XMALLOC(SEED_LEN, heap, DYNAMIC_TYPE_SEED);
408408
if (seed == NULL)
409409
return MEMORY_E;
410410
#else
@@ -441,7 +441,7 @@ static int _DeriveTlsKeys(byte* key_dig, word32 key_dig_len,
441441
#endif
442442

443443
#if defined(WOLFSSL_ASYNC_CRYPT) && !defined(WC_ASYNC_NO_HASH)
444-
WC_FREE_VAR(seed, heap);
444+
XFREE(seed, heap, DYNAMIC_TYPE_SEED);
445445
#endif
446446

447447
return ret;
@@ -503,8 +503,8 @@ static int _MakeTlsMasterSecret(byte* ms, word32 msLen,
503503
#if !defined(WOLFSSL_ASYNC_CRYPT) || defined(WC_ASYNC_NO_HASH)
504504
byte seed[SEED_LEN];
505505
#else
506-
WC_DECLARE_VAR(seed, byte, SEED_LEN, heap);
507-
WC_ALLOC_VAR(seed, byte, SEED_LEN, heap);
506+
byte* seed = NULL;
507+
seed = XMALLOC(SEED_LEN, heap, DYNAMIC_TYPE_SEED);
508508
if (seed == NULL)
509509
return MEMORY_E;
510510
#endif
@@ -533,7 +533,7 @@ static int _MakeTlsMasterSecret(byte* ms, word32 msLen,
533533
#endif
534534

535535
#if defined(WOLFSSL_ASYNC_CRYPT) && !defined(WC_ASYNC_NO_HASH)
536-
WC_FREE_VAR(seed, heap);
536+
XFREE(seed, heap, DYNAMIC_TYPE_SEED);
537537
#endif
538538

539539
return ret;

wolfcrypt/test/test.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20985,11 +20985,7 @@ WOLFSSL_TEST_SUBROUTINE wc_test_ret_t rsa_no_pad_test(void)
2098520985
#endif
2098620986

2098720987
tmp = (byte*)XMALLOC(bytes, HEAP_HINT, DYNAMIC_TYPE_TMP_BUFFER);
20988-
if (tmp == NULL
20989-
#ifdef WOLFSSL_ASYNC_CRYPT
20990-
|| out == NULL || plain == NULL
20991-
#endif
20992-
) {
20988+
if (tmp == NULL) {
2099320989
ERROR_OUT(WC_TEST_RET_ENC_NC, exit_rsa_nopadding);
2099420990
}
2099520991

0 commit comments

Comments
 (0)