From patchwork Tue Oct 15 14:15:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13836519 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A9D1D142E77 for ; Tue, 15 Oct 2024 14:15:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.202 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729001729; cv=none; b=TFOMHIEvvr31EztdhPSJzIwydsCs3XY8SjZ4WhLk+9hvaX89j0Ekhs/beqUErgPPEl4VT7p9g8kRPO/+Xl3LbfvpdgD/jBCclsKY3w451pqLEaYKY6a5BUwKVfEgxk1scEQMGfIXkX6wL6r7VQtJnL95tHFDaZdtizkdF1g2c6Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729001729; c=relaxed/simple; bh=+TReaEdQsfZfrNMi/7zSZ3UXpXhQF8S+L8H6Bog6rgw=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=ME1Tq4KZB5Tu+PVPcVpzPiHn56m329Zvw5ZsBZnC0A/ZUqABoDtNrZY4WskGtOksRsN5o0CXDgysxLCpNDxcN+MvuXG+qL50rvXoSiPE9bIYaU7jM9sY2BZw9Fna0xQYHVrxxEK9MPwpB6ozlCKgWvzJCTYK4bYbXdFP3W9KQbk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=jLIttgT2; arc=none smtp.client-ip=209.85.219.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="jLIttgT2" Received: by mail-yb1-f202.google.com with SMTP id 3f1490d57ef6-e0b8fa94718so7600795276.0 for ; Tue, 15 Oct 2024 07:15:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729001726; x=1729606526; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=4T99DahR2DAaxzHSfzgz+6ZZ8SutcvhdH+1X2CM2O5k=; b=jLIttgT2FdjpZ5jw98q3S0pQ19orSPBPkByLr+DRMtEm9Mr3Zh1Ly1R2N246kP3ow0 sCyeQl76MvZfVKRmpH2h1OauqL0SDvUySH8Lm5XLWgXlhb0Yi3RgcqEbcZl8m+iJlmDc gwoZYDS1oPqRYlgAHNfcLw1qFJv8kg2RULMePNY8aD/ZYR6eNBcTHRzxgg4zV+JKaIR2 qnJ85bvLwNMTwtl/bs24HFLO/6andhf2XJLGnnPEiZXOlsPl6Z28wRI5NPPddNrArthR pC8oUVtt8k4pGO4UNjPt0wbMfrhGeNmvxIgdHpW8SzbYb/1ckJplo6Ht+81OUngOwVic UX5A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729001726; x=1729606526; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4T99DahR2DAaxzHSfzgz+6ZZ8SutcvhdH+1X2CM2O5k=; b=NPxdn/p6HH2H4On3OLbN4AyJt+ZygOwrdOm+s+0ZYl6J70hSrMP0qFawuGbl16uPYX 3/8Otss8w9yhUkZVZ1NUN8M5uqmP41tjk5N5dBADKekMbGmiodr3W2nNG6RjXijqM+mT Ikj1skv3aCvLrxGKzA6r5uJJN8rr9RE5NHRS5KUIu2zVoqHyd3HVpNJfN3G/ktoIvTy3 6Nudf+B5Vw1nq3LcwGkPhjHkjIGGhMuiWNwGPLIBUoIfNMBxrH1TkkNHUmCSsBRnhdpU iHGC0dOR4nnd+CWT7wijKwXc+DSt7IlPJJvAAW0ILGrjhcCqxDNrhDEpfMu7qxYtc6rM I96Q== X-Gm-Message-State: AOJu0YzA8CrCQeBPGMhaiAnsn7bVzn3YgFKCibG/uoMEmuNr8SzINm5C GOKgoWGvi6Seo0izNfuiRt3vS0b4qs5y5VCr0i1dDAtL0O4DQjx29f0giRIF7uEm2YVr20Z4zgi W3eBlVwyasWCXp+uVCphrjfHhtoJuTKhlnYHOgwZXbMJnJORpJike3+i7ugH4NHLrCoTMocRAiv 5blDqLzPcMt836reA9JK28SruaDUwmnw== X-Google-Smtp-Source: AGHT+IHpRl7iGygSVJTMVxqOLrNAyCcgeEoqscUVKafaM0lCr65ygf/DLGMDcfgWgdbt5E6dkHzUqliz X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:7b:198d:ac11:8138]) (user=ardb job=sendgmr) by 2002:a25:b601:0:b0:e28:f8e6:f4c6 with SMTP id 3f1490d57ef6-e29782b025emr205276.2.1729001725922; Tue, 15 Oct 2024 07:15:25 -0700 (PDT) Date: Tue, 15 Oct 2024 16:15:16 +0200 In-Reply-To: <20241015141514.3000757-4-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241015141514.3000757-4-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=3957; i=ardb@kernel.org; h=from:subject; bh=DkMuhLyEdXzGQv+7T0r8x/uwmKJEbsIifEEQjFZBuxM=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIZ2v4nOmYb0TxwHb4zWBh/InKZ/bI9at/SbG4NjPM+6H/ SeujjboKGVhEONgkBVTZBGY/ffdztMTpWqdZ8nCzGFlAhnCwMUpABNxmsrw3zf/K9fTOWm6z41W Lf8x7TZ3GGvEziaxRSmyaZr20+RVixgZttpIvtR+f+hG5qrtr3gOPj5stfnLrm13WTw7so4+f3H Omh8A X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog Message-ID: <20241015141514.3000757-5-ardb+git@google.com> Subject: [PATCH 1/2] crypto/crc32: Provide crc32-base alias to enable fuzz testing From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: ebiggers@kernel.org, herbert@gondor.apana.org.au, Ard Biesheuvel From: Ard Biesheuvel crc32-generic is backed by the architecture's CRC-32 library, which may offer a variety of implementations depending on the capabilities of the platform. These are not covered by the crypto subsystem's fuzz testing capabilities because crc32-generic is the reference driver that the fuzzing logic uses as a source of truth. Fix this by proving a crc32-base implementation which is always based on the generic C implementation, and wire it up as the reference implementation for the fuzz tester. Signed-off-by: Ard Biesheuvel --- crypto/crc32_generic.c | 73 ++++++++++++++------ crypto/testmgr.c | 1 + 2 files changed, 52 insertions(+), 22 deletions(-) diff --git a/crypto/crc32_generic.c b/crypto/crc32_generic.c index d1251663ed66..73948ce96ac7 100644 --- a/crypto/crc32_generic.c +++ b/crypto/crc32_generic.c @@ -63,6 +63,17 @@ static int crc32_update(struct shash_desc *desc, const u8 *data, return 0; } +#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS +static int crc32_update_base(struct shash_desc *desc, const u8 *data, + unsigned int len) +{ + u32 *crcp = shash_desc_ctx(desc); + + *crcp = crc32_le_base(*crcp, data, len); + return 0; +} +#endif + /* No final XOR 0xFFFFFFFF, like crc32_le */ static int __crc32_finup(u32 *crcp, const u8 *data, unsigned int len, u8 *out) @@ -91,35 +102,53 @@ static int crc32_digest(struct shash_desc *desc, const u8 *data, return __crc32_finup(crypto_shash_ctx(desc->tfm), data, len, out); } -static struct shash_alg alg = { - .setkey = crc32_setkey, - .init = crc32_init, - .update = crc32_update, - .final = crc32_final, - .finup = crc32_finup, - .digest = crc32_digest, - .descsize = sizeof(u32), - .digestsize = CHKSUM_DIGEST_SIZE, - .base = { - .cra_name = "crc32", - .cra_driver_name = "crc32-generic", - .cra_priority = 100, - .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, - .cra_blocksize = CHKSUM_BLOCK_SIZE, - .cra_ctxsize = sizeof(u32), - .cra_module = THIS_MODULE, - .cra_init = crc32_cra_init, - } -}; +static struct shash_alg algs[] = {{ + .setkey = crc32_setkey, + .init = crc32_init, + .update = crc32_update, + .final = crc32_final, + .finup = crc32_finup, + .digest = crc32_digest, + .descsize = sizeof(u32), + .digestsize = CHKSUM_DIGEST_SIZE, + + .base.cra_name = "crc32", + .base.cra_driver_name = "crc32-generic", + .base.cra_priority = 100, + .base.cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .base.cra_blocksize = CHKSUM_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(u32), + .base.cra_module = THIS_MODULE, + .base.cra_init = crc32_cra_init, +#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS +}, { + .setkey = crc32_setkey, + .init = crc32_init, + .update = crc32_update_base, + .final = crc32_final, + .digest = crc32_digest, + .descsize = sizeof(u32), + .digestsize = CHKSUM_DIGEST_SIZE, + + .base.cra_name = "crc32", + .base.cra_driver_name = "crc32-base", + .base.cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .base.cra_blocksize = CHKSUM_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(u32), + .base.cra_module = THIS_MODULE, + .base.cra_init = crc32_cra_init, +#endif +}}; static int __init crc32_mod_init(void) { - return crypto_register_shash(&alg); + return crypto_register_shashes(algs, ARRAY_SIZE(algs)); } static void __exit crc32_mod_fini(void) { - crypto_unregister_shash(&alg); + crypto_unregister_shashes(algs, ARRAY_SIZE(algs)); + } subsys_initcall(crc32_mod_init); diff --git a/crypto/testmgr.c b/crypto/testmgr.c index ee8da628e9da..e0d6bfcc13e6 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -4692,6 +4692,7 @@ static const struct alg_test_desc alg_test_descs[] = { .test = alg_test_null, }, { .alg = "crc32", + .generic_driver = "crc32-base", .test = alg_test_hash, .fips_allowed = 1, .suite = { From patchwork Tue Oct 15 14:15:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13836520 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55189142E77 for ; Tue, 15 Oct 2024 14:15:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729001732; cv=none; b=KHws9RfSVRzWAYnXkis9mvNnQfCs0LZCjlesPKeBfpX90rwZTZVbJTtQkWm4oxh2ZUCqWCKkTyaxik7xmBa1URd6ta0TcRVk2jKiXs869vi3msYYwY7nO3Yftv/S6Fe+aBlmJ/dGC4cD2glfhUrpIGCHgVAob9ykp/S++QjVv2Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729001732; c=relaxed/simple; bh=Z1aPPooDls2taVn+gi0sXyVQV8kJ8ey67lZ9fVQtJxE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=aU0JW7uXDRGkjl3SV9yrDfOfmtW1jx00CEhto6oqrcQOrD4XP/0zVhadN5kqJj55kImEQ3f4Hf47YTe1flAoa8klkV3HjSHco6LxHGn2SbN/yq4XXi+dO3II9U9N2+xu6VUjy3Dkuo41t/PBh4tAKKw7+fJGiyR9uMFsszcoz0E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=klf2AMrW; arc=none smtp.client-ip=209.85.221.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--ardb.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="klf2AMrW" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-37d609ef9f7so1354065f8f.3 for ; Tue, 15 Oct 2024 07:15:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1729001729; x=1729606529; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=8CxPmpBAP8eCjtMdTvIIYVSJhCFUv2sFvYcbHhPChyY=; b=klf2AMrWzvNeZBZ7cC2iClnutLAIkDAoJ/uudqI76/Nx0/N7gbbHtmQAmmsRbW61gF vGEAFQrpjyDosW1nqBRMFNCg97PwtwDgXeA7+tFDYloPYjdkIybRGL6a6AXu9LEzlDUY /mLJglngTYiW3SshTd37GvBQLQD0iAsvTa8/lKS7Wsoy9pNV8LoZJ5hkMC8MJnEUBhqV 2sw6N6SxIx6SHEApVGAgH73auPwBCVSCsjE3ge0nu+STq8r0EWo1QoiIgJXiwQUnjtC6 B0vwzIBdzPwm3xveQ6yTTY9NkHWxAUBFrHMuyFDUy5yaXVyJNn8alxvlhPclD1k7/Csf ZZPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729001729; x=1729606529; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=8CxPmpBAP8eCjtMdTvIIYVSJhCFUv2sFvYcbHhPChyY=; b=EaiIvbI6eADoguxV8456KH/RePSd4q5mChZdLWSe44R5AVuNRXXVPJOI1uWRO1JTpG Zs6hVyzCp1QzEEXrFEoSfKg7V4MsVYilKvni4yV9BLsTjzJDYy70vKBl4CvzrRkabIzn 5GZdhMhEJU3nmxIb+zSbpGGkm53aXb27z9OUxkDZipM/uF9twlICDNAyYPVDl6D24Uf/ 4dzrrqwGfq3KdLJp8exKphYjxlcvrA6yCjjfEOFKfPmnhokONah5aYCbwBM2ax5d+9pC KZE4Nr9wHUL2ZtDI9vHq4HQQNQTcCCanV1+W8WeeUe79UU3frs+uTqNvQPEHgrPWDu6x WJFw== X-Gm-Message-State: AOJu0Yw1APhrqeib/bi6iqUfDX1+oj6gKZmMD4ycYQ/yJpL6zUqk1cEk U5wCWADmEjfEzVqQsCGw+gAkJwJBraCVj/RNA7gIkqhpWUaJvnB38KK1lSdC3QKpXAxicFE+tZi Pq2jEBiDixiDtmS2caFXa2kRqDWy05aO271BD4Q/xhZ2N0OZWBgtJql+yw/ZAYS4IrwvJnq98Xg 8+5X14q/QFdHWzo5G2HJnRG7XoHULepg== X-Google-Smtp-Source: AGHT+IHLLxVIYbMv3FLoPzUWQvuVMjRWgHzzi75eychuiPSYTRrqwBaSf1ewYX77XMNsLQT/1p+6qqnd X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:7b:198d:ac11:8138]) (user=ardb job=sendgmr) by 2002:a5d:4d88:0:b0:37d:4722:57 with SMTP id ffacd0b85a97d-37d86d9ceb0mr157f8f.8.1729001728542; Tue, 15 Oct 2024 07:15:28 -0700 (PDT) Date: Tue, 15 Oct 2024 16:15:17 +0200 In-Reply-To: <20241015141514.3000757-4-ardb+git@google.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20241015141514.3000757-4-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=4002; i=ardb@kernel.org; h=from:subject; bh=XEFH/aVkBNoR48BTtlFJeWHZfRlCtF6XDXXhHKYRsHM=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIZ2v4ss0noL+aY0uItNPfTh4tYP/SouYr/KeCyHH9k+8a puxqzq8o5SFQYyDQVZMkUVg9t93O09PlKp1niULM4eVCWQIAxenAExEsZiRYTGf+tLH/lWb5I/u efTx405vyd3xUspzV39Mkmicccru+AJGhuW1XJqiu8WDTooKH536VuWjWriZg1qvsSVfreMq87O b2QE= X-Mailer: git-send-email 2.47.0.rc1.288.g06298d1525-goog Message-ID: <20241015141514.3000757-6-ardb+git@google.com> Subject: [PATCH 2/2] crypto/crc32c: Provide crc32c-base alias to enable fuzz testing From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: ebiggers@kernel.org, herbert@gondor.apana.org.au, Ard Biesheuvel From: Ard Biesheuvel crc32-generic is backed by the architecture's CRC-32c library, which may offer a variety of implementations depending on the capabilities of the platform. These are not covered by the crypto subsystem's fuzz testing capabilities because crc32c-generic is the reference driver that the fuzzing logic uses as a source of truth. Fix this by proving a crc32c-base implementation which is always based on the generic C implementation, and wire it up as the reference implementation for the fuzz tester. Signed-off-by: Ard Biesheuvel --- crypto/crc32c_generic.c | 72 ++++++++++++++------ crypto/testmgr.c | 1 + 2 files changed, 51 insertions(+), 22 deletions(-) diff --git a/crypto/crc32c_generic.c b/crypto/crc32c_generic.c index a8c90b3f4c6c..0a7543dbc515 100644 --- a/crypto/crc32c_generic.c +++ b/crypto/crc32c_generic.c @@ -80,6 +80,17 @@ static int chksum_setkey(struct crypto_shash *tfm, const u8 *key, return 0; } +#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS +static int chksum_update_base(struct shash_desc *desc, const u8 *data, + unsigned int length) +{ + struct chksum_desc_ctx *ctx = shash_desc_ctx(desc); + + ctx->crc = __crc32c_le_base(ctx->crc, data, length); + return 0; +} +#endif + static int chksum_update(struct shash_desc *desc, const u8 *data, unsigned int length) { @@ -127,35 +138,52 @@ static int crc32c_cra_init(struct crypto_tfm *tfm) return 0; } -static struct shash_alg alg = { - .digestsize = CHKSUM_DIGEST_SIZE, - .setkey = chksum_setkey, - .init = chksum_init, - .update = chksum_update, - .final = chksum_final, - .finup = chksum_finup, - .digest = chksum_digest, - .descsize = sizeof(struct chksum_desc_ctx), - .base = { - .cra_name = "crc32c", - .cra_driver_name = "crc32c-generic", - .cra_priority = 100, - .cra_flags = CRYPTO_ALG_OPTIONAL_KEY, - .cra_blocksize = CHKSUM_BLOCK_SIZE, - .cra_ctxsize = sizeof(struct chksum_ctx), - .cra_module = THIS_MODULE, - .cra_init = crc32c_cra_init, - } -}; +static struct shash_alg algs[] = {{ + .digestsize = CHKSUM_DIGEST_SIZE, + .setkey = chksum_setkey, + .init = chksum_init, + .update = chksum_update, + .final = chksum_final, + .finup = chksum_finup, + .digest = chksum_digest, + .descsize = sizeof(struct chksum_desc_ctx), + + .base.cra_name = "crc32c", + .base.cra_driver_name = "crc32c-generic", + .base.cra_priority = 100, + .base.cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .base.cra_blocksize = CHKSUM_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(struct chksum_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_init = crc32c_cra_init, +#ifdef CONFIG_CRYPTO_MANAGER_EXTRA_TESTS +}, { + .digestsize = CHKSUM_DIGEST_SIZE, + .setkey = chksum_setkey, + .init = chksum_init, + .update = chksum_update_base, + .final = chksum_final, + .digest = chksum_digest, + .descsize = sizeof(struct chksum_desc_ctx), + + .base.cra_name = "crc32c", + .base.cra_driver_name = "crc32c-base", + .base.cra_flags = CRYPTO_ALG_OPTIONAL_KEY, + .base.cra_blocksize = CHKSUM_BLOCK_SIZE, + .base.cra_ctxsize = sizeof(struct chksum_ctx), + .base.cra_module = THIS_MODULE, + .base.cra_init = crc32c_cra_init, +#endif +}}; static int __init crc32c_mod_init(void) { - return crypto_register_shash(&alg); + return crypto_register_shashes(algs, ARRAY_SIZE(algs)); } static void __exit crc32c_mod_fini(void) { - crypto_unregister_shash(&alg); + crypto_unregister_shashes(algs, ARRAY_SIZE(algs)); } subsys_initcall(crc32c_mod_init); diff --git a/crypto/testmgr.c b/crypto/testmgr.c index e0d6bfcc13e6..c3f1cfe9e17e 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -4700,6 +4700,7 @@ static const struct alg_test_desc alg_test_descs[] = { } }, { .alg = "crc32c", + .generic_driver = "crc32c-base", .test = alg_test_crc32c, .fips_allowed = 1, .suite = {