1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-14 17:47:33 -05:00

Add more variants of SHAKE.

This adds a ssh_hashalg defining SHAKE256 with a 32-byte output, in
addition to the 114-byte output we already have.

Also, it defines a new API for using SHAKE128 and SHAKE256 in the more
general form of an extendable output function, which is to say that
you still have to put in all the input before reading any output, but
once you start reading output you can just keep going until you have
enough.

Both of these will be needed in an upcoming commit implementing ML-KEM.
This commit is contained in:
Simon Tatham
2024-12-07 19:32:46 +00:00
parent f08da2b638
commit 16629d3bbc
6 changed files with 104 additions and 1 deletions

View File

@ -264,6 +264,10 @@ FUNC(void, ssh_hash_update, ARG(val_hash, h), ARG(val_string_ptrlen, data))
FUNC(opt_val_hash, blake2b_new_general, ARG(uint, hashlen))
FUNC(val_shakexof, shake128_xof_from_input, ARG(val_string_ptrlen, input))
FUNC(val_shakexof, shake256_xof_from_input, ARG(val_string_ptrlen, input))
FUNC_WRAPPED(val_string, shake_xof_read, ARG(val_shakexof, xof), ARG(uint, size))
/*
* The ssh2_mac abstraction. Note the optional ssh_cipher parameter
* to ssh2_mac_new. Also, again, I've invented an ssh2_mac_update so