mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-08-30 15:14:01 +02:00
The keylog reader used fscanf with three whitespace delimited tokens, which is not line aware. RFC 9850 Section 1 requires readers to ignore empty lines and lines whose first character is '#', and Section 2 recommends ignoring lines that do not conform to the format so secrets can still be recovered from corrupted files. A comment line such as "# note" was parsed as three fields spanning the line boundary, which desynchronized the rest of the file. Read one line at a time with fgets, skip empty and comment lines, and parse each line with sscanf, skipping any line that does not yield the three expected fields instead of aborting. Clear the field buffers each iteration so a short field cannot pick up stale bytes from a previous line, validate that the fixed length client random field is the exact expected length, and leave the secret length variable because it depends on the negotiated hash. Zero the new line buffer on every return path, matching the existing ForceZero handling of the secret buffers. Add a comment line, a blank line, and a malformed line to the TLS 1.3 keylog test data so the sniffer keylog test exercises the skip paths.
29 lines
4.1 KiB
Plaintext
29 lines
4.1 KiB
Plaintext
# RFC 9850: reader must ignore comment lines, blank lines, and malformed
|
|
# lines such as the INCOMPLETE_KEYLOG_LINE entry below
|
|
|
|
INCOMPLETE_KEYLOG_LINE deadbeef
|
|
CLIENT_HANDSHAKE_TRAFFIC_SECRET b28ffa242be7ecc3ef669ea686dc842c0de9efe938a0f047c28cb359710991f8 cfe4b2e9ef157938936ed15627e65338e6b5f5b251b1718e28b028eabecf3633
|
|
CLIENT_HANDSHAKE_TRAFFIC_SECRET b28ffa242be7ecc3ef669ea686dc842c0de9efe938a0f047c28cb359710991f8 cfe4b2e9ef157938936ed15627e65338e6b5f5b251b1718e28b028eabecf3633
|
|
SERVER_HANDSHAKE_TRAFFIC_SECRET b28ffa242be7ecc3ef669ea686dc842c0de9efe938a0f047c28cb359710991f8 737fd782b2e50c4982011f0ec7249d3f91b7e9e25529631c4794cfd4a83ceaf1
|
|
SERVER_HANDSHAKE_TRAFFIC_SECRET b28ffa242be7ecc3ef669ea686dc842c0de9efe938a0f047c28cb359710991f8 737fd782b2e50c4982011f0ec7249d3f91b7e9e25529631c4794cfd4a83ceaf1
|
|
CLIENT_TRAFFIC_SECRET_0 b28ffa242be7ecc3ef669ea686dc842c0de9efe938a0f047c28cb359710991f8 0511f5dafee551cf04caeec16a136339b609a4865a06e2b133f54efc3ba2a884
|
|
SERVER_TRAFFIC_SECRET_0 b28ffa242be7ecc3ef669ea686dc842c0de9efe938a0f047c28cb359710991f8 a68d845305d60f4a95f824349b0293379113781ba2f09a7c1b0ecc425e2f28d3
|
|
CLIENT_TRAFFIC_SECRET_0 b28ffa242be7ecc3ef669ea686dc842c0de9efe938a0f047c28cb359710991f8 0511f5dafee551cf04caeec16a136339b609a4865a06e2b133f54efc3ba2a884
|
|
SERVER_TRAFFIC_SECRET_0 b28ffa242be7ecc3ef669ea686dc842c0de9efe938a0f047c28cb359710991f8 a68d845305d60f4a95f824349b0293379113781ba2f09a7c1b0ecc425e2f28d3
|
|
CLIENT_HANDSHAKE_TRAFFIC_SECRET eeb887ab80b0596c7688464bc33345bd2a0cc2075a9ef9bacd6cb3a84397f126 45d1e73b76c6a6949929c4da7a0727efa96bd35faf1b7f874fbc821222c6c4369d8350cffab1e3d1d4d5057d3dd4f551
|
|
SERVER_HANDSHAKE_TRAFFIC_SECRET eeb887ab80b0596c7688464bc33345bd2a0cc2075a9ef9bacd6cb3a84397f126 2b7932c49300f5e052aa4313b6d4320d13b081db04186ebb7e20714a971280b15f355a12105b893e23478685f01c8c47
|
|
CLIENT_HANDSHAKE_TRAFFIC_SECRET eeb887ab80b0596c7688464bc33345bd2a0cc2075a9ef9bacd6cb3a84397f126 45d1e73b76c6a6949929c4da7a0727efa96bd35faf1b7f874fbc821222c6c4369d8350cffab1e3d1d4d5057d3dd4f551
|
|
SERVER_HANDSHAKE_TRAFFIC_SECRET eeb887ab80b0596c7688464bc33345bd2a0cc2075a9ef9bacd6cb3a84397f126 2b7932c49300f5e052aa4313b6d4320d13b081db04186ebb7e20714a971280b15f355a12105b893e23478685f01c8c47
|
|
CLIENT_TRAFFIC_SECRET_0 eeb887ab80b0596c7688464bc33345bd2a0cc2075a9ef9bacd6cb3a84397f126 c39a8a442eb6f18c8975aacd69ecd41c2f8a721439f7c8a838e24c87f5999239d7455276764db1ab5487f812260434ea
|
|
SERVER_TRAFFIC_SECRET_0 eeb887ab80b0596c7688464bc33345bd2a0cc2075a9ef9bacd6cb3a84397f126 996c62d770c9d767cdf486e74b42a85524d0ec740a0f795da0046f50c5548d33dc02da73a90e39bc4e3e366938ec33f8
|
|
CLIENT_TRAFFIC_SECRET_0 eeb887ab80b0596c7688464bc33345bd2a0cc2075a9ef9bacd6cb3a84397f126 c39a8a442eb6f18c8975aacd69ecd41c2f8a721439f7c8a838e24c87f5999239d7455276764db1ab5487f812260434ea
|
|
SERVER_TRAFFIC_SECRET_0 eeb887ab80b0596c7688464bc33345bd2a0cc2075a9ef9bacd6cb3a84397f126 996c62d770c9d767cdf486e74b42a85524d0ec740a0f795da0046f50c5548d33dc02da73a90e39bc4e3e366938ec33f8
|
|
CLIENT_HANDSHAKE_TRAFFIC_SECRET 34e4a42a66b0e0b3a3c56ff6f21be30b7ab3048927f6e681af27c936b787c75f 73b584314cb4a21e381e5fb7c1881bc4b05c6a8df3518bd0c8e959115c63c03f
|
|
SERVER_HANDSHAKE_TRAFFIC_SECRET 34e4a42a66b0e0b3a3c56ff6f21be30b7ab3048927f6e681af27c936b787c75f f7d2e381e7dd15cde68f356b00a31b09a7c01576cc0bde27d3c074482524d5b8
|
|
CLIENT_HANDSHAKE_TRAFFIC_SECRET 34e4a42a66b0e0b3a3c56ff6f21be30b7ab3048927f6e681af27c936b787c75f 73b584314cb4a21e381e5fb7c1881bc4b05c6a8df3518bd0c8e959115c63c03f
|
|
SERVER_HANDSHAKE_TRAFFIC_SECRET 34e4a42a66b0e0b3a3c56ff6f21be30b7ab3048927f6e681af27c936b787c75f f7d2e381e7dd15cde68f356b00a31b09a7c01576cc0bde27d3c074482524d5b8
|
|
CLIENT_TRAFFIC_SECRET_0 34e4a42a66b0e0b3a3c56ff6f21be30b7ab3048927f6e681af27c936b787c75f aa63ec4cf52a4e72e62a0ab2b169da31fa4a872ffe87071237767d533f007ba4
|
|
SERVER_TRAFFIC_SECRET_0 34e4a42a66b0e0b3a3c56ff6f21be30b7ab3048927f6e681af27c936b787c75f cd4783b58824208e230cbf6accf47993d5dbda0866e0f4c255d9b7173bd3ba0e
|
|
CLIENT_TRAFFIC_SECRET_0 34e4a42a66b0e0b3a3c56ff6f21be30b7ab3048927f6e681af27c936b787c75f aa63ec4cf52a4e72e62a0ab2b169da31fa4a872ffe87071237767d533f007ba4
|
|
SERVER_TRAFFIC_SECRET_0 34e4a42a66b0e0b3a3c56ff6f21be30b7ab3048927f6e681af27c936b787c75f cd4783b58824208e230cbf6accf47993d5dbda0866e0f4c255d9b7173bd3ba0e
|