mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-26 17:01:42 +03:00
set_ciphersuites() builds the PSK, PKI and EC JPAKE cipher suite lists in two passes, one counting and one filling, each with its own copy of the selection rules, and then zero terminated the PSK and PKI lists only. The EC JPAKE list is handed to mbedtls_ssl_conf_ciphersuites(), which reads it up to the 0 entry, so an EC JPAKE client took whatever was in the last slot as the next cipher suite and could read past the end of the allocation when writing its ClientHello. Decide which lists a cipher suite goes in with one function used by both passes, and zero terminate every list, so the counts, contents and terminators of the lists can no longer disagree. Add a unit test.