You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5fd317d
Browse filesBrowse the repository at this point in the historyBrowse files
feat(golang)!: the crypto guest steps instead of blocking on transport_send, and the client drives it outside its lock
The crypto guest no longer imports transport_send. An export that can
reach ZeroKMS (se_cipher_init, se_keyset, se_term, se_encrypt_record,
se_decrypt_record, se_query_term) runs its work through the step loop:
done, it returns its output as before; waiting on a request, it returns
STATUS_NEEDS_IO, the host takes the handle and requests with se_io,
performs them and calls se_resume with the responses, or gives up with
se_abort. A step and the responses are transport frames read and written
with serde (the guest's io module). Each paused operation owns its inputs,
plaintext included, and shares the cipher through an Rc, so se_shutdown
drops every paused operation before the cipher and its wipe is the last
owner's. A second se_cipher_init is refused while one is paused.
The Go client drives the loop. It holds its lock for each step only, and
performs the requests with the lock free, so other callers run meanwhile
instead of queuing behind a round trip. Each step runs under a context that
cannot be cancelled, so the runtime never closes the module under a caller
who gave up; the context is checked between steps, and an operation whose
caller has gone is aborted in the guest. The token is fetched before each
step, outside the lock, and token_get only hands it over. Steps of
different operations may interleave; a step is read from the guest before
the lock is released.
Tests: the import surface is token_get alone; one load-keyset request is
one step and spends its handle; a call runs while another's request is in
flight; a caller that gives up mid-request gets its context's error, the
operation is gone and the client still works; an ended context never
starts a call; the token is fetched outside the lock; an init paused and
aborted leaves neither the client key nor the bearer token in guest memory
(and without the abort, the bearer remains, so the test can fail).
Refs #1064.
0 commit comments