Skip to content

feat: allow serializing handshake state - #217

Open
Stypox wants to merge 2 commits into
mcginty:mainfrom
Stypox:serialize-handshake-state
Open

feat: allow serializing handshake state#217
Stypox wants to merge 2 commits into
mcginty:mainfrom
Stypox:serialize-handshake-state

Conversation

@Stypox

@Stypox Stypox commented Aug 26, 2026

Copy link
Copy Markdown
  • adds feature "serde" which enables serialization for HandshakeState, to e.g. save the state to disk for handshakes that take a long time to complete
  • this required making a lot of things serializable across the codebase
  • since the Random, Dh, Cipher, Hash, Kem traits are all used dynamically, I used the typetag trait to serialize those
  • serde only supports bytestrings up to 32 bytes, so I used serde_bytes for longer ones
  • for common hash types I made a wrapper that bridges between serde and the crypto libraries' SerializableState
  • blake2 and blake3 do not implement SerializableState unfortunately, so in my first commit they are not enabled when the serde feature is passed
  • my second commit brings support for serialization for blake2 as well, although the upstream PR is still pending: blake2: implement SerializableState RustCrypto/hashes#906 (so the cargo dependency currently points to my fork)

Thanks for your work on Snow!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant