Linux Input/HID development
 help / color / mirror / Atom feed
From: Vicki Pfau <vi@endrift.com>
To: Eric Biggers <ebiggers@kernel.org>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>, linux-input@vger.kernel.org
Subject: Re: [PATCH v4 07/12] Input: xbox_gip - Add security implementation from xone
Date: Thu, 27 Aug 2026 18:40:01 -0700	[thread overview]
Message-ID: <e554318e-77ab-496f-ab85-c2c5d7273eed@endrift.com> (raw)
In-Reply-To: <20260824214933.GA399653@google.com>

Hi Eric,

On 8/24/26 2:49 PM, Eric Biggers wrote:
> On Fri, Aug 21, 2026 at 07:11:31PM -0700, Vicki Pfau wrote:
>> +int gip_security_start_handshake(struct gip_security *security)
>> +{
>> +	struct shash_desc *shash_transcript, *shash_prf;
>> +
>> +	if (!security->shash_transcript) {
>> +		shash_transcript = gip_security_alloc_shash("sha256");
>> +		if (IS_ERR(shash_transcript))
>> +			return PTR_ERR(shash_transcript);
>> +
>> +		security->shash_transcript = shash_transcript;
>> +	}
>> +
>> +	if (!security->shash_prf) {
>> +		shash_prf = gip_security_alloc_shash("hmac(sha256)");
>> +		if (IS_ERR(shash_prf)) {
>> +			crypto_free_shash(shash_transcript->tfm);
>> +			kfree(shash_transcript);
>> +			security->shash_transcript = NULL;
>> +			return PTR_ERR(shash_prf);
>> +		}
>> +
>> +		security->shash_prf = shash_prf;
>> +	}
> 
> 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. I might be able to do it with the HMAC though. I'd need to familiarize myself with the API first.> 
> - Eric

Vicki


  reply	other threads:[~2026-08-28  1:40 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-22  2:11 [PATCH v4 00/12] Input: xbox_gip - Add new driver for Xbox GIP Vicki Pfau
2026-08-22  2:11 ` [PATCH v4 01/12] " Vicki Pfau
2026-08-22  2:38   ` sashiko-bot
2026-08-22  2:11 ` [PATCH v4 02/12] Input: xpad - Remove Xbox One support Vicki Pfau
2026-08-22  2:41   ` sashiko-bot
2026-08-22  2:11 ` [PATCH v4 03/12] Input: xbox_gip - Add controllable LED support Vicki Pfau
2026-08-22  2:37   ` sashiko-bot
2026-08-22  2:11 ` [PATCH v4 04/12] Input: xbox_gip - Add HID relaying Vicki Pfau
2026-08-22  2:38   ` sashiko-bot
2026-08-22  2:11 ` [PATCH v4 05/12] Input: xbox_gip - Add battery support Vicki Pfau
2026-08-22  2:38   ` sashiko-bot
2026-08-22  2:11 ` [PATCH v4 06/12] Input: xbox_gip - Allow sending fragmented and ACME messages Vicki Pfau
2026-08-22  2:39   ` sashiko-bot
2026-08-22  2:11 ` [PATCH v4 07/12] Input: xbox_gip - Add security implementation from xone Vicki Pfau
2026-08-22  2:35   ` sashiko-bot
2026-08-24 21:49   ` Eric Biggers
2026-08-28  1:40     ` Vicki Pfau [this message]
2026-08-28  1:50       ` Eric Biggers
2026-08-28  1:51         ` Vicki Pfau
2026-08-22  2:11 ` [PATCH v4 08/12] Input: xbox_gip - Add arcade stick support Vicki Pfau
2026-08-22  2:38   ` sashiko-bot
2026-08-22  2:11 ` [PATCH v4 09/12] Input: xbox_gip - Add support for PDP guitar controllers Vicki Pfau
2026-08-22  2:30   ` sashiko-bot
2026-08-22  2:11 ` [PATCH v4 10/12] Input: Add ABS_CLUTCH, HANDBRAKE, and SHIFTER Vicki Pfau
2026-08-22  2:38   ` sashiko-bot
2026-08-22  2:11 ` [PATCH v4 11/12] HID: Map more automobile simulation inputs Vicki Pfau
2026-08-22  2:11 ` [PATCH v4 12/12] Input: xbox_gip - Add wheel support Vicki Pfau
2026-08-22  2:54   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e554318e-77ab-496f-ab85-c2c5d7273eed@endrift.com \
    --to=vi@endrift.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=ebiggers@kernel.org \
    --cc=linux-input@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox