feat(tls): the peer certificate of a session, and its natives row #464
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/116-tls-peer-certificate"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #116
Step 1 of 2 of FIRST-PARTY.md gap 18 (the two-commit rule for a new native, as #362 / #363): the runtime function, the header declaration and the natives row. The
std/tlsdeclaration andTlsStream.peerCertificate()are #463, after the next published seed.What
runtime/tls/tls.c,runtime/include/torb_tls.h:int64_t torb_tls_peer_certificate(int64_t session, torb_list *into)appends the DER of the leaf the peer sent (mbedtls_ssl_get_peer_cert, undertorb_tls_lock) and answers its length; 0 for an unknown handle, a handshake not done, or no certificate.compiler/src/backend/c/natives.trb:tlsPeerCertificateintlsEntries.docs/design/NATIVES.md: the row and the counts (keep 179, total 534).runtime/include/torb_natives.h,runtime/machine_natives.c: the generated files, written by hand to the generator's exact output (sorted by symbol: new thunk 301, later thunks shifted by one, count 310). The firstbuildrewrites them if I got a byte wrong;compiler/tests/bytecode.test.trbandnatives.test.trbcompare them.runtime/tests/tls_test.c: loopback handshake; the client's call returns the length and bytes of the first block oftest_server_certificate(decoded in the test), the server's returns 0, a session before the handshake, handle 0, an unknown handle and a closed session return 0.std/,seed/,tests/conformance/.Test
Not run locally: this box has no C toolchain and no
torb. Everything below is CI-verified only (forge CI of the head commit): the C compile oftls.c,machine_natives.candtls_test.c, the C test,compiler/tests/natives.test.trb(row, counts, header drift) andbytecode.test.trb(thunk table drift), tier A and tier B (runtime/touched).Seed
Yes, a new native: commit 1 of the two-commit rule. After the merge a seed must be published (forge
seedworkflow or the nightly) before #463 can start; that is not part of this PR.Checklist on
57ea45b:mbedtls_ssl_get_peer_certrun undertorb_tls_lock; handshake-over, NULL and zero-length guarded; appends the leaf only; returns the length. The hand-written generated files are consistent: new thunk 301 sorted between notify_close and protocol, later thunks shifted by one, table and count 310, header row sorted; the drift tests pass.Non-blocking:
Closes #116will close the issue on merge, but its acceptance criteria (std/tls declaration, FIRST-PARTY.md gap 18 marked done) are delivered by #463. ConsiderRefs #116and closing via #463.