Skip to content

Commit 162dd7f

Browse files
ejohnstownpadelsbach
authored andcommitted
Test ForceZero of secrets in free and DH KEX
- Add retain-on-free and size-tracking capture allocators to inspect freed buffers post-free. - Verify SshResourceFree zeroes ssh->k, ssh->keys, and ssh->peerKeys before wolfSSH_free releases the struct. - Verify KeyAgreeDh_client wipes ssh->handshake->x even when wc_DhAgree fails (ForceZero is unconditional). - Verify KeyAgreeDh_server zeroes the MAX_KEX_KEY_SZ y_ptr allocation under WOLFSSH_SMALL_STACK via 0xCC poisoning. - Expose KeyAgreeDh_client / KeyAgreeDh_server via wolfSSH_Test* hooks under WOLFSSH_TEST_INTERNAL. Issues: F-2488, F-2492, F-2493, F-2875
1 parent fb1aa6d commit 162dd7f

3 files changed

Lines changed: 466 additions & 0 deletions

File tree

src/internal.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18118,6 +18118,22 @@ int wolfSSH_TestHighwaterCheck(WOLFSSH* ssh, byte side)
1811818118
return HighwaterCheck(ssh, side);
1811918119
}
1812018120

18121+
#ifndef WOLFSSH_NO_DH
18122+
18123+
int wolfSSH_TestKeyAgreeDh_client(WOLFSSH* ssh, byte hashId,
18124+
const byte* f, word32 fSz)
18125+
{
18126+
return KeyAgreeDh_client(ssh, hashId, f, fSz);
18127+
}
18128+
18129+
int wolfSSH_TestKeyAgreeDh_server(WOLFSSH* ssh, byte hashId,
18130+
byte* f, word32* fSz)
18131+
{
18132+
return KeyAgreeDh_server(ssh, hashId, f, fSz);
18133+
}
18134+
18135+
#endif /* !WOLFSSH_NO_DH */
18136+
1812118137
#ifndef WOLFSSH_NO_DH_GEX_SHA256
1812218138

1812318139
int wolfSSH_TestDoKexDhGexRequest(WOLFSSH* ssh, byte* buf, word32 len,

0 commit comments

Comments
 (0)