Skip to content

Commit 918b697

Browse files
committed
tests/api.c: in test_wolfSSL_dtls_stateless_HashWOLFSSL(), when WOLFSSL_SMALL_STACK_CACHE, omit ssl->hsHashes from the comparison (init-time heap pointers destabilize its bit signature).
1 parent 2802e2d commit 918b697

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

tests/api.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32566,8 +32566,10 @@ static word32 test_wolfSSL_dtls_stateless_HashWOLFSSL(const WOLFSSL* ssl)
3256632566
wc_HashAlg hash;
3256732567
const TLSX* exts = ssl->extensions;
3256832568
WOLFSSL sslCopy; /* Use a copy to omit certain fields */
32569+
#ifndef WOLFSSL_SMALL_STACK_CACHE
3256932570
HS_Hashes* hsHashes = ssl->hsHashes; /* Is re-allocated in
3257032571
* InitHandshakeHashes */
32572+
#endif
3257132573

3257232574
XMEMCPY(&sslCopy, ssl, sizeof(*ssl));
3257332575
XMEMSET(hashBuf, 0, sizeof(hashBuf));
@@ -32614,9 +32616,17 @@ static word32 test_wolfSSL_dtls_stateless_HashWOLFSSL(const WOLFSSL* ssl)
3261432616
AssertIntEQ(wc_HashUpdate(&hash, hashType, (byte*)sslCopy.suites,
3261532617
sizeof(struct Suites)), 0);
3261632618
}
32619+
32620+
#ifdef WOLFSSL_SMALL_STACK_CACHE
32621+
/* with WOLFSSL_SMALL_STACK_CACHE, the SHA-2 objects always differ after
32622+
* initialization because of cached W and (for SHA512) X buffers.
32623+
*/
32624+
#else
3261732625
/* Hash hsHashes */
3261832626
AssertIntEQ(wc_HashUpdate(&hash, hashType, (byte*)hsHashes,
3261932627
sizeof(*hsHashes)), 0);
32628+
#endif
32629+
3262032630
AssertIntEQ(wc_HashFinal(&hash, hashType, hashBuf), 0);
3262132631
AssertIntEQ(wc_HashFree(&hash, hashType), 0);
3262232632

0 commit comments

Comments
 (0)