Thread (28 messages) flat view 28 messages, 3 authors, 11d ago

Re: [PATCH v4 07/12] Input: xbox_gip - Add security implementation from xone

From: Eric Biggers <ebiggers@kernel.org>
Date: 2026-08-28 01:50:03

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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help