Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp2386708rdh; Sun, 29 Oct 2023 13:49:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE17t2ta9/ZEM+hZ2zNq+AmG71JGLULryiggmF3K+ogojPWBxMoJZSf0nG3SiMt8rXtCCam X-Received: by 2002:a17:903:68d:b0:1ca:7439:f74f with SMTP id ki13-20020a170903068d00b001ca7439f74fmr7498618plb.60.1698612545697; Sun, 29 Oct 2023 13:49:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698612545; cv=none; d=google.com; s=arc-20160816; b=iHqrpDor5y7ggr6ef08+SMfapQ7RfUwggDpSRqrWSKCP223ciQlo9a9sRfWE2NtZ0L ZG/5h5THOJa7enapwtmgrKrOYoGU0Uo/yEctVsnFnmFKoY3oLIDk0EWrA0MGk2ZsZRCD w92FcUisFNqoTThbWl7Qg0U5f0+yoUoB6pHeE76OUrCuxUhJ2byJ3hc7swfUzuSddcPH X/dfRvZ+H5lU21sUb9zikSNR5MPxK8do1sLr3KisEE+JI0zD64xcabpblF/aZnrKVsob IgDqLc+jyVipXxfTbXJQ7HYuDB06vIyj0Pklpr3TYB32+okk8rWYi/P4o2KQDLUQdw/x SxkQ== 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=D+t9WK33ZVldEiPiicjGvkN9bUf9a57a5jRCbansvZI=; fh=vuLyyPVb2Mo4AAl5/uguxnQsONgP2iWW1OJKGUZe0Ck=; b=wpcrsPeJ15d/7rn2HWN7EmY7b0+SN2jIfaz9Df/F+BbHOP9+i6gV5Pz3b2vuhQmpEj 9hjZDviZyML4LumdmHRjGcIXpq6W1gBKCJhVLFzRMYX2o8g8Ze+dEDMAPo7TpHH6ew7L x/SmVvNbH3hOlO2F51zDXimpH0/lV25kNgnT1cTY2RutAQnpQ35YnifSxzs1YA6LLlPm oqOVOfy8WrJhWNpWnGUPT/+Ibb7BrKUx3Jr4npTlogJDbGJyiQp2JlFp6BnRB6pXfBNF B3033wANuQZ7zwypX8BhWEem8//6pwQUgvxwZBubuj1D8WjSfVhxwhaqK5wTHGVEFB7T zu8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=mJJ1Desx; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id iy9-20020a170903130900b001c9b0be1391si4094983plb.614.2023.10.29.13.49.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 13:49:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=mJJ1Desx; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 7E2AF8088A8E; Sun, 29 Oct 2023 13:48:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230440AbjJ2Usw (ORCPT + 99 others); Sun, 29 Oct 2023 16:48:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230382AbjJ2Usu (ORCPT ); Sun, 29 Oct 2023 16:48:50 -0400 Received: from smtp-relay-internal-0.canonical.com (smtp-relay-internal-0.canonical.com [185.125.188.122]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77301E9 for ; Sun, 29 Oct 2023 13:48:45 -0700 (PDT) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 8B1B63FD43 for ; Sun, 29 Oct 2023 20:48:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1698612522; bh=D+t9WK33ZVldEiPiicjGvkN9bUf9a57a5jRCbansvZI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=mJJ1DesxL5h7yD2e+dj0Bt7Rf0uR30tQWbKWMVrs7RpZPt0x0VTQzcBbAldUv1Jzg g+dRrFBcDwcFAO2563QVNeKUl2w62anucHFjS10I4aPhwQI6oWz3SQZB9wgABps2vY c/MQCS/NZ/WP9RmMKI/KNQtuBrsMkp4rznZTBYvDPkM7NLOPy80h8EB08E16Zxl8sN pU0suALW5hrNa8vo9nSAfQZ1adt2d/Y6qCT+2TVkMISL7WMQY9ZzfwrYSCnnezm9OQ dVL8yJZu7FtS6E/LPwqJYA7+pb4ph5/Y3yDu1dx5XlTlnS+TJikM4hPdsh+3y/Ht21 45dHeHvETzx1g== Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-32f521150aaso1819523f8f.1 for ; Sun, 29 Oct 2023 13:48:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698612517; x=1699217317; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D+t9WK33ZVldEiPiicjGvkN9bUf9a57a5jRCbansvZI=; b=M4AcdxX6TzvQBsnI0S6QV+QnTCbanMeW7TQ99dNv0ws/X0yRJ6YQfEHMrl/3SFshHr hz8TJu+VZARA2Rwkk50Mm6qpsgvN2aG8y8V5ZUU7P5w3S3trqOXr1qlQ9t7YGJfXx5hk hwAqWFmnxpTvKMFd8FgmWIq59iPAXBLU5L4BNKY6XXvT+hNIXJIySmNLVPg9d7wZck71 ynuJnStscY+xcw/nkF2+F3fkb0hFiDp8vzCbmDezouarHC+qtt4s17uIEY3SxRU56ykw WImzu/DB0A95mvpkZdwUCbVivSv+1VMPCfq160LwfmefXHBAzDTchQbewHsVe+BcHmWR kNXg== X-Gm-Message-State: AOJu0YzwHOjzs6NrgpHdcEBkYYuudkW8ioTUkmiNG1CVOaKuJpmONcI3 IyIlGcvXQ2SzuMu+93RsoY/gCY7cx19CkKPSU/UDSEKxpbA4CzlSGrMLOOQ7Q0RMGNeaK94L4AK SrloxbuXnzIP1Xtgg8t2NIHjJZcgqDoN6cE67X6sNpw== X-Received: by 2002:a05:6000:186c:b0:32f:7c4a:4f28 with SMTP id d12-20020a056000186c00b0032f7c4a4f28mr3694526wri.65.1698612517401; Sun, 29 Oct 2023 13:48:37 -0700 (PDT) X-Received: by 2002:a05:6000:186c:b0:32f:7c4a:4f28 with SMTP id d12-20020a056000186c00b0032f7c4a4f28mr3694518wri.65.1698612517100; Sun, 29 Oct 2023 13:48:37 -0700 (PDT) Received: from localhost ([2001:67c:1560:8007::aac:c15c]) by smtp.gmail.com with ESMTPSA id y2-20020adffa42000000b0032f7f4089b7sm3382079wrr.43.2023.10.29.13.48.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Oct 2023 13:48:36 -0700 (PDT) From: Dimitri John Ledkov To: Herbert Xu , "David S. Miller" , simo Sorce , =?UTF-8?q?Stephan=20M=C3=BCller?= Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/4] crypto: drbg - ensure drbg hmac sha512 is used in FIPS selftests Date: Sun, 29 Oct 2023 22:48:22 +0200 Message-Id: <20231029204823.663930-3-dimitri.ledkov@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231029204823.663930-1-dimitri.ledkov@canonical.com> References: <20231029204823.663930-1-dimitri.ledkov@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.3 required=5.0 tests=DKIMWL_WL_HIGH,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 fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 29 Oct 2023 13:48:59 -0700 (PDT) Update code comment, self test & healthcheck to use HMAC SHA512, instead of HMAC SHA256. These changes are in dead-code, or FIPS enabled code-paths only and have not effect on usual kernel builds. On systems booting in FIPS mode that has the effect of switch sanity selftest to HMAC sha512 based (which has been the default DRBG). Fixes: 9b7b94683a ("crypto: DRBG - switch to HMAC SHA512 DRBG as default DRBG") Signed-off-by: Dimitri John Ledkov --- crypto/drbg.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crypto/drbg.c b/crypto/drbg.c index b120e2866b..99666193d9 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c @@ -111,9 +111,9 @@ * as stdrng. Each DRBG receives an increasing cra_priority values the later * they are defined in this array (see drbg_fill_array). * - * HMAC DRBGs are favored over Hash DRBGs over CTR DRBGs, and - * the SHA256 / AES 256 over other ciphers. Thus, the favored - * DRBGs are the latest entries in this array. + * HMAC DRBGs are favored over Hash DRBGs over CTR DRBGs, and the + * HMAC-SHA512 / SHA256 / AES 256 over other ciphers. Thus, the + * favored DRBGs are the latest entries in this array. */ static const struct drbg_core drbg_cores[] = { #ifdef CONFIG_CRYPTO_DRBG_CTR @@ -1475,8 +1475,8 @@ static int drbg_generate(struct drbg_state *drbg, int err = 0; pr_devel("DRBG: start to perform self test\n"); if (drbg->core->flags & DRBG_HMAC) - err = alg_test("drbg_pr_hmac_sha256", - "drbg_pr_hmac_sha256", 0, 0); + err = alg_test("drbg_pr_hmac_sha512", + "drbg_pr_hmac_sha512", 0, 0); else if (drbg->core->flags & DRBG_CTR) err = alg_test("drbg_pr_ctr_aes256", "drbg_pr_ctr_aes256", 0, 0); @@ -2023,7 +2023,7 @@ static inline int __init drbg_healthcheck_sanity(void) drbg_convert_tfm_core("drbg_nopr_sha256", &coreref, &pr); #endif #ifdef CONFIG_CRYPTO_DRBG_HMAC - drbg_convert_tfm_core("drbg_nopr_hmac_sha256", &coreref, &pr); + drbg_convert_tfm_core("drbg_nopr_hmac_sha512", &coreref, &pr); #endif drbg = kzalloc(sizeof(struct drbg_state), GFP_KERNEL); -- 2.34.1