Received: by 2002:a05:6500:1b41:b0:1fb:d597:ff75 with SMTP id cz1csp371236lqb; Tue, 4 Jun 2024 14:03:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU+LMf3Mm3LGREu9zv0wtKkLDMmsleREuCQ76NmnhrNy8VAtqe7LZSKy2L5Wm0dqWjl+n/moUJ191+6FUsjiIeNB3JUc7iukfBL/6NCFw== X-Google-Smtp-Source: AGHT+IG/5SXZC8fdVoE3vpDlWfefgsSsTRCdxn8uaiFH9KPI6tEPcJFZ/5xJb1KlFkuZ5hexAmMJ X-Received: by 2002:a05:6a20:7283:b0:1b2:b5d1:4ee9 with SMTP id adf61e73a8af0-1b2b6fa269dmr1015305637.24.1717535028958; Tue, 04 Jun 2024 14:03:48 -0700 (PDT) Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35cdeddacsi9114791a12.789.2024.06.04.14.03.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jun 2024 14:03:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4727-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=neutral (bad format) header.i=@oracle.com; dkim=pass header.i=@oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="MyF7s/PD"; arc=fail (signature failed); spf=pass (google.com: domain of linux-crypto+bounces-4727-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4727-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=oracle.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AC736B211BF for ; Tue, 4 Jun 2024 21:03:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9DF02149018; Tue, 4 Jun 2024 21:03:37 +0000 (UTC) X-Original-To: linux-crypto@vger.kernel.org Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7AD84140375; Tue, 4 Jun 2024 21:03:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=205.220.165.32 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717535017; cv=fail; b=jzQ/+8ThX5fom+m7S5FJ18qkb4aLI5VilMFV0CCKCB9SdSkzGiHyb7FUJNisoTZ5TU1pdDSDLCWzQrfsCQ6tunpDhc5Eyi3gwjW7O/W4EldWIwLkys1yJyMj6xhYAEsfNpYhmlXavjxCBwXWxoN/ezJ8pnLUPJf+s2luYAZuXtw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717535017; c=relaxed/simple; bh=q7e5kXHWtKtlgglSBsXGZ7gy/oFdM5enn9PFd+AQ2UI=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=uM2MtJvQhy6pBuZBKBixlJmZkRDkG1lglH9dgDz9ir6RYoVzY3pMgj+0fqCsah1b1xljZWSW3Ikghq7hfKx6F1Ic5m7iliv+jR0iLSHU+648ZgwrjdN8+kK+rNa2FUqvFX1s2ParAIqajBP0rvKzAgOW9SbhCVEMzUVcJlSUkrg= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com; spf=pass smtp.mailfrom=oracle.com; arc=fail smtp.client-ip=205.220.165.32 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=oracle.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oracle.com Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 454JYqtA027777; Tue, 4 Jun 2024 21:03:00 GMT DKIM-Signature: =?UTF-8?Q?v=3D1;_a=3Drsa-sha256;_c=3Drelaxed/relaxed;_d=3Doracle.com;_h?= =?UTF-8?Q?=3Dcc:content-transfer-encoding:content-type:date:from:in-reply?= =?UTF-8?Q?-to:message-id:mime-version:references:subject:to;_s=3Dcorp-202?= =?UTF-8?Q?3-11-20;_bh=3Dgq2RqRj6QYVnN/86+DJf/HnKi+Uo2+DvS7LECwLjI48=3D;_b?= =?UTF-8?Q?=3DAOAStYwU/mCHbWoZIIasupouK/+1+srsd1HsdgBnbSMycj+1IGU+uUeuDCnX?= =?UTF-8?Q?gwTC6BuG_dRbARdk6UvF7uueElCbrYiw2iBFNjd9yvthjLkSaLA1gk7isZCmewE?= =?UTF-8?Q?Hg3SseVEiTYhgD_Hjg5N/5kDZiWexmGpnTzLo8xe0rxLy5OhvNaw3JefWeuQmXV?= =?UTF-8?Q?dGq67ro0CYfJt6BgFpjj_guLIKQes2WaWLPLI3B1/KR0gwpjJJ0/ydbO7kG3ZCx?= =?UTF-8?Q?AlOF82p665BWQW7H0qtsm61PX7_33xGC7UcxgrjQrV2jiqZ1JXXJMAKj3dpzMRn?= =?UTF-8?Q?YKtgOFqNdZuxyA4r2nSeFn14PGvyfwDE_8Q=3D=3D_?= Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3yfv07wxft-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 04 Jun 2024 21:02:59 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 454L1KnD023917; Tue, 4 Jun 2024 21:02:58 GMT Received: from nam11-co1-obe.outbound.protection.outlook.com (mail-co1nam11lp2168.outbound.protection.outlook.com [104.47.56.168]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3ygrqxd1gh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 04 Jun 2024 21:02:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n43b9qc74LZN6MYLUe5KLsdH6t25Hp5K/v70o8tCBLACF0LM33Tnoc/xTnhR0ldlhZorS5paKzj40lETCNTllaW+Gxuam1DVBK5T6Gu/QWxVgegcEzuYCOvbBlCwcDIGZ1l6qn27lVhgyRH49pPX/vTQSFqDmMAnFnzEd/usnG65gq7h22I0c2QIBP9M0Wwj8IbX/v3FVMAcJ3kssOeeT/eoEtUe0uRZNguJTz6i7M4jDpiT5pd1mbgzAPrA4450sk/mMRKlp901jOwIBUzgp3OBcvJ6a6UKi4Y6/F9DcBFFWR3GDK960rFjdH6nS8vBUdOrcZXgnfLskxYtHt0ndA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=gq2RqRj6QYVnN/86+DJf/HnKi+Uo2+DvS7LECwLjI48=; b=XyMzHCC8wedgNjQUBmmPVXQVAjdyHuVbqN9kFZxu74JO3/vdmuIOaSh5as0D/vda7HvqbI6KQCl7rDIDXrgdysKuab3Vh7n3+z1sPoAkt8KxC+HDB+rXVz+bB1M5FWw0KWabDCgeBksNu4wLLXxhEL0ia8N10m2g02QKBs8VxZqf/+xpsrU3eCD+3LYw1ctx629g2dyoyVzFFEfbSXf2PxhEZN+0gpE/G05VuWhmYW1riR+IARoHYt7aJTVVaAnjU0ow7NjRAUPBk++Df10NDKM0ZIO30tHk4t+mttvqpmXBz09rCEj1LNG9J5ZX2Xl2RAUwJJLm/yIIye01ViGmJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=gq2RqRj6QYVnN/86+DJf/HnKi+Uo2+DvS7LECwLjI48=; b=MyF7s/PD+kNgmUTfjjnXTn9AfHqRtjl1B+XXViBSJ+NewgRJMbKQ3+PJkufvla4TSkMUpeIp6SH7X36WP8wSzTiEkSxDXejqMZYLANmhsjTScV1WryoX1y2B1SZU3dfhliOmEkoVevqVqVRpjG7RNxqHMHxNVr9j4jj9sBRZLt8= Received: from DS0PR10MB7224.namprd10.prod.outlook.com (2603:10b6:8:f5::14) by IA1PR10MB7114.namprd10.prod.outlook.com (2603:10b6:208:3fd::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.27; Tue, 4 Jun 2024 21:02:52 +0000 Received: from DS0PR10MB7224.namprd10.prod.outlook.com ([fe80::c57:383f:cfb2:47f8]) by DS0PR10MB7224.namprd10.prod.outlook.com ([fe80::c57:383f:cfb2:47f8%6]) with mapi id 15.20.7633.021; Tue, 4 Jun 2024 21:02:51 +0000 Message-ID: <0ed3cdf6-2e4a-41f2-b2f6-363899405298@oracle.com> Date: Tue, 4 Jun 2024 14:02:47 -0700 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 06/19] x86: Add early SHA-1 support for Secure Launch early measurements To: Jarkko Sakkinen , linux-kernel@vger.kernel.org, x86@kernel.org, linux-integrity@vger.kernel.org, linux-doc@vger.kernel.org, linux-crypto@vger.kernel.org, kexec@lists.infradead.org, linux-efi@vger.kernel.org, iommu@lists.linux-foundation.org Cc: dpsmith@apertussolutions.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, dave.hansen@linux.intel.com, ardb@kernel.org, mjg59@srcf.ucam.org, James.Bottomley@hansenpartnership.com, peterhuewe@gmx.de, jgg@ziepe.ca, luto@amacapital.net, nivedita@alum.mit.edu, herbert@gondor.apana.org.au, davem@davemloft.net, corbet@lwn.net, ebiederm@xmission.com, dwmw2@infradead.org, baolu.lu@linux.intel.com, kanth.ghatraju@oracle.com, andrew.cooper3@citrix.com, trenchboot-devel@googlegroups.com, ross.philipson@oracle.com References: <20240531010331.134441-1-ross.philipson@oracle.com> <20240531010331.134441-7-ross.philipson@oracle.com> Content-Language: en-US From: ross.philipson@oracle.com In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SJ0PR03CA0032.namprd03.prod.outlook.com (2603:10b6:a03:33e::7) To DS0PR10MB7224.namprd10.prod.outlook.com (2603:10b6:8:f5::14) Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR10MB7224:EE_|IA1PR10MB7114:EE_ X-MS-Office365-Filtering-Correlation-Id: b07254d7-c27f-4942-8b9c-08dc84d9b254 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|7416005|366007|1800799015|376005; X-Microsoft-Antispam-Message-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ewycWeT9A1K70?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR10MB7224.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(7416005)(366007)(1800799015)(376005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aytJUnU2M0NxZTFHWVE4eHpVZ2dtSVlaVHpnS25adzRpbGFKNEhRSGxUQURy?= =?utf-8?B?WEFsQmhQbmxBN1ppYnNCVlc5RFdENmlYM1draFlKeXpVcFoxVk05ZlJvYytS?= =?utf-8?B?L0JuTjRXTmt4ckk1SVRWbkJoY2JKd3d4ZE9uSnU3eVk3eU0wejQ5SFZjdFhm?= =?utf-8?B?VUpPQmdINzNscGhqdkF1L1E2cUM3aGFadEN0ODJ0QXRtRkpoT1daN04rL2tn?= =?utf-8?B?L1hQYjZTWUNwSDMrMFhFVlRrL3FTTWxRaUxOdE1lbGdidkx0eS9DanMwYkpV?= =?utf-8?B?bGhWR2ozcEdPbUxteDBEcTdjV2ZBdjJuQTdHODNJK0hONklMaFJWOWNzOUdo?= =?utf-8?B?UUlLYklYS2tFQjEzdHNBZldaazZjUTNIMXRTSzU1aGlZWEJXYWxnSEtsZG1k?= =?utf-8?B?ditSaWhaVm55S3NRMi9jMjVwVWRWbktoOS8vcTIvUEVIWjlCVHZlZVVWKzcw?= =?utf-8?B?eDF1U2MwbUwwL3lCblhLQU9OZEZFV1RjMFlMMWJyZmhkR0pxZ3FReUIvMHF0?= =?utf-8?B?NHBkSlA5Wm5lZXNMWDNPWlh3V2lHWU1JaXZ1OEZiLzJjd2ZBOTJ6NjBGcTNw?= =?utf-8?B?cVVmL1BLVXdicTZ0N21TZlNwalB6eUlNZ25aZ0tHZ2swbFJsd2tkcVJQcmwv?= =?utf-8?B?UkFxWTJPaHh5TEM0eVJ6SXBsRWxKc21yU3h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0Dsx7lGdbiRMSYvNW7/AgLPQ4ytaBy3oaVexg0y1lWXFbL4OE0r4q3iplJSrwiQmNcyl8X5d6F6TQXSqxylb6AQPzckW2UdEfgGn+GjSp+Px5NF6LDKX+W/rkKxMeAreZPoplzHx7bXDwMJBDj0L1nFF0djvyBzd91gs8suwFF13ezC4Qya1hTMHvxKit/2mgVhaCKA02PAMlat9UMmAQfH2Ee1CfkGcO4o/LGzkfjhHs+iiNwS/XQWAuHANfuMIyuRPJIjB3rVHYNZMB28rOPqodZ58TLCTF0LXaTCQYLpAhBW1AVw5eHHvqt8OiUAs= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: b07254d7-c27f-4942-8b9c-08dc84d9b254 X-MS-Exchange-CrossTenant-AuthSource: DS0PR10MB7224.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jun 2024 21:02:51.6043 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xV6dn7NP50yxJ83a+/UfhhZQNCY35z71UXfXXY0rrguRwIAyvKZ3TIGQ5TjC7RE1cLDLIa6mwdiEMS2hI+xLV0akBX+ySRFCiG8j+re+4DM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB7114 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.28.16 definitions=2024-06-04_11,2024-06-04_02,2024-05-17_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 malwarescore=0 adultscore=0 phishscore=0 suspectscore=0 bulkscore=0 spamscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2405010000 definitions=main-2406040169 X-Proofpoint-GUID: hgQOLCd6slkk7nq_MEoRlFtYgpJs0ZNZ X-Proofpoint-ORIG-GUID: hgQOLCd6slkk7nq_MEoRlFtYgpJs0ZNZ On 6/4/24 11:52 AM, Jarkko Sakkinen wrote: > On Fri May 31, 2024 at 4:03 AM EEST, Ross Philipson wrote: >> From: "Daniel P. Smith" >> >> For better or worse, Secure Launch needs SHA-1 and SHA-256. The >> choice of hashes used lie with the platform firmware, not with >> software, and is often outside of the users control. >> >> Even if we'd prefer to use SHA-256-only, if firmware elected to start us >> with the SHA-1 and SHA-256 backs active, we still need SHA-1 to parse >> the TPM event log thus far, and deliberately cap the SHA-1 PCRs in order >> to safely use SHA-256 for everything else. >> >> The SHA-1 code here has its origins in the code from the main kernel: >> >> commit c4d5b9ffa31f ("crypto: sha1 - implement base layer for SHA-1") >> >> A modified version of this code was introduced to the lib/crypto/sha1.c >> to bring it in line with the SHA-256 code and allow it to be pulled into the >> setup kernel in the same manner as SHA-256 is. >> >> Signed-off-by: Daniel P. Smith >> Signed-off-by: Ross Philipson >> --- >> arch/x86/boot/compressed/Makefile | 2 + >> arch/x86/boot/compressed/early_sha1.c | 12 ++++ >> include/crypto/sha1.h | 1 + >> lib/crypto/sha1.c | 81 +++++++++++++++++++++++++++ >> 4 files changed, 96 insertions(+) >> create mode 100644 arch/x86/boot/compressed/early_sha1.c >> >> diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile >> index e9522c6893be..3307ebef4e1b 100644 >> --- a/arch/x86/boot/compressed/Makefile >> +++ b/arch/x86/boot/compressed/Makefile >> @@ -118,6 +118,8 @@ vmlinux-objs-$(CONFIG_EFI) += $(obj)/efi.o >> vmlinux-objs-$(CONFIG_EFI_MIXED) += $(obj)/efi_mixed.o >> vmlinux-objs-$(CONFIG_EFI_STUB) += $(objtree)/drivers/firmware/efi/libstub/lib.a >> >> +vmlinux-objs-$(CONFIG_SECURE_LAUNCH) += $(obj)/early_sha1.o >> + >> $(obj)/vmlinux: $(vmlinux-objs-y) FORCE >> $(call if_changed,ld) >> >> diff --git a/arch/x86/boot/compressed/early_sha1.c b/arch/x86/boot/compressed/early_sha1.c >> new file mode 100644 >> index 000000000000..8a9b904a73ab >> --- /dev/null >> +++ b/arch/x86/boot/compressed/early_sha1.c >> @@ -0,0 +1,12 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * Copyright (c) 2024 Apertus Solutions, LLC. >> + */ >> + >> +#include >> +#include >> +#include >> +#include >> +#include >> + >> +#include "../../../../lib/crypto/sha1.c" > } > > Yep, make sense. Thinking only that should this be just sha1.c. > > Comparing this to mainly drivers/firmware/efi/tpm.c, which is not > early_tpm.c where the early actually probably would make more sense > than here. Here sha1 primitive is just needed. > > This is definitely a nitpick but why carry a prefix that is not > that useful, right? I am not 100% sure what you mean here, sorry. Could you clarify about the prefix? Do you mean why did we choose early_*? There was precedent for doing that like early_serial_console.c. > >> diff --git a/include/crypto/sha1.h b/include/crypto/sha1.h >> index 044ecea60ac8..d715dd5332e1 100644 >> --- a/include/crypto/sha1.h >> +++ b/include/crypto/sha1.h >> @@ -42,5 +42,6 @@ extern int crypto_sha1_finup(struct shash_desc *desc, const u8 *data, >> #define SHA1_WORKSPACE_WORDS 16 >> void sha1_init(__u32 *buf); >> void sha1_transform(__u32 *digest, const char *data, __u32 *W); >> +void sha1(const u8 *data, unsigned int len, u8 *out); >> >> #endif /* _CRYPTO_SHA1_H */ >> diff --git a/lib/crypto/sha1.c b/lib/crypto/sha1.c >> index 1aebe7be9401..10152125b338 100644 >> --- a/lib/crypto/sha1.c >> +++ b/lib/crypto/sha1.c >> @@ -137,4 +137,85 @@ void sha1_init(__u32 *buf) >> } >> EXPORT_SYMBOL(sha1_init); >> >> +static void __sha1_transform(u32 *digest, const char *data) >> +{ >> + u32 ws[SHA1_WORKSPACE_WORDS]; >> + >> + sha1_transform(digest, data, ws); >> + >> + memzero_explicit(ws, sizeof(ws)); > > For the sake of future reference I'd carry always some inline comment > with any memzero_explicit() call site. We can do that. > >> +} >> + >> +static void sha1_update(struct sha1_state *sctx, const u8 *data, unsigned int len) >> +{ >> + unsigned int partial = sctx->count % SHA1_BLOCK_SIZE; >> + >> + sctx->count += len; >> + >> + if (likely((partial + len) >= SHA1_BLOCK_SIZE)) { > > > if (unlikely((partial + len) < SHA1_BLOCK_SIZE)) > goto out; > > ? We could do it that way. I guess it would cut down in indenting. I defer to Daniel Smith on this... > >> + int blocks; >> + >> + if (partial) { >> + int p = SHA1_BLOCK_SIZE - partial; >> + >> + memcpy(sctx->buffer + partial, data, p); >> + data += p; >> + len -= p; >> + >> + __sha1_transform(sctx->state, sctx->buffer); >> + } >> + >> + blocks = len / SHA1_BLOCK_SIZE; >> + len %= SHA1_BLOCK_SIZE; >> + >> + if (blocks) { >> + while (blocks--) { >> + __sha1_transform(sctx->state, data); >> + data += SHA1_BLOCK_SIZE; >> + } >> + } >> + partial = 0; >> + } >> + > > out: > >> + if (len) >> + memcpy(sctx->buffer + partial, data, len); > > Why not just memcpy() unconditionally? > ... and this. >> +} >> + >> +static void sha1_final(struct sha1_state *sctx, u8 *out) >> +{ >> + const int bit_offset = SHA1_BLOCK_SIZE - sizeof(__be64); >> + unsigned int partial = sctx->count % SHA1_BLOCK_SIZE; >> + __be64 *bits = (__be64 *)(sctx->buffer + bit_offset); >> + __be32 *digest = (__be32 *)out; >> + int i; >> + >> + sctx->buffer[partial++] = 0x80; >> + if (partial > bit_offset) { >> + memset(sctx->buffer + partial, 0x0, SHA1_BLOCK_SIZE - partial); >> + partial = 0; >> + >> + __sha1_transform(sctx->state, sctx->buffer); >> + } >> + >> + memset(sctx->buffer + partial, 0x0, bit_offset - partial); >> + *bits = cpu_to_be64(sctx->count << 3); >> + __sha1_transform(sctx->state, sctx->buffer); >> + >> + for (i = 0; i < SHA1_DIGEST_SIZE / sizeof(__be32); i++) >> + put_unaligned_be32(sctx->state[i], digest++); >> + >> + *sctx = (struct sha1_state){}; >> +} >> + >> +void sha1(const u8 *data, unsigned int len, u8 *out) >> +{ >> + struct sha1_state sctx = {0}; >> + >> + sha1_init(sctx.state); >> + sctx.count = 0; > > Hmm... so shouldn't C99 take care of this given the initialization > above? I'm not 100% sure here. I.e. given "= {0}", shouldn't this > already be zero? Yes it seems so. We will look at changing that. > >> + sha1_update(&sctx, data, len); >> + sha1_final(&sctx, out); >> +} >> +EXPORT_SYMBOL(sha1); >> + >> MODULE_LICENSE("GPL"); > > BR, Jarkko Thanks Ross