d1409c84bc
Three encoding bugs found by IETF interop test vectors: 1. ExpandWithLabel: label and context length prefixes must use QUIC-style variable-length integer encoding (VarInt), not fixed-size opaque prefixes. Values < 64 use 1 byte, 64-16383 use 2 bytes with 0x40 prefix. This is critical when GroupContext (112+ bytes) is passed as context. 2. RefHash: label and value also use VarInt-prefixed opaque fields, matching the MLS TLS codec convention. 3. SecretTree: DeriveTreeSecret must pass the generation counter as a uint32 big-endian context parameter, not empty context. This affects key/nonce derivation and ratchet advancement. Also fixes: - SignContent and EncryptWithLabel/DecryptWithLabel info encoding updated to use VarInt - KeySchedule test updated to use initial_init_secret from test vector (not hardcoded zeros) - Added putOpaqueVarInt() to TlsWriter for QUIC-style VarInt encoding https://claude.ai/code/session_01NocQDWj2Y92FugjfgazzL3