On Thu, Aug 27, 2026 at 06:40:01PM -0700, Vicki Pfau wrote:
quoted
There's no need to use crypto_shash. Just call the SHA-256 and
HMAC-SHA256 functions (<crypto/sha2.h>) directly.
This code was originally written by someone else more familiar with
these functions than me, but it looks like shash_transcript gets
finalized repeatedly without being reset. See
gip_security_get_transcript, which exports the state, finalizes it,
then rolls back the state before finalizing it. I don't think this can
be done with the basic sha2 functions.
What do you mean? In the library the context is just a plain struct, so
you can just make a copy of it if needed. Like this:
static void gip_security_get_transcript(const struct sha256_ctx *ctx,
u8 transcript[GIP_SECURITY_TRANSCRIPT_LEN])
{
struct sha256_ctx tmp = *ctx;
sha256_final(&tmp, transcript);
}
- Eric