Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2216569/?format=api
{ "id": 2216569, "url": "http://patchwork.ozlabs.org/api/patches/2216569/?format=api", "web_url": "http://patchwork.ozlabs.org/project/sparclinux/patch/20260326201246.57544-2-ebiggers@kernel.org/", "project": { "id": 10, "url": "http://patchwork.ozlabs.org/api/projects/10/?format=api", "name": "Linux SPARC Development ", "link_name": "sparclinux", "list_id": "sparclinux.vger.kernel.org", "list_email": "sparclinux@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260326201246.57544-2-ebiggers@kernel.org>", "list_archive_url": null, "date": "2026-03-26T20:12:43", "name": "[1/3] crypto: s390 - Remove des and des3_ede code", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "cbb03df3f1acb0970c1d971407e00de2e1cfe515", "submitter": { "id": 74690, "url": "http://patchwork.ozlabs.org/api/people/74690/?format=api", "name": "Eric Biggers", "email": "ebiggers@kernel.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/sparclinux/patch/20260326201246.57544-2-ebiggers@kernel.org/mbox/", "series": [ { "id": 497643, "url": "http://patchwork.ozlabs.org/api/series/497643/?format=api", "web_url": "http://patchwork.ozlabs.org/project/sparclinux/list/?series=497643", "date": "2026-03-26T20:12:42", "name": "crypto: Remove arch-optimized des and des3_ede code", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/497643/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2216569/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2216569/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <SRS0=+fgw=B2=vger.kernel.org=sparclinux+bounces-6566-patchwork-incoming=ozlabs.org@ozlabs.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "sparclinux@vger.kernel.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "patchwork-incoming@ozlabs.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=thnbTqB0;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=ozlabs.org\n (client-ip=2404:9400:2221:ea00::3; helo=mail.ozlabs.org;\n envelope-from=srs0=+fgw=b2=vger.kernel.org=sparclinux+bounces-6566-patchwork-incoming=ozlabs.org@ozlabs.org;\n receiver=patchwork.ozlabs.org)", "gandalf.ozlabs.org;\n arc=pass smtp.remote-ip=\"2600:3c0a:e001:db::12fc:5321\"\n arc.chain=subspace.kernel.org", "gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org", "gandalf.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=thnbTqB0;\n\tdkim-atps=neutral", "gandalf.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=sparclinux+bounces-6566-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=\"thnbTqB0\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=10.30.226.201" ], "Received": [ "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1 raw public key)\n server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fhZp36nBMz1yFp\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 07:17:47 +1100 (AEDT)", "from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])\n\tby gandalf.ozlabs.org (Postfix) with ESMTP id 4fhZny32Xnz4wM6\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 07:17:42 +1100 (AEDT)", "by gandalf.ozlabs.org (Postfix)\n\tid 4fhZny2wJ6z4w9r; Fri, 27 Mar 2026 07:17:42 +1100 (AEDT)", "from sea.lore.kernel.org (sea.lore.kernel.org\n [IPv6:2600:3c0a:e001:db::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby gandalf.ozlabs.org (Postfix) with ESMTPS id 4fhZnt5WFJz4wM6\n\tfor <patchwork-incoming@ozlabs.org>; Fri, 27 Mar 2026 07:17:38 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id 7DF073078C3F\n\tfor <patchwork-incoming@ozlabs.org>; Thu, 26 Mar 2026 20:12:55 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 0308E3A451A;\n\tThu, 26 Mar 2026 20:12:54 +0000 (UTC)", "from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org\n [10.30.226.201])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id CD8163A3826;\n\tThu, 26 Mar 2026 20:12:53 +0000 (UTC)", "by smtp.kernel.org (Postfix) with ESMTPSA id 6DFA9C2BCB1;\n\tThu, 26 Mar 2026 20:12:53 +0000 (UTC)" ], "ARC-Seal": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707; t=1774556262; cv=pass;\n\tb=yGHg1q0H0LW27C9OBoI8u113XBuTSB9oex3nfDvz4iyDzp7cEPxV54dEg2M3FynJ0Gq2cpScnZEnPqe2/hPwILsLzfZ8EZWBNOkZVswPJKPz/wGSZhVzf8qfqfIstPzYqkQvuZWD0MOYIs5JKb6vQACGZ8iu01mjwq0Itjdy8PkjpdUnwl+q+H7AX97+LBV7hKoJ7SUN9mvVSMfhHXKHQZkWR5Z9paQITJIkoChOCqkjNDN0DfvP5D7yPZDnJUJWhSQtCL+gcm0UpFkuJVkQXaL5LOH5FMLSQ/Qj3Uuo2KhtrSOgzprSFCOiwvlt6YlRvt0bxLFZMZEDO/BNi4WGAg==", "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1774555973; cv=none;\n b=WtvTi80lNifmjFG+a/v80azUVdZwvREPCZPIoYCr9+DRbHDRSp/ljQaahbGwpqgIfCIJiOT9kDO34j+meAIdkmWxQQYs09ON6Rx0vU3t0BrbhvNYBaepvrDDkNc64Tadtvb+KXNzQjGyUzl5k3beh2hKdErqC6fbTihLSZPyNjQ=" ], "ARC-Message-Signature": [ "i=2; a=rsa-sha256; d=ozlabs.org; s=201707;\n\tt=1774556262; c=relaxed/relaxed;\n\tbh=H5FYMCIgssf+GsV07h4vqwLgmCZeR9AvuL+RiIY4x/8=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=egozZ4p5qjuFm4ocJNiaYFDHs0vNnr9JUZNPAvI/4r8blLoDvIIyjZxI3O34J9em/MiBpuiXnYghzwTe3jqIR+h9H1QvVGTWC/0J3JVUmm96F07P3NzQDl6pc6+XwOnAEyIttuiwDrCRPnmlRsbFNiauV4anSVMfqoZ2APNOTxxfYf8EjO7wX3Ix/H3l+0Qf56q0HwNg9NPqCWqobRLb1eOSA7UhLD7tVUwpuFOvxUdJYaC31LP0UNtlDBFPjrfDPM97ljzq7SifmZKS9zYog7ZIRMQfLoFC7jPixg0dpHVXMgLW0L6fhDbDekqAYTm5SEE7QjzqbTaXqCTg8ng/QA==", "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1774555973; c=relaxed/simple;\n\tbh=VBVbTnQFXp4h+uFwG4gUTfOTUBJpwgXxdOn1hji6UY0=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=ZPqfFDAl+WfI/Qom+Q5HOjN4BCcf3mURBdYVf8bGTnjWycVOO6TN1HsxScqofhzfJNq0bNRDiG7BtGOPSJOl0m356xUIwnm+chxbzasjmhF1eNwZDtijiUXulkJ/ONdwPZciTvTiESHYV/g2SfHhBXmWQF3HNZ7UYDeSLU/Gxzo=" ], "ARC-Authentication-Results": [ "i=2; gandalf.ozlabs.org;\n dmarc=pass (p=quarantine dis=none) header.from=kernel.org;\n dkim=pass (2048-bit key;\n unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256\n header.s=k20201202 header.b=thnbTqB0; dkim-atps=neutral;\n spf=pass (client-ip=2600:3c0a:e001:db::12fc:5321; helo=sea.lore.kernel.org;\n envelope-from=sparclinux+bounces-6566-patchwork-incoming=ozlabs.org@vger.kernel.org;\n receiver=ozlabs.org) smtp.mailfrom=vger.kernel.org", "i=1; smtp.subspace.kernel.org;\n dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org\n header.b=thnbTqB0; arc=none smtp.client-ip=10.30.226.201" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org;\n\ts=k20201202; t=1774555973;\n\tbh=VBVbTnQFXp4h+uFwG4gUTfOTUBJpwgXxdOn1hji6UY0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=thnbTqB0IwEiYEgAHBFF/XuTaulWZ9X97gpbRDxSi8doWNitFUb6AwRH8vET7hjw8\n\t uzTMNLS2AgNVD5g/KcRmg9740TlNrRsGeqbak+fDr8p++Ah8jL9eYCgcDj1cUqB5Tb\n\t ZTRCMOmyJQFXjCPWHJMmoYNEPHaDFbqak8xU9qxA6lNkE5xMBO18bJmH+owXMbNpjX\n\t l/1Rp8OKfvwYAXmrpjUkXt2jkVeb5a8/3LjzM2QRLhg0wES52qF6mt47gXKFUlGXL4\n\t nZrmmq9at0hl+4C9szCaI5zcYJWLCo6vvcQsP/d9I0CDv6RqAKTtgYvwreqkfUZ+6Y\n\t okChQq1lYxXRg==", "From": "Eric Biggers <ebiggers@kernel.org>", "To": "linux-crypto@vger.kernel.org,\n\tHerbert Xu <herbert@gondor.apana.org.au>", "Cc": "linux-kernel@vger.kernel.org,\n\tlinux-s390@vger.kernel.org,\n\tsparclinux@vger.kernel.org,\n\tx86@kernel.org,\n\tHarald Freudenberger <freude@linux.ibm.com>,\n\tHolger Dengler <dengler@linux.ibm.com>,\n\tEric Biggers <ebiggers@kernel.org>", "Subject": "[PATCH 1/3] crypto: s390 - Remove des and des3_ede code", "Date": "Thu, 26 Mar 2026 13:12:43 -0700", "Message-ID": "<20260326201246.57544-2-ebiggers@kernel.org>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<20260326201246.57544-1-ebiggers@kernel.org>", "References": "<20260326201246.57544-1-ebiggers@kernel.org>", "Precedence": "bulk", "X-Mailing-List": "sparclinux@vger.kernel.org", "List-Id": "<sparclinux.vger.kernel.org>", "List-Subscribe": "<mailto:sparclinux+subscribe@vger.kernel.org>", "List-Unsubscribe": "<mailto:sparclinux+unsubscribe@vger.kernel.org>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Spam-Status": "No, score=-1.2 required=5.0 tests=ARC_SIGNED,ARC_VALID,\n\tDKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DMARC_PASS,\n\tMAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=disabled\n\tversion=4.0.1", "X-Spam-Checker-Version": "SpamAssassin 4.0.1 (2024-03-25) on gandalf.ozlabs.org" }, "content": "Since DES and Triple DES are obsolete, there is very little point in\nmaintining architecture-optimized code for them. Remove it.\n\nSigned-off-by: Eric Biggers <ebiggers@kernel.org>\n---\n arch/s390/configs/debug_defconfig | 1 -\n arch/s390/configs/defconfig | 1 -\n arch/s390/crypto/Kconfig | 16 -\n arch/s390/crypto/Makefile | 1 -\n arch/s390/crypto/des_s390.c | 502 ------------------------------\n 5 files changed, 521 deletions(-)\n delete mode 100644 arch/s390/crypto/des_s390.c", "diff": "diff --git a/arch/s390/configs/debug_defconfig b/arch/s390/configs/debug_defconfig\nindex 98fd0a2f51c6..74e4bb236623 100644\n--- a/arch/s390/configs/debug_defconfig\n+++ b/arch/s390/configs/debug_defconfig\n@@ -809,11 +809,10 @@ CONFIG_CRYPTO_USER_API_HASH=m\n CONFIG_CRYPTO_USER_API_SKCIPHER=m\n CONFIG_CRYPTO_USER_API_RNG=m\n CONFIG_CRYPTO_USER_API_AEAD=m\n CONFIG_CRYPTO_GHASH_S390=m\n CONFIG_CRYPTO_AES_S390=m\n-CONFIG_CRYPTO_DES_S390=m\n CONFIG_CRYPTO_HMAC_S390=m\n CONFIG_ZCRYPT=m\n CONFIG_PKEY=m\n CONFIG_PKEY_CCA=m\n CONFIG_PKEY_EP11=m\ndiff --git a/arch/s390/configs/defconfig b/arch/s390/configs/defconfig\nindex 0f4cedcab3ce..5cb7b715ba6b 100644\n--- a/arch/s390/configs/defconfig\n+++ b/arch/s390/configs/defconfig\n@@ -794,11 +794,10 @@ CONFIG_CRYPTO_USER_API_HASH=m\n CONFIG_CRYPTO_USER_API_SKCIPHER=m\n CONFIG_CRYPTO_USER_API_RNG=m\n CONFIG_CRYPTO_USER_API_AEAD=m\n CONFIG_CRYPTO_GHASH_S390=m\n CONFIG_CRYPTO_AES_S390=m\n-CONFIG_CRYPTO_DES_S390=m\n CONFIG_CRYPTO_HMAC_S390=m\n CONFIG_ZCRYPT=m\n CONFIG_PKEY=m\n CONFIG_PKEY_CCA=m\n CONFIG_PKEY_EP11=m\ndiff --git a/arch/s390/crypto/Kconfig b/arch/s390/crypto/Kconfig\nindex 79a2d0034258..4218d21f1f00 100644\n--- a/arch/s390/crypto/Kconfig\n+++ b/arch/s390/crypto/Kconfig\n@@ -29,26 +29,10 @@ config CRYPTO_AES_S390\n \n \t As of z196 the CTR mode is hardware accelerated for all AES\n \t key sizes and XTS mode is hardware accelerated for 256 and\n \t 512 bit keys.\n \n-config CRYPTO_DES_S390\n-\ttristate \"Ciphers: DES and Triple DES EDE, modes: ECB, CBC, CTR\"\n-\tselect CRYPTO_ALGAPI\n-\tselect CRYPTO_SKCIPHER\n-\tselect CRYPTO_LIB_DES\n-\thelp\n-\t Block ciphers: DES (FIPS 46-2) cipher algorithm\n-\t Block ciphers: Triple DES EDE (FIPS 46-3) cipher algorithm\n-\t Length-preserving ciphers: DES with ECB, CBC, and CTR modes\n-\t Length-preserving ciphers: Triple DES EDED with ECB, CBC, and CTR modes\n-\n-\t Architecture: s390\n-\n-\t As of z990 the ECB and CBC mode are hardware accelerated.\n-\t As of z196 the CTR mode is hardware accelerated.\n-\n config CRYPTO_HMAC_S390\n \ttristate \"Keyed-hash message authentication code: HMAC\"\n \tselect CRYPTO_HASH\n \thelp\n \t s390 specific HMAC hardware support for SHA224, SHA256, SHA384 and\ndiff --git a/arch/s390/crypto/Makefile b/arch/s390/crypto/Makefile\nindex 387a229e1038..bf5e061ebf13 100644\n--- a/arch/s390/crypto/Makefile\n+++ b/arch/s390/crypto/Makefile\n@@ -1,11 +1,10 @@\n # SPDX-License-Identifier: GPL-2.0\n #\n # Cryptographic API\n #\n \n-obj-$(CONFIG_CRYPTO_DES_S390) += des_s390.o\n obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o\n obj-$(CONFIG_CRYPTO_PAES_S390) += paes_s390.o\n obj-$(CONFIG_S390_PRNG) += prng.o\n obj-$(CONFIG_CRYPTO_GHASH_S390) += ghash_s390.o\n obj-$(CONFIG_CRYPTO_HMAC_S390) += hmac_s390.o\ndiff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c\ndeleted file mode 100644\nindex 8e75b83a5ddc..000000000000\n--- a/arch/s390/crypto/des_s390.c\n+++ /dev/null\n@@ -1,502 +0,0 @@\n-// SPDX-License-Identifier: GPL-2.0+\n-/*\n- * Cryptographic API.\n- *\n- * s390 implementation of the DES Cipher Algorithm.\n- *\n- * Copyright IBM Corp. 2003, 2011\n- * Author(s): Thomas Spatzier\n- *\t Jan Glauber (jan.glauber@de.ibm.com)\n- */\n-\n-#include <linux/init.h>\n-#include <linux/module.h>\n-#include <linux/cpufeature.h>\n-#include <linux/crypto.h>\n-#include <linux/fips.h>\n-#include <linux/mutex.h>\n-#include <crypto/algapi.h>\n-#include <crypto/internal/des.h>\n-#include <crypto/internal/skcipher.h>\n-#include <asm/cpacf.h>\n-\n-#define DES3_KEY_SIZE\t(3 * DES_KEY_SIZE)\n-\n-static u8 *ctrblk;\n-static DEFINE_MUTEX(ctrblk_lock);\n-\n-static cpacf_mask_t km_functions, kmc_functions, kmctr_functions;\n-\n-struct s390_des_ctx {\n-\tu8 iv[DES_BLOCK_SIZE];\n-\tu8 key[DES3_KEY_SIZE];\n-};\n-\n-static int des_setkey(struct crypto_tfm *tfm, const u8 *key,\n-\t\t unsigned int key_len)\n-{\n-\tstruct s390_des_ctx *ctx = crypto_tfm_ctx(tfm);\n-\tint err;\n-\n-\terr = crypto_des_verify_key(tfm, key);\n-\tif (err)\n-\t\treturn err;\n-\n-\tmemcpy(ctx->key, key, key_len);\n-\treturn 0;\n-}\n-\n-static int des_setkey_skcipher(struct crypto_skcipher *tfm, const u8 *key,\n-\t\t\t unsigned int key_len)\n-{\n-\treturn des_setkey(crypto_skcipher_tfm(tfm), key, key_len);\n-}\n-\n-static void s390_des_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)\n-{\n-\tstruct s390_des_ctx *ctx = crypto_tfm_ctx(tfm);\n-\n-\tcpacf_km(CPACF_KM_DEA, ctx->key, out, in, DES_BLOCK_SIZE);\n-}\n-\n-static void s390_des_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)\n-{\n-\tstruct s390_des_ctx *ctx = crypto_tfm_ctx(tfm);\n-\n-\tcpacf_km(CPACF_KM_DEA | CPACF_DECRYPT,\n-\t\t ctx->key, out, in, DES_BLOCK_SIZE);\n-}\n-\n-static struct crypto_alg des_alg = {\n-\t.cra_name\t\t=\t\"des\",\n-\t.cra_driver_name\t=\t\"des-s390\",\n-\t.cra_priority\t\t=\t300,\n-\t.cra_flags\t\t=\tCRYPTO_ALG_TYPE_CIPHER,\n-\t.cra_blocksize\t\t=\tDES_BLOCK_SIZE,\n-\t.cra_ctxsize\t\t=\tsizeof(struct s390_des_ctx),\n-\t.cra_module\t\t=\tTHIS_MODULE,\n-\t.cra_u\t\t\t=\t{\n-\t\t.cipher = {\n-\t\t\t.cia_min_keysize\t=\tDES_KEY_SIZE,\n-\t\t\t.cia_max_keysize\t=\tDES_KEY_SIZE,\n-\t\t\t.cia_setkey\t\t=\tdes_setkey,\n-\t\t\t.cia_encrypt\t\t=\ts390_des_encrypt,\n-\t\t\t.cia_decrypt\t\t=\ts390_des_decrypt,\n-\t\t}\n-\t}\n-};\n-\n-static int ecb_desall_crypt(struct skcipher_request *req, unsigned long fc)\n-{\n-\tstruct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);\n-\tstruct s390_des_ctx *ctx = crypto_skcipher_ctx(tfm);\n-\tstruct skcipher_walk walk;\n-\tunsigned int nbytes, n;\n-\tint ret;\n-\n-\tret = skcipher_walk_virt(&walk, req, false);\n-\twhile ((nbytes = walk.nbytes) != 0) {\n-\t\t/* only use complete blocks */\n-\t\tn = nbytes & ~(DES_BLOCK_SIZE - 1);\n-\t\tcpacf_km(fc, ctx->key, walk.dst.virt.addr,\n-\t\t\t walk.src.virt.addr, n);\n-\t\tret = skcipher_walk_done(&walk, nbytes - n);\n-\t}\n-\treturn ret;\n-}\n-\n-static int cbc_desall_crypt(struct skcipher_request *req, unsigned long fc)\n-{\n-\tstruct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);\n-\tstruct s390_des_ctx *ctx = crypto_skcipher_ctx(tfm);\n-\tstruct skcipher_walk walk;\n-\tunsigned int nbytes, n;\n-\tint ret;\n-\tstruct {\n-\t\tu8 iv[DES_BLOCK_SIZE];\n-\t\tu8 key[DES3_KEY_SIZE];\n-\t} param;\n-\n-\tret = skcipher_walk_virt(&walk, req, false);\n-\tif (ret)\n-\t\treturn ret;\n-\tmemcpy(param.iv, walk.iv, DES_BLOCK_SIZE);\n-\tmemcpy(param.key, ctx->key, DES3_KEY_SIZE);\n-\twhile ((nbytes = walk.nbytes) != 0) {\n-\t\t/* only use complete blocks */\n-\t\tn = nbytes & ~(DES_BLOCK_SIZE - 1);\n-\t\tcpacf_kmc(fc, ¶m, walk.dst.virt.addr,\n-\t\t\t walk.src.virt.addr, n);\n-\t\tmemcpy(walk.iv, param.iv, DES_BLOCK_SIZE);\n-\t\tret = skcipher_walk_done(&walk, nbytes - n);\n-\t}\n-\treturn ret;\n-}\n-\n-static int ecb_des_encrypt(struct skcipher_request *req)\n-{\n-\treturn ecb_desall_crypt(req, CPACF_KM_DEA);\n-}\n-\n-static int ecb_des_decrypt(struct skcipher_request *req)\n-{\n-\treturn ecb_desall_crypt(req, CPACF_KM_DEA | CPACF_DECRYPT);\n-}\n-\n-static struct skcipher_alg ecb_des_alg = {\n-\t.base.cra_name\t\t=\t\"ecb(des)\",\n-\t.base.cra_driver_name\t=\t\"ecb-des-s390\",\n-\t.base.cra_priority\t=\t400,\t/* combo: des + ecb */\n-\t.base.cra_blocksize\t=\tDES_BLOCK_SIZE,\n-\t.base.cra_ctxsize\t=\tsizeof(struct s390_des_ctx),\n-\t.base.cra_module\t=\tTHIS_MODULE,\n-\t.min_keysize\t\t=\tDES_KEY_SIZE,\n-\t.max_keysize\t\t=\tDES_KEY_SIZE,\n-\t.setkey\t\t\t=\tdes_setkey_skcipher,\n-\t.encrypt\t\t=\tecb_des_encrypt,\n-\t.decrypt\t\t=\tecb_des_decrypt,\n-};\n-\n-static int cbc_des_encrypt(struct skcipher_request *req)\n-{\n-\treturn cbc_desall_crypt(req, CPACF_KMC_DEA);\n-}\n-\n-static int cbc_des_decrypt(struct skcipher_request *req)\n-{\n-\treturn cbc_desall_crypt(req, CPACF_KMC_DEA | CPACF_DECRYPT);\n-}\n-\n-static struct skcipher_alg cbc_des_alg = {\n-\t.base.cra_name\t\t=\t\"cbc(des)\",\n-\t.base.cra_driver_name\t=\t\"cbc-des-s390\",\n-\t.base.cra_priority\t=\t400,\t/* combo: des + cbc */\n-\t.base.cra_blocksize\t=\tDES_BLOCK_SIZE,\n-\t.base.cra_ctxsize\t=\tsizeof(struct s390_des_ctx),\n-\t.base.cra_module\t=\tTHIS_MODULE,\n-\t.min_keysize\t\t=\tDES_KEY_SIZE,\n-\t.max_keysize\t\t=\tDES_KEY_SIZE,\n-\t.ivsize\t\t\t=\tDES_BLOCK_SIZE,\n-\t.setkey\t\t\t=\tdes_setkey_skcipher,\n-\t.encrypt\t\t=\tcbc_des_encrypt,\n-\t.decrypt\t\t=\tcbc_des_decrypt,\n-};\n-\n-/*\n- * RFC2451:\n- *\n- * For DES-EDE3, there is no known need to reject weak or\n- * complementation keys. Any weakness is obviated by the use of\n- * multiple keys.\n- *\n- * However, if the first two or last two independent 64-bit keys are\n- * equal (k1 == k2 or k2 == k3), then the DES3 operation is simply the\n- * same as DES. Implementers MUST reject keys that exhibit this\n- * property.\n- *\n- * In fips mode additionally check for all 3 keys are unique.\n- *\n- */\n-static int des3_setkey(struct crypto_tfm *tfm, const u8 *key,\n-\t\t unsigned int key_len)\n-{\n-\tstruct s390_des_ctx *ctx = crypto_tfm_ctx(tfm);\n-\tint err;\n-\n-\terr = crypto_des3_ede_verify_key(tfm, key);\n-\tif (err)\n-\t\treturn err;\n-\n-\tmemcpy(ctx->key, key, key_len);\n-\treturn 0;\n-}\n-\n-static int des3_setkey_skcipher(struct crypto_skcipher *tfm, const u8 *key,\n-\t\t\t\tunsigned int key_len)\n-{\n-\treturn des3_setkey(crypto_skcipher_tfm(tfm), key, key_len);\n-}\n-\n-static void des3_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)\n-{\n-\tstruct s390_des_ctx *ctx = crypto_tfm_ctx(tfm);\n-\n-\tcpacf_km(CPACF_KM_TDEA_192, ctx->key, dst, src, DES_BLOCK_SIZE);\n-}\n-\n-static void des3_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)\n-{\n-\tstruct s390_des_ctx *ctx = crypto_tfm_ctx(tfm);\n-\n-\tcpacf_km(CPACF_KM_TDEA_192 | CPACF_DECRYPT,\n-\t\t ctx->key, dst, src, DES_BLOCK_SIZE);\n-}\n-\n-static struct crypto_alg des3_alg = {\n-\t.cra_name\t\t=\t\"des3_ede\",\n-\t.cra_driver_name\t=\t\"des3_ede-s390\",\n-\t.cra_priority\t\t=\t300,\n-\t.cra_flags\t\t=\tCRYPTO_ALG_TYPE_CIPHER,\n-\t.cra_blocksize\t\t=\tDES_BLOCK_SIZE,\n-\t.cra_ctxsize\t\t=\tsizeof(struct s390_des_ctx),\n-\t.cra_module\t\t=\tTHIS_MODULE,\n-\t.cra_u\t\t\t=\t{\n-\t\t.cipher = {\n-\t\t\t.cia_min_keysize\t=\tDES3_KEY_SIZE,\n-\t\t\t.cia_max_keysize\t=\tDES3_KEY_SIZE,\n-\t\t\t.cia_setkey\t\t=\tdes3_setkey,\n-\t\t\t.cia_encrypt\t\t=\tdes3_encrypt,\n-\t\t\t.cia_decrypt\t\t=\tdes3_decrypt,\n-\t\t}\n-\t}\n-};\n-\n-static int ecb_des3_encrypt(struct skcipher_request *req)\n-{\n-\treturn ecb_desall_crypt(req, CPACF_KM_TDEA_192);\n-}\n-\n-static int ecb_des3_decrypt(struct skcipher_request *req)\n-{\n-\treturn ecb_desall_crypt(req, CPACF_KM_TDEA_192 | CPACF_DECRYPT);\n-}\n-\n-static struct skcipher_alg ecb_des3_alg = {\n-\t.base.cra_name\t\t=\t\"ecb(des3_ede)\",\n-\t.base.cra_driver_name\t=\t\"ecb-des3_ede-s390\",\n-\t.base.cra_priority\t=\t400,\t/* combo: des3 + ecb */\n-\t.base.cra_blocksize\t=\tDES_BLOCK_SIZE,\n-\t.base.cra_ctxsize\t=\tsizeof(struct s390_des_ctx),\n-\t.base.cra_module\t=\tTHIS_MODULE,\n-\t.min_keysize\t\t=\tDES3_KEY_SIZE,\n-\t.max_keysize\t\t=\tDES3_KEY_SIZE,\n-\t.setkey\t\t\t=\tdes3_setkey_skcipher,\n-\t.encrypt\t\t=\tecb_des3_encrypt,\n-\t.decrypt\t\t=\tecb_des3_decrypt,\n-};\n-\n-static int cbc_des3_encrypt(struct skcipher_request *req)\n-{\n-\treturn cbc_desall_crypt(req, CPACF_KMC_TDEA_192);\n-}\n-\n-static int cbc_des3_decrypt(struct skcipher_request *req)\n-{\n-\treturn cbc_desall_crypt(req, CPACF_KMC_TDEA_192 | CPACF_DECRYPT);\n-}\n-\n-static struct skcipher_alg cbc_des3_alg = {\n-\t.base.cra_name\t\t=\t\"cbc(des3_ede)\",\n-\t.base.cra_driver_name\t=\t\"cbc-des3_ede-s390\",\n-\t.base.cra_priority\t=\t400,\t/* combo: des3 + cbc */\n-\t.base.cra_blocksize\t=\tDES_BLOCK_SIZE,\n-\t.base.cra_ctxsize\t=\tsizeof(struct s390_des_ctx),\n-\t.base.cra_module\t=\tTHIS_MODULE,\n-\t.min_keysize\t\t=\tDES3_KEY_SIZE,\n-\t.max_keysize\t\t=\tDES3_KEY_SIZE,\n-\t.ivsize\t\t\t=\tDES_BLOCK_SIZE,\n-\t.setkey\t\t\t=\tdes3_setkey_skcipher,\n-\t.encrypt\t\t=\tcbc_des3_encrypt,\n-\t.decrypt\t\t=\tcbc_des3_decrypt,\n-};\n-\n-static unsigned int __ctrblk_init(u8 *ctrptr, u8 *iv, unsigned int nbytes)\n-{\n-\tunsigned int i, n;\n-\n-\t/* align to block size, max. PAGE_SIZE */\n-\tn = (nbytes > PAGE_SIZE) ? PAGE_SIZE : nbytes & ~(DES_BLOCK_SIZE - 1);\n-\tmemcpy(ctrptr, iv, DES_BLOCK_SIZE);\n-\tfor (i = (n / DES_BLOCK_SIZE) - 1; i > 0; i--) {\n-\t\tmemcpy(ctrptr + DES_BLOCK_SIZE, ctrptr, DES_BLOCK_SIZE);\n-\t\tcrypto_inc(ctrptr + DES_BLOCK_SIZE, DES_BLOCK_SIZE);\n-\t\tctrptr += DES_BLOCK_SIZE;\n-\t}\n-\treturn n;\n-}\n-\n-static int ctr_desall_crypt(struct skcipher_request *req, unsigned long fc)\n-{\n-\tstruct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);\n-\tstruct s390_des_ctx *ctx = crypto_skcipher_ctx(tfm);\n-\tu8 buf[DES_BLOCK_SIZE], *ctrptr;\n-\tstruct skcipher_walk walk;\n-\tunsigned int n, nbytes;\n-\tint ret, locked;\n-\n-\tlocked = mutex_trylock(&ctrblk_lock);\n-\n-\tret = skcipher_walk_virt(&walk, req, false);\n-\twhile ((nbytes = walk.nbytes) >= DES_BLOCK_SIZE) {\n-\t\tn = DES_BLOCK_SIZE;\n-\t\tif (nbytes >= 2*DES_BLOCK_SIZE && locked)\n-\t\t\tn = __ctrblk_init(ctrblk, walk.iv, nbytes);\n-\t\tctrptr = (n > DES_BLOCK_SIZE) ? ctrblk : walk.iv;\n-\t\tcpacf_kmctr(fc, ctx->key, walk.dst.virt.addr,\n-\t\t\t walk.src.virt.addr, n, ctrptr);\n-\t\tif (ctrptr == ctrblk)\n-\t\t\tmemcpy(walk.iv, ctrptr + n - DES_BLOCK_SIZE,\n-\t\t\t\tDES_BLOCK_SIZE);\n-\t\tcrypto_inc(walk.iv, DES_BLOCK_SIZE);\n-\t\tret = skcipher_walk_done(&walk, nbytes - n);\n-\t}\n-\tif (locked)\n-\t\tmutex_unlock(&ctrblk_lock);\n-\t/* final block may be < DES_BLOCK_SIZE, copy only nbytes */\n-\tif (nbytes) {\n-\t\tcpacf_kmctr(fc, ctx->key, buf, walk.src.virt.addr,\n-\t\t\t DES_BLOCK_SIZE, walk.iv);\n-\t\tmemcpy(walk.dst.virt.addr, buf, nbytes);\n-\t\tcrypto_inc(walk.iv, DES_BLOCK_SIZE);\n-\t\tret = skcipher_walk_done(&walk, 0);\n-\t}\n-\treturn ret;\n-}\n-\n-static int ctr_des_crypt(struct skcipher_request *req)\n-{\n-\treturn ctr_desall_crypt(req, CPACF_KMCTR_DEA);\n-}\n-\n-static struct skcipher_alg ctr_des_alg = {\n-\t.base.cra_name\t\t=\t\"ctr(des)\",\n-\t.base.cra_driver_name\t=\t\"ctr-des-s390\",\n-\t.base.cra_priority\t=\t400,\t/* combo: des + ctr */\n-\t.base.cra_blocksize\t=\t1,\n-\t.base.cra_ctxsize\t=\tsizeof(struct s390_des_ctx),\n-\t.base.cra_module\t=\tTHIS_MODULE,\n-\t.min_keysize\t\t=\tDES_KEY_SIZE,\n-\t.max_keysize\t\t=\tDES_KEY_SIZE,\n-\t.ivsize\t\t\t=\tDES_BLOCK_SIZE,\n-\t.setkey\t\t\t=\tdes_setkey_skcipher,\n-\t.encrypt\t\t=\tctr_des_crypt,\n-\t.decrypt\t\t=\tctr_des_crypt,\n-\t.chunksize\t\t=\tDES_BLOCK_SIZE,\n-};\n-\n-static int ctr_des3_crypt(struct skcipher_request *req)\n-{\n-\treturn ctr_desall_crypt(req, CPACF_KMCTR_TDEA_192);\n-}\n-\n-static struct skcipher_alg ctr_des3_alg = {\n-\t.base.cra_name\t\t=\t\"ctr(des3_ede)\",\n-\t.base.cra_driver_name\t=\t\"ctr-des3_ede-s390\",\n-\t.base.cra_priority\t=\t400,\t/* combo: des3 + ede */\n-\t.base.cra_blocksize\t=\t1,\n-\t.base.cra_ctxsize\t=\tsizeof(struct s390_des_ctx),\n-\t.base.cra_module\t=\tTHIS_MODULE,\n-\t.min_keysize\t\t=\tDES3_KEY_SIZE,\n-\t.max_keysize\t\t=\tDES3_KEY_SIZE,\n-\t.ivsize\t\t\t=\tDES_BLOCK_SIZE,\n-\t.setkey\t\t\t=\tdes3_setkey_skcipher,\n-\t.encrypt\t\t=\tctr_des3_crypt,\n-\t.decrypt\t\t=\tctr_des3_crypt,\n-\t.chunksize\t\t=\tDES_BLOCK_SIZE,\n-};\n-\n-static struct crypto_alg *des_s390_algs_ptr[2];\n-static int des_s390_algs_num;\n-static struct skcipher_alg *des_s390_skciphers_ptr[6];\n-static int des_s390_skciphers_num;\n-\n-static int des_s390_register_alg(struct crypto_alg *alg)\n-{\n-\tint ret;\n-\n-\tret = crypto_register_alg(alg);\n-\tif (!ret)\n-\t\tdes_s390_algs_ptr[des_s390_algs_num++] = alg;\n-\treturn ret;\n-}\n-\n-static int des_s390_register_skcipher(struct skcipher_alg *alg)\n-{\n-\tint ret;\n-\n-\tret = crypto_register_skcipher(alg);\n-\tif (!ret)\n-\t\tdes_s390_skciphers_ptr[des_s390_skciphers_num++] = alg;\n-\treturn ret;\n-}\n-\n-static void des_s390_exit(void)\n-{\n-\twhile (des_s390_algs_num--)\n-\t\tcrypto_unregister_alg(des_s390_algs_ptr[des_s390_algs_num]);\n-\twhile (des_s390_skciphers_num--)\n-\t\tcrypto_unregister_skcipher(des_s390_skciphers_ptr[des_s390_skciphers_num]);\n-\tif (ctrblk)\n-\t\tfree_page((unsigned long) ctrblk);\n-}\n-\n-static int __init des_s390_init(void)\n-{\n-\tint ret;\n-\n-\t/* Query available functions for KM, KMC and KMCTR */\n-\tcpacf_query(CPACF_KM, &km_functions);\n-\tcpacf_query(CPACF_KMC, &kmc_functions);\n-\tcpacf_query(CPACF_KMCTR, &kmctr_functions);\n-\n-\tif (cpacf_test_func(&km_functions, CPACF_KM_DEA)) {\n-\t\tret = des_s390_register_alg(&des_alg);\n-\t\tif (ret)\n-\t\t\tgoto out_err;\n-\t\tret = des_s390_register_skcipher(&ecb_des_alg);\n-\t\tif (ret)\n-\t\t\tgoto out_err;\n-\t}\n-\tif (cpacf_test_func(&kmc_functions, CPACF_KMC_DEA)) {\n-\t\tret = des_s390_register_skcipher(&cbc_des_alg);\n-\t\tif (ret)\n-\t\t\tgoto out_err;\n-\t}\n-\tif (cpacf_test_func(&km_functions, CPACF_KM_TDEA_192)) {\n-\t\tret = des_s390_register_alg(&des3_alg);\n-\t\tif (ret)\n-\t\t\tgoto out_err;\n-\t\tret = des_s390_register_skcipher(&ecb_des3_alg);\n-\t\tif (ret)\n-\t\t\tgoto out_err;\n-\t}\n-\tif (cpacf_test_func(&kmc_functions, CPACF_KMC_TDEA_192)) {\n-\t\tret = des_s390_register_skcipher(&cbc_des3_alg);\n-\t\tif (ret)\n-\t\t\tgoto out_err;\n-\t}\n-\n-\tif (cpacf_test_func(&kmctr_functions, CPACF_KMCTR_DEA) ||\n-\t cpacf_test_func(&kmctr_functions, CPACF_KMCTR_TDEA_192)) {\n-\t\tctrblk = (u8 *) __get_free_page(GFP_KERNEL);\n-\t\tif (!ctrblk) {\n-\t\t\tret = -ENOMEM;\n-\t\t\tgoto out_err;\n-\t\t}\n-\t}\n-\n-\tif (cpacf_test_func(&kmctr_functions, CPACF_KMCTR_DEA)) {\n-\t\tret = des_s390_register_skcipher(&ctr_des_alg);\n-\t\tif (ret)\n-\t\t\tgoto out_err;\n-\t}\n-\tif (cpacf_test_func(&kmctr_functions, CPACF_KMCTR_TDEA_192)) {\n-\t\tret = des_s390_register_skcipher(&ctr_des3_alg);\n-\t\tif (ret)\n-\t\t\tgoto out_err;\n-\t}\n-\n-\treturn 0;\n-out_err:\n-\tdes_s390_exit();\n-\treturn ret;\n-}\n-\n-module_cpu_feature_match(S390_CPU_FEATURE_MSA, des_s390_init);\n-module_exit(des_s390_exit);\n-\n-MODULE_ALIAS_CRYPTO(\"des\");\n-MODULE_ALIAS_CRYPTO(\"des3_ede\");\n-\n-MODULE_LICENSE(\"GPL\");\n-MODULE_DESCRIPTION(\"DES & Triple DES EDE Cipher Algorithms\");\n", "prefixes": [ "1/3" ] }