From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0BA7ACDB465 for ; Sat, 14 Oct 2023 11:41:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232977AbjJNLls (ORCPT ); Sat, 14 Oct 2023 07:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233183AbjJNLlo (ORCPT ); Sat, 14 Oct 2023 07:41:44 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C152BDA for ; Sat, 14 Oct 2023 04:41:39 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0DDE921A99; Sat, 14 Oct 2023 11:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1697283698; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y9uZ51ZUb5gL4y/Lhq+1cbuZunfyPPyvTfq17MbiPl8=; b=KMi9ugVkDPC+8MgANOzVmNvZv+4MdqoxeIuFxiHS8RBVaASoawOwgRLLtA3Llf419h5gSe tzHz/p1c4cf/7uQ5ncnj2XKKI+HU3UjTAf2f9IPqztdVdehU3IkQy5uVUAx0fBGHGa0U9K 1jzTplltV9Vi9b89GKkM8H+pn2KLkrk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1697283698; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y9uZ51ZUb5gL4y/Lhq+1cbuZunfyPPyvTfq17MbiPl8=; b=GQWDRth9A5gxQOmTOsERHf1BKbyHpVz1ypNdqyreaHSb75yHcN+eQjUbdLJy7DG0uByLnQ lqXCZE8JIbQG9VBg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 8F4091377D; Sat, 14 Oct 2023 11:41:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eLy+IHF+KmWzNAAAMHmgww (envelope-from ); Sat, 14 Oct 2023 11:41:37 +0000 Message-ID: Date: Sat, 14 Oct 2023 13:41:38 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] nvme-auth: allow mixing of secret and hash lengths Content-Language: en-US To: Mark O'Donovan , linux-kernel@vger.kernel.org Cc: linux-nvme@lists.infradead.org, sagi@grimberg.me, hch@lst.de, axboe@kernel.dk, kbusch@kernel.org, Akash Appaiah References: <20231013202827.2262708-1-shiftee@posteo.net> <20231013202827.2262708-3-shiftee@posteo.net> From: Hannes Reinecke In-Reply-To: <20231013202827.2262708-3-shiftee@posteo.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Authentication-Results: smtp-out1.suse.de; none X-Spamd-Result: default: False [-9.70 / 50.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; BAYES_HAM(-1.61)[92.49%]; MIME_GOOD(-0.10)[text/plain]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-3.00)[-1.000]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCPT_COUNT_SEVEN(0.00)[8]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/13/23 22:28, Mark O'Donovan wrote: > We can now use any of the secret transformation hashes with a > secret, regardless of the secret size. > e.g. a 32 byte key with the SHA-512(64 byte) hash. > > The example secret from the spec should now be permitted with > any of the following: > DHHC-1:00:ia6zGodOr4SEG0Zzaw398rpY0wqipUWj4jWjUh4HWUz6aQ2n: > DHHC-1:01:ia6zGodOr4SEG0Zzaw398rpY0wqipUWj4jWjUh4HWUz6aQ2n: > DHHC-1:02:ia6zGodOr4SEG0Zzaw398rpY0wqipUWj4jWjUh4HWUz6aQ2n: > DHHC-1:03:ia6zGodOr4SEG0Zzaw398rpY0wqipUWj4jWjUh4HWUz6aQ2n: > > Note: Secrets are still restricted to 32,48 or 64 bits. > > Co-developed-by: Akash Appaiah > Signed-off-by: Akash Appaiah > Signed-off-by: Mark O'Donovan > --- > drivers/nvme/common/auth.c | 8 -------- > 1 file changed, 8 deletions(-) > > diff --git a/drivers/nvme/common/auth.c b/drivers/nvme/common/auth.c > index d90e4f0c08b7..176855f86f0d 100644 > --- a/drivers/nvme/common/auth.c > +++ b/drivers/nvme/common/auth.c > @@ -187,14 +187,6 @@ struct nvme_dhchap_key *nvme_auth_extract_key(unsigned char *secret, > goto out_free_secret; > } > > - if (key_hash > 0 && > - (key_len - 4) != nvme_auth_hmac_hash_len(key_hash)) { > - pr_err("Mismatched key len %d for %s\n", key_len, > - nvme_auth_hmac_name(key_hash)); > - ret = -EINVAL; > - goto out_free_secret; > - } > - > /* The last four bytes is the CRC in little-endian format */ > key_len -= 4; > /* That, however, looks good. Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew Myers, Andrew McDonald, Martje Boudien Moerman