Message ID | 20231016225857.3085234-4-shiftee@posteo.net |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3772302vqb; Mon, 16 Oct 2023 16:00:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGhuPlXOA+N4iG/Q5ufwFzWFkjjDPtQ7H0xlV8IpDtEsAIX+kILOV+vvBxo6XihAT5dDBPS X-Received: by 2002:a17:902:e80c:b0:1c4:1e65:1e5e with SMTP id u12-20020a170902e80c00b001c41e651e5emr742364plg.0.1697497245466; Mon, 16 Oct 2023 16:00:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697497245; cv=none; d=google.com; s=arc-20160816; b=Nnwy3X0J+gnfJD4HCquhzdqnEvOBnwnBULLF+aWpdhv7hsd4OGeMm2VWfg/txVGc0S x/y3ruWq/CtXQkMm3VglIHbD+KgMttBTKrm81YE6CyYb9STD+xqI9e/HazJauGo6mvJQ GV17F1qRxxlmYLflS5sbl0S+mctbAfOQXdhkBD0EOCleQq8VUO4zHUcyjXFsAZubG4po DYQIrzE+X/tGyuR3oR41qa24ESQPS17F1l+H+XloTYPpeU5l17SDLp136eYGSsUHwtUV 0j4IUEuLg/hAxPj5msCrb0s8jI5kn064TWFGQ63E8+cnt7K1apTxgbndTGY0hEt441DM DJFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=CMSvdMv5ORPzvcdgmy/csbGYAGQ7uVpCgqzYGAKIR+k=; fh=OK6NlIuxAObXnbB+YsmCJIFQ9spAlQ71xiCElZ04Vio=; b=VqbFE4eMO0Btxi2rvNORAgt7lEIW9XFFmmFGPEFz+Cp7fO5+zu+nDuDFpX53N4I10v WpCKRTdd0I2PQukG/cQdzAIzdJYaMkzexPtqmM0enh1+lfwXqfzqWbgznQO7Y15q02Cb yfCrep9zx8GgCc/7s7vEEkRZsXNibl4fHJBRXlokANvOdTJPwJfPEYstWHSYHEhouQ9P YAnvQhAD8BfwDglFemSM265D0TEI3/byKQZapn1V6e9m3Lq127wrNoxa2SJp+KEq9G3g ZRT3f4llOZqCEG0Yaz8K03Ow/yQYvp4GYrZgzjBtwBV3wU0+sOiLLW7Wym0G2zqVL0I8 9+/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b="mFwnzH/d"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id d13-20020a170902c18d00b001ca86fa1e1csi318775pld.484.2023.10.16.16.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 16:00:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b="mFwnzH/d"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 2DEA48043999; Mon, 16 Oct 2023 16:00:38 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232996AbjJPXAI (ORCPT <rfc822;hjfbswb@gmail.com> + 18 others); Mon, 16 Oct 2023 19:00:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233949AbjJPXAB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 16 Oct 2023 19:00:01 -0400 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE3D495 for <linux-kernel@vger.kernel.org>; Mon, 16 Oct 2023 15:59:59 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 7A71D240028 for <linux-kernel@vger.kernel.org>; Tue, 17 Oct 2023 00:59:58 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1697497198; bh=e/5Tq8mpMYFzV9iwEEcLoCLz0k+o4VrsmcZ/cYdtLww=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From; b=mFwnzH/dCSbg254F+1fJ/qnNuV9LnSM9dAXfq4u+EzeUtGgSte60xd6Pp0ArZ9Fk+ kc+DoD7qHcW6vQXObYxgEIJIKcBhkw+F74AJ10Ubrcr3I5T6ZJv7+EGS2sESsBd4q0 vPESqkUkInNmBOuFUamKVnp4iAfVdgt8tGdRuxHuzHiomI9LJqbW7QcqqIwG6VjErw JXj3OPW0VIttmEusrAnzxLYKuPeC30Bqe1segyOb/xp41bTQBigoEV9avfPm2c3m9z xJsc+fz7R4NFN4H0Ml/t/NiDkZtU8LOd07RneZ5eNR3yNgRKSIzhq+41C8iGZW1+7T 07Ydq+M9ydyJw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4S8Xcs0mk7z9rxR; Tue, 17 Oct 2023 00:59:57 +0200 (CEST) From: Mark O'Donovan <shiftee@posteo.net> To: linux-kernel@vger.kernel.org Cc: linux-nvme@lists.infradead.org, sagi@grimberg.me, hch@lst.de, axboe@kernel.dk, kbusch@kernel.org, hare@suse.de, Mark O'Donovan <shiftee@posteo.net>, Akash Appaiah <Akash.Appaiah@dell.com> Subject: [PATCH v3 3/3] nvme-auth: allow mixing of secret and hash lengths Date: Mon, 16 Oct 2023 22:58:57 +0000 Message-Id: <20231016225857.3085234-4-shiftee@posteo.net> In-Reply-To: <20231016225857.3085234-1-shiftee@posteo.net> References: <20231016225857.3085234-1-shiftee@posteo.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 16 Oct 2023 16:00:38 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779954871740933929 X-GMAIL-MSGID: 1779954871740933929 |
Series |
Remove secret-size restrictions for hashes
|
|
Commit Message
Mark O'Donovan
Oct. 16, 2023, 10:58 p.m. UTC
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 <Akash.Appaiah@dell.com> Signed-off-by: Akash Appaiah <Akash.Appaiah@dell.com> Signed-off-by: Mark O'Donovan <shiftee@posteo.net> Reviewed-by: Hannes Reinecke <hare@suse.de> --- 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 647931acc1ba..c2273bc0fa56 100644 --- a/drivers/nvme/common/auth.c +++ b/drivers/nvme/common/auth.c @@ -182,14 +182,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; /*