diff options
Diffstat (limited to 'drivers/crypto')
41 files changed, 126 insertions, 193 deletions
diff --git a/drivers/crypto/Kconfig b/drivers/crypto/Kconfig index 177b7713bd2d..0af08081e305 100644 --- a/drivers/crypto/Kconfig +++ b/drivers/crypto/Kconfig | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | 2 | ||
| 2 | menuconfig CRYPTO_HW | 3 | menuconfig CRYPTO_HW |
| 3 | bool "Hardware crypto devices" | 4 | bool "Hardware crypto devices" |
diff --git a/drivers/crypto/amcc/Makefile b/drivers/crypto/amcc/Makefile index e33c185fc163..d6623991328c 100644 --- a/drivers/crypto/amcc/Makefile +++ b/drivers/crypto/amcc/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += crypto4xx.o | 2 | obj-$(CONFIG_CRYPTO_DEV_PPC4XX) += crypto4xx.o |
| 2 | crypto4xx-y := crypto4xx_core.o crypto4xx_alg.o | 3 | crypto4xx-y := crypto4xx_core.o crypto4xx_alg.o |
| 3 | crypto4xx-$(CONFIG_HW_RANDOM_PPC4XX) += crypto4xx_trng.o | 4 | crypto4xx-$(CONFIG_HW_RANDOM_PPC4XX) += crypto4xx_trng.o |
diff --git a/drivers/crypto/axis/Makefile b/drivers/crypto/axis/Makefile index be9a84a4b667..146e09e4cc89 100644 --- a/drivers/crypto/axis/Makefile +++ b/drivers/crypto/axis/Makefile | |||
| @@ -1 +1,2 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | obj-$(CONFIG_CRYPTO_DEV_ARTPEC6) := artpec6_crypto.o | 2 | obj-$(CONFIG_CRYPTO_DEV_ARTPEC6) := artpec6_crypto.o |
diff --git a/drivers/crypto/axis/artpec6_crypto.c b/drivers/crypto/axis/artpec6_crypto.c index d2fb72811442..80fa04ef215f 100644 --- a/drivers/crypto/axis/artpec6_crypto.c +++ b/drivers/crypto/axis/artpec6_crypto.c | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | /* | 2 | /* |
| 2 | * Driver for ARTPEC-6 crypto block using the kernel asynchronous crypto api. | 3 | * Driver for ARTPEC-6 crypto block using the kernel asynchronous crypto api. |
| 3 | * | 4 | * |
diff --git a/drivers/crypto/bcm/Makefile b/drivers/crypto/bcm/Makefile index 7469e19afe85..8a2110b4eb8f 100644 --- a/drivers/crypto/bcm/Makefile +++ b/drivers/crypto/bcm/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | # File: drivers/crypto/bcm/Makefile | 2 | # File: drivers/crypto/bcm/Makefile |
| 2 | # | 3 | # |
| 3 | # Makefile for crypto acceleration files for Broadcom SPU driver | 4 | # Makefile for crypto acceleration files for Broadcom SPU driver |
diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c index e2ba3d202da5..fec39c35c877 100644 --- a/drivers/crypto/caam/ctrl.c +++ b/drivers/crypto/caam/ctrl.c | |||
| @@ -469,7 +469,7 @@ static int caam_get_era(struct caam_ctrl __iomem *ctrl) | |||
| 469 | } | 469 | } |
| 470 | 470 | ||
| 471 | /* | 471 | /* |
| 472 | * ERRATA: imx6 devices (imx6D, imx6Q, imx6DL, imx6S, imx6DP and imx6DQ) | 472 | * ERRATA: imx6 devices (imx6D, imx6Q, imx6DL, imx6S, imx6DP and imx6QP) |
| 473 | * have an issue wherein AXI bus transactions may not occur in the correct | 473 | * have an issue wherein AXI bus transactions may not occur in the correct |
| 474 | * order. This isn't a problem running single descriptors, but can be if | 474 | * order. This isn't a problem running single descriptors, but can be if |
| 475 | * running multiple concurrent descriptors. Reworking the driver to throttle | 475 | * running multiple concurrent descriptors. Reworking the driver to throttle |
diff --git a/drivers/crypto/cavium/Makefile b/drivers/crypto/cavium/Makefile index 641268b784be..4679c06b611f 100644 --- a/drivers/crypto/cavium/Makefile +++ b/drivers/crypto/cavium/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | # | 2 | # |
| 2 | # Makefile for Cavium crypto device drivers | 3 | # Makefile for Cavium crypto device drivers |
| 3 | # | 4 | # |
diff --git a/drivers/crypto/cavium/cpt/Kconfig b/drivers/crypto/cavium/cpt/Kconfig index cbd51b1aa046..b9874058d4fa 100644 --- a/drivers/crypto/cavium/cpt/Kconfig +++ b/drivers/crypto/cavium/cpt/Kconfig | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | # | 2 | # |
| 2 | # Cavium crypto device configuration | 3 | # Cavium crypto device configuration |
| 3 | # | 4 | # |
diff --git a/drivers/crypto/cavium/cpt/Makefile b/drivers/crypto/cavium/cpt/Makefile index dbf055e14622..0f04f1b5c6d1 100644 --- a/drivers/crypto/cavium/cpt/Makefile +++ b/drivers/crypto/cavium/cpt/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | obj-$(CONFIG_CAVIUM_CPT) += cptpf.o cptvf.o | 2 | obj-$(CONFIG_CAVIUM_CPT) += cptpf.o cptvf.o |
| 2 | cptpf-objs := cptpf_main.o cptpf_mbox.o | 3 | cptpf-objs := cptpf_main.o cptpf_mbox.o |
| 3 | cptvf-objs := cptvf_main.o cptvf_reqmanager.o cptvf_mbox.o cptvf_algs.o | 4 | cptvf-objs := cptvf_main.o cptvf_reqmanager.o cptvf_mbox.o cptvf_algs.o |
diff --git a/drivers/crypto/cavium/nitrox/Kconfig b/drivers/crypto/cavium/nitrox/Kconfig index 181a1dfec932..dab162af41b8 100644 --- a/drivers/crypto/cavium/nitrox/Kconfig +++ b/drivers/crypto/cavium/nitrox/Kconfig | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | # | 2 | # |
| 2 | # Cavium NITROX Crypto Device configuration | 3 | # Cavium NITROX Crypto Device configuration |
| 3 | # | 4 | # |
diff --git a/drivers/crypto/cavium/nitrox/nitrox_main.c b/drivers/crypto/cavium/nitrox/nitrox_main.c index faa78f651238..fe825d0ef9ca 100644 --- a/drivers/crypto/cavium/nitrox/nitrox_main.c +++ b/drivers/crypto/cavium/nitrox/nitrox_main.c | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | #include <linux/aer.h> | 2 | #include <linux/aer.h> |
| 2 | #include <linux/delay.h> | 3 | #include <linux/delay.h> |
| 3 | #include <linux/firmware.h> | 4 | #include <linux/firmware.h> |
diff --git a/drivers/crypto/ccp/Kconfig b/drivers/crypto/ccp/Kconfig index b9dfae47aefd..48f3edc1e3fb 100644 --- a/drivers/crypto/ccp/Kconfig +++ b/drivers/crypto/ccp/Kconfig | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | config CRYPTO_DEV_CCP_DD | 2 | config CRYPTO_DEV_CCP_DD |
| 2 | tristate "Secure Processor device driver" | 3 | tristate "Secure Processor device driver" |
| 3 | depends on CPU_SUP_AMD || ARM64 | 4 | depends on CPU_SUP_AMD || ARM64 |
diff --git a/drivers/crypto/chelsio/Kconfig b/drivers/crypto/chelsio/Kconfig index 930d82d991f2..4b9b37a130d3 100644 --- a/drivers/crypto/chelsio/Kconfig +++ b/drivers/crypto/chelsio/Kconfig | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | config CRYPTO_DEV_CHELSIO | 2 | config CRYPTO_DEV_CHELSIO |
| 2 | tristate "Chelsio Crypto Co-processor Driver" | 3 | tristate "Chelsio Crypto Co-processor Driver" |
| 3 | depends on CHELSIO_T4 | 4 | depends on CHELSIO_T4 |
diff --git a/drivers/crypto/chelsio/Makefile b/drivers/crypto/chelsio/Makefile index b7bd980a27d8..a3c05e2f4562 100644 --- a/drivers/crypto/chelsio/Makefile +++ b/drivers/crypto/chelsio/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | ccflags-y := -I $(srctree)/drivers/net/ethernet/chelsio/cxgb4 | 2 | ccflags-y := -I $(srctree)/drivers/net/ethernet/chelsio/cxgb4 |
| 2 | 3 | ||
| 3 | obj-$(CONFIG_CRYPTO_DEV_CHELSIO) += chcr.o | 4 | obj-$(CONFIG_CRYPTO_DEV_CHELSIO) += chcr.o |
diff --git a/drivers/crypto/chelsio/chtls/Makefile b/drivers/crypto/chelsio/chtls/Makefile index b958f1b8ec39..bc11495acdb3 100644 --- a/drivers/crypto/chelsio/chtls/Makefile +++ b/drivers/crypto/chelsio/chtls/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | ccflags-y := -I $(srctree)/drivers/net/ethernet/chelsio/cxgb4 \ | 2 | ccflags-y := -I $(srctree)/drivers/net/ethernet/chelsio/cxgb4 \ |
| 2 | -I $(srctree)/drivers/crypto/chelsio | 3 | -I $(srctree)/drivers/crypto/chelsio |
| 3 | 4 | ||
diff --git a/drivers/crypto/inside-secure/Makefile b/drivers/crypto/inside-secure/Makefile index 302f07dde98c..13f64f96c626 100644 --- a/drivers/crypto/inside-secure/Makefile +++ b/drivers/crypto/inside-secure/Makefile | |||
| @@ -1,2 +1,3 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | obj-$(CONFIG_CRYPTO_DEV_SAFEXCEL) += crypto_safexcel.o | 2 | obj-$(CONFIG_CRYPTO_DEV_SAFEXCEL) += crypto_safexcel.o |
| 2 | crypto_safexcel-objs := safexcel.o safexcel_ring.o safexcel_cipher.o safexcel_hash.o | 3 | crypto_safexcel-objs := safexcel.o safexcel_ring.o safexcel_cipher.o safexcel_hash.o |
diff --git a/drivers/crypto/marvell/Makefile b/drivers/crypto/marvell/Makefile index 0c12b13574dc..b27cab65e696 100644 --- a/drivers/crypto/marvell/Makefile +++ b/drivers/crypto/marvell/Makefile | |||
| @@ -1,2 +1,3 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | obj-$(CONFIG_CRYPTO_DEV_MARVELL_CESA) += marvell-cesa.o | 2 | obj-$(CONFIG_CRYPTO_DEV_MARVELL_CESA) += marvell-cesa.o |
| 2 | marvell-cesa-objs := cesa.o cipher.o hash.o tdma.o | 3 | marvell-cesa-objs := cesa.o cipher.o hash.o tdma.o |
diff --git a/drivers/crypto/mediatek/Makefile b/drivers/crypto/mediatek/Makefile index 187be79c7f3e..196a4653974e 100644 --- a/drivers/crypto/mediatek/Makefile +++ b/drivers/crypto/mediatek/Makefile | |||
| @@ -1,2 +1,3 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | obj-$(CONFIG_CRYPTO_DEV_MEDIATEK) += mtk-crypto.o | 2 | obj-$(CONFIG_CRYPTO_DEV_MEDIATEK) += mtk-crypto.o |
| 2 | mtk-crypto-objs:= mtk-platform.o mtk-aes.o mtk-sha.o | 3 | mtk-crypto-objs:= mtk-platform.o mtk-aes.o mtk-sha.o |
diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c index 0d5d3d8eb680..760e72a5893b 100644 --- a/drivers/crypto/n2_core.c +++ b/drivers/crypto/n2_core.c | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | /* n2_core.c: Niagara2 Stream Processing Unit (SPU) crypto support. | 2 | /* n2_core.c: Niagara2 Stream Processing Unit (SPU) crypto support. |
| 2 | * | 3 | * |
| 3 | * Copyright (C) 2010, 2011 David S. Miller <davem@davemloft.net> | 4 | * Copyright (C) 2010, 2011 David S. Miller <davem@davemloft.net> |
diff --git a/drivers/crypto/nx/Kconfig b/drivers/crypto/nx/Kconfig index cd5dda9c48f4..23e3d0160e67 100644 --- a/drivers/crypto/nx/Kconfig +++ b/drivers/crypto/nx/Kconfig | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | 2 | ||
| 2 | config CRYPTO_DEV_NX_ENCRYPT | 3 | config CRYPTO_DEV_NX_ENCRYPT |
| 3 | tristate "Encryption acceleration support on pSeries platform" | 4 | tristate "Encryption acceleration support on pSeries platform" |
diff --git a/drivers/crypto/nx/nx-842-pseries.c b/drivers/crypto/nx/nx-842-pseries.c index 57932848361b..5c4aa606208c 100644 --- a/drivers/crypto/nx/nx-842-pseries.c +++ b/drivers/crypto/nx/nx-842-pseries.c | |||
| @@ -1,20 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 1 | /* | 2 | /* |
| 2 | * Driver for IBM Power 842 compression accelerator | 3 | * Driver for IBM Power 842 compression accelerator |
| 3 | * | 4 | * |
| 4 | * This program is free software; you can redistribute it and/or modify | ||
| 5 | * it under the terms of the GNU General Public License as published by | ||
| 6 | * the Free Software Foundation; either version 2 of the License, or | ||
| 7 | * (at your option) any later version. | ||
| 8 | * | ||
| 9 | * This program is distributed in the hope that it will be useful, | ||
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 12 | * GNU General Public License for more details. | ||
| 13 | * | ||
| 14 | * You should have received a copy of the GNU General Public License | ||
| 15 | * along with this program; if not, write to the Free Software | ||
| 16 | * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
| 17 | * | ||
| 18 | * Copyright (C) IBM Corporation, 2012 | 5 | * Copyright (C) IBM Corporation, 2012 |
| 19 | * | 6 | * |
| 20 | * Authors: Robert Jennings <rcj@linux.vnet.ibm.com> | 7 | * Authors: Robert Jennings <rcj@linux.vnet.ibm.com> |
diff --git a/drivers/crypto/padlock-aes.c b/drivers/crypto/padlock-aes.c index 09d823d36d3a..ad020133da19 100644 --- a/drivers/crypto/padlock-aes.c +++ b/drivers/crypto/padlock-aes.c | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | /* | 2 | /* |
| 2 | * Cryptographic API. | 3 | * Cryptographic API. |
| 3 | * | 4 | * |
diff --git a/drivers/crypto/qat/Kconfig b/drivers/crypto/qat/Kconfig index ce3cae40f949..6ab7e5a88756 100644 --- a/drivers/crypto/qat/Kconfig +++ b/drivers/crypto/qat/Kconfig | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | config CRYPTO_DEV_QAT | 2 | config CRYPTO_DEV_QAT |
| 2 | tristate | 3 | tristate |
| 3 | select CRYPTO_AEAD | 4 | select CRYPTO_AEAD |
diff --git a/drivers/crypto/qat/qat_c3xxx/Makefile b/drivers/crypto/qat/qat_c3xxx/Makefile index 822b5de58ec6..92ef416ccc78 100644 --- a/drivers/crypto/qat/qat_c3xxx/Makefile +++ b/drivers/crypto/qat/qat_c3xxx/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | ccflags-y := -I $(srctree)/$(src)/../qat_common | 2 | ccflags-y := -I $(srctree)/$(src)/../qat_common |
| 2 | obj-$(CONFIG_CRYPTO_DEV_QAT_C3XXX) += qat_c3xxx.o | 3 | obj-$(CONFIG_CRYPTO_DEV_QAT_C3XXX) += qat_c3xxx.o |
| 3 | qat_c3xxx-objs := adf_drv.o adf_c3xxx_hw_data.o | 4 | qat_c3xxx-objs := adf_drv.o adf_c3xxx_hw_data.o |
diff --git a/drivers/crypto/qat/qat_c3xxxvf/Makefile b/drivers/crypto/qat/qat_c3xxxvf/Makefile index 8f56d27c7479..b6d76825a92c 100644 --- a/drivers/crypto/qat/qat_c3xxxvf/Makefile +++ b/drivers/crypto/qat/qat_c3xxxvf/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | ccflags-y := -I $(srctree)/$(src)/../qat_common | 2 | ccflags-y := -I $(srctree)/$(src)/../qat_common |
| 2 | obj-$(CONFIG_CRYPTO_DEV_QAT_C3XXXVF) += qat_c3xxxvf.o | 3 | obj-$(CONFIG_CRYPTO_DEV_QAT_C3XXXVF) += qat_c3xxxvf.o |
| 3 | qat_c3xxxvf-objs := adf_drv.o adf_c3xxxvf_hw_data.o | 4 | qat_c3xxxvf-objs := adf_drv.o adf_c3xxxvf_hw_data.o |
diff --git a/drivers/crypto/qat/qat_c62x/Makefile b/drivers/crypto/qat/qat_c62x/Makefile index 6dcd404578fc..d581f7c87d6c 100644 --- a/drivers/crypto/qat/qat_c62x/Makefile +++ b/drivers/crypto/qat/qat_c62x/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | ccflags-y := -I $(srctree)/$(src)/../qat_common | 2 | ccflags-y := -I $(srctree)/$(src)/../qat_common |
| 2 | obj-$(CONFIG_CRYPTO_DEV_QAT_C62X) += qat_c62x.o | 3 | obj-$(CONFIG_CRYPTO_DEV_QAT_C62X) += qat_c62x.o |
| 3 | qat_c62x-objs := adf_drv.o adf_c62x_hw_data.o | 4 | qat_c62x-objs := adf_drv.o adf_c62x_hw_data.o |
diff --git a/drivers/crypto/qat/qat_c62xvf/Makefile b/drivers/crypto/qat/qat_c62xvf/Makefile index 1e5d51de778f..446c3d638605 100644 --- a/drivers/crypto/qat/qat_c62xvf/Makefile +++ b/drivers/crypto/qat/qat_c62xvf/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | ccflags-y := -I $(srctree)/$(src)/../qat_common | 2 | ccflags-y := -I $(srctree)/$(src)/../qat_common |
| 2 | obj-$(CONFIG_CRYPTO_DEV_QAT_C62XVF) += qat_c62xvf.o | 3 | obj-$(CONFIG_CRYPTO_DEV_QAT_C62XVF) += qat_c62xvf.o |
| 3 | qat_c62xvf-objs := adf_drv.o adf_c62xvf_hw_data.o | 4 | qat_c62xvf-objs := adf_drv.o adf_c62xvf_hw_data.o |
diff --git a/drivers/crypto/qat/qat_dh895xcc/Makefile b/drivers/crypto/qat/qat_dh895xcc/Makefile index 0fc06b1e1632..38d6f8e1624a 100644 --- a/drivers/crypto/qat/qat_dh895xcc/Makefile +++ b/drivers/crypto/qat/qat_dh895xcc/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | ccflags-y := -I $(srctree)/$(src)/../qat_common | 2 | ccflags-y := -I $(srctree)/$(src)/../qat_common |
| 2 | obj-$(CONFIG_CRYPTO_DEV_QAT_DH895xCC) += qat_dh895xcc.o | 3 | obj-$(CONFIG_CRYPTO_DEV_QAT_DH895xCC) += qat_dh895xcc.o |
| 3 | qat_dh895xcc-objs := adf_drv.o adf_dh895xcc_hw_data.o | 4 | qat_dh895xcc-objs := adf_drv.o adf_dh895xcc_hw_data.o |
diff --git a/drivers/crypto/qat/qat_dh895xccvf/Makefile b/drivers/crypto/qat/qat_dh895xccvf/Makefile index 9ce906af6034..0153c85ce743 100644 --- a/drivers/crypto/qat/qat_dh895xccvf/Makefile +++ b/drivers/crypto/qat/qat_dh895xccvf/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | ccflags-y := -I $(srctree)/$(src)/../qat_common | 2 | ccflags-y := -I $(srctree)/$(src)/../qat_common |
| 2 | obj-$(CONFIG_CRYPTO_DEV_QAT_DH895xCCVF) += qat_dh895xccvf.o | 3 | obj-$(CONFIG_CRYPTO_DEV_QAT_DH895xCCVF) += qat_dh895xccvf.o |
| 3 | qat_dh895xccvf-objs := adf_drv.o adf_dh895xccvf_hw_data.o | 4 | qat_dh895xccvf-objs := adf_drv.o adf_dh895xccvf_hw_data.o |
diff --git a/drivers/crypto/rockchip/Makefile b/drivers/crypto/rockchip/Makefile index 30f91297b4b6..6e23764e6c8a 100644 --- a/drivers/crypto/rockchip/Makefile +++ b/drivers/crypto/rockchip/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP) += rk_crypto.o | 2 | obj-$(CONFIG_CRYPTO_DEV_ROCKCHIP) += rk_crypto.o |
| 2 | rk_crypto-objs := rk3288_crypto.o \ | 3 | rk_crypto-objs := rk3288_crypto.o \ |
| 3 | rk3288_crypto_ablkcipher.o \ | 4 | rk3288_crypto_ablkcipher.o \ |
diff --git a/drivers/crypto/stm32/Kconfig b/drivers/crypto/stm32/Kconfig index 4491e2197d9f..d6576280fc9b 100644 --- a/drivers/crypto/stm32/Kconfig +++ b/drivers/crypto/stm32/Kconfig | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | config CRYPTO_DEV_STM32_CRC | 2 | config CRYPTO_DEV_STM32_CRC |
| 2 | tristate "Support for STM32 crc accelerators" | 3 | tristate "Support for STM32 crc accelerators" |
| 3 | depends on ARCH_STM32 | 4 | depends on ARCH_STM32 |
diff --git a/drivers/crypto/stm32/Makefile b/drivers/crypto/stm32/Makefile index 53d1bb94b221..ce77e38c77e0 100644 --- a/drivers/crypto/stm32/Makefile +++ b/drivers/crypto/stm32/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | obj-$(CONFIG_CRYPTO_DEV_STM32_CRC) += stm32_crc32.o | 2 | obj-$(CONFIG_CRYPTO_DEV_STM32_CRC) += stm32_crc32.o |
| 2 | obj-$(CONFIG_CRYPTO_DEV_STM32_HASH) += stm32-hash.o | 3 | obj-$(CONFIG_CRYPTO_DEV_STM32_HASH) += stm32-hash.o |
| 3 | obj-$(CONFIG_CRYPTO_DEV_STM32_CRYP) += stm32-cryp.o | 4 | obj-$(CONFIG_CRYPTO_DEV_STM32_CRYP) += stm32-cryp.o |
diff --git a/drivers/crypto/sunxi-ss/Makefile b/drivers/crypto/sunxi-ss/Makefile index ccb893219079..c0a2797d3168 100644 --- a/drivers/crypto/sunxi-ss/Makefile +++ b/drivers/crypto/sunxi-ss/Makefile | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sun4i-ss.o | 2 | obj-$(CONFIG_CRYPTO_DEV_SUN4I_SS) += sun4i-ss.o |
| 2 | sun4i-ss-y += sun4i-ss-core.o sun4i-ss-hash.o sun4i-ss-cipher.o | 3 | sun4i-ss-y += sun4i-ss-core.o sun4i-ss-hash.o sun4i-ss-cipher.o |
| 3 | sun4i-ss-$(CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG) += sun4i-ss-prng.o | 4 | sun4i-ss-$(CONFIG_CRYPTO_DEV_SUN4I_SS_PRNG) += sun4i-ss-prng.o |
diff --git a/drivers/crypto/virtio/Kconfig b/drivers/crypto/virtio/Kconfig index a4324b1383a4..01b625e4e5ad 100644 --- a/drivers/crypto/virtio/Kconfig +++ b/drivers/crypto/virtio/Kconfig | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | config CRYPTO_DEV_VIRTIO | 2 | config CRYPTO_DEV_VIRTIO |
| 2 | tristate "VirtIO crypto driver" | 3 | tristate "VirtIO crypto driver" |
| 3 | depends on VIRTIO | 4 | depends on VIRTIO |
diff --git a/drivers/crypto/virtio/virtio_crypto_algs.c b/drivers/crypto/virtio/virtio_crypto_algs.c index 0704833ece92..10f266d462d6 100644 --- a/drivers/crypto/virtio/virtio_crypto_algs.c +++ b/drivers/crypto/virtio/virtio_crypto_algs.c | |||
| @@ -1,21 +1,9 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 1 | /* Algorithms supported by virtio crypto device | 2 | /* Algorithms supported by virtio crypto device |
| 2 | * | 3 | * |
| 3 | * Authors: Gonglei <arei.gonglei@huawei.com> | 4 | * Authors: Gonglei <arei.gonglei@huawei.com> |
| 4 | * | 5 | * |
| 5 | * Copyright 2016 HUAWEI TECHNOLOGIES CO., LTD. | 6 | * Copyright 2016 HUAWEI TECHNOLOGIES CO., LTD. |
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License as published by | ||
| 9 | * the Free Software Foundation; either version 2 of the License, or | ||
| 10 | * (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
| 19 | */ | 7 | */ |
| 20 | 8 | ||
| 21 | #include <linux/scatterlist.h> | 9 | #include <linux/scatterlist.h> |
diff --git a/drivers/crypto/virtio/virtio_crypto_common.h b/drivers/crypto/virtio/virtio_crypto_common.h index 63ef7f7924ea..1c6e00da5a29 100644 --- a/drivers/crypto/virtio/virtio_crypto_common.h +++ b/drivers/crypto/virtio/virtio_crypto_common.h | |||
| @@ -1,19 +1,7 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ | ||
| 1 | /* Common header for Virtio crypto device. | 2 | /* Common header for Virtio crypto device. |
| 2 | * | 3 | * |
| 3 | * Copyright 2016 HUAWEI TECHNOLOGIES CO., LTD. | 4 | * Copyright 2016 HUAWEI TECHNOLOGIES CO., LTD. |
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | 5 | */ |
| 18 | 6 | ||
| 19 | #ifndef _VIRTIO_CRYPTO_COMMON_H | 7 | #ifndef _VIRTIO_CRYPTO_COMMON_H |
diff --git a/drivers/crypto/virtio/virtio_crypto_core.c b/drivers/crypto/virtio/virtio_crypto_core.c index 3c9e120287af..c8a962c62663 100644 --- a/drivers/crypto/virtio/virtio_crypto_core.c +++ b/drivers/crypto/virtio/virtio_crypto_core.c | |||
| @@ -1,19 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 1 | /* Driver for Virtio crypto device. | 2 | /* Driver for Virtio crypto device. |
| 2 | * | 3 | * |
| 3 | * Copyright 2016 HUAWEI TECHNOLOGIES CO., LTD. | 4 | * Copyright 2016 HUAWEI TECHNOLOGIES CO., LTD. |
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | 5 | */ |
| 18 | 6 | ||
| 19 | #include <linux/err.h> | 7 | #include <linux/err.h> |
diff --git a/drivers/crypto/virtio/virtio_crypto_mgr.c b/drivers/crypto/virtio/virtio_crypto_mgr.c index d70de3a4f7d7..6860f8180c7c 100644 --- a/drivers/crypto/virtio/virtio_crypto_mgr.c +++ b/drivers/crypto/virtio/virtio_crypto_mgr.c | |||
| @@ -1,19 +1,7 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 1 | /* Management for virtio crypto devices (refer to adf_dev_mgr.c) | 2 | /* Management for virtio crypto devices (refer to adf_dev_mgr.c) |
| 2 | * | 3 | * |
| 3 | * Copyright 2016 HUAWEI TECHNOLOGIES CO., LTD. | 4 | * Copyright 2016 HUAWEI TECHNOLOGIES CO., LTD. |
| 4 | * | ||
| 5 | * This program is free software; you can redistribute it and/or modify | ||
| 6 | * it under the terms of the GNU General Public License as published by | ||
| 7 | * the Free Software Foundation; either version 2 of the License, or | ||
| 8 | * (at your option) any later version. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, see <http://www.gnu.org/licenses/>. | ||
| 17 | */ | 5 | */ |
| 18 | 6 | ||
| 19 | #include <linux/mutex.h> | 7 | #include <linux/mutex.h> |
diff --git a/drivers/crypto/vmx/Kconfig b/drivers/crypto/vmx/Kconfig index c3d524ea6998..c85fab7ef0bd 100644 --- a/drivers/crypto/vmx/Kconfig +++ b/drivers/crypto/vmx/Kconfig | |||
| @@ -1,3 +1,4 @@ | |||
| 1 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 1 | config CRYPTO_DEV_VMX_ENCRYPT | 2 | config CRYPTO_DEV_VMX_ENCRYPT |
| 2 | tristate "Encryption acceleration support on P8 CPU" | 3 | tristate "Encryption acceleration support on P8 CPU" |
| 3 | depends on CRYPTO_DEV_VMX | 4 | depends on CRYPTO_DEV_VMX |
diff --git a/drivers/crypto/vmx/aesp8-ppc.pl b/drivers/crypto/vmx/aesp8-ppc.pl index de78282b8f44..9c6b5c1d6a1a 100644 --- a/drivers/crypto/vmx/aesp8-ppc.pl +++ b/drivers/crypto/vmx/aesp8-ppc.pl | |||
| @@ -1357,7 +1357,7 @@ Loop_ctr32_enc: | |||
| 1357 | addi $idx,$idx,16 | 1357 | addi $idx,$idx,16 |
| 1358 | bdnz Loop_ctr32_enc | 1358 | bdnz Loop_ctr32_enc |
| 1359 | 1359 | ||
| 1360 | vadduwm $ivec,$ivec,$one | 1360 | vadduqm $ivec,$ivec,$one |
| 1361 | vmr $dat,$inptail | 1361 | vmr $dat,$inptail |
| 1362 | lvx $inptail,0,$inp | 1362 | lvx $inptail,0,$inp |
| 1363 | addi $inp,$inp,16 | 1363 | addi $inp,$inp,16 |
diff --git a/drivers/crypto/vmx/ghash.c b/drivers/crypto/vmx/ghash.c index b5a6883bb09e..14807ac2e3b9 100644 --- a/drivers/crypto/vmx/ghash.c +++ b/drivers/crypto/vmx/ghash.c | |||
| @@ -1,22 +1,14 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 1 | /** | 2 | /** |
| 2 | * GHASH routines supporting VMX instructions on the Power 8 | 3 | * GHASH routines supporting VMX instructions on the Power 8 |
| 3 | * | 4 | * |
| 4 | * Copyright (C) 2015 International Business Machines Inc. | 5 | * Copyright (C) 2015, 2019 International Business Machines Inc. |
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License as published by | ||
| 8 | * the Free Software Foundation; version 2 only. | ||
| 9 | * | ||
| 10 | * This program is distributed in the hope that it will be useful, | ||
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 13 | * GNU General Public License for more details. | ||
| 14 | * | ||
| 15 | * You should have received a copy of the GNU General Public License | ||
| 16 | * along with this program; if not, write to the Free Software | ||
| 17 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 18 | * | 6 | * |
| 19 | * Author: Marcelo Henrique Cerri <mhcerri@br.ibm.com> | 7 | * Author: Marcelo Henrique Cerri <mhcerri@br.ibm.com> |
| 8 | * | ||
| 9 | * Extended by Daniel Axtens <dja@axtens.net> to replace the fallback | ||
| 10 | * mechanism. The new approach is based on arm64 code, which is: | ||
| 11 | * Copyright (C) 2014 - 2018 Linaro Ltd. <ard.biesheuvel@linaro.org> | ||
| 20 | */ | 12 | */ |
| 21 | 13 | ||
| 22 | #include <linux/types.h> | 14 | #include <linux/types.h> |
| @@ -38,70 +30,25 @@ void gcm_ghash_p8(u64 Xi[2], const u128 htable[16], | |||
| 38 | const u8 *in, size_t len); | 30 | const u8 *in, size_t len); |
| 39 | 31 | ||
| 40 | struct p8_ghash_ctx { | 32 | struct p8_ghash_ctx { |
| 33 | /* key used by vector asm */ | ||
| 41 | u128 htable[16]; | 34 | u128 htable[16]; |
| 42 | struct crypto_shash *fallback; | 35 | /* key used by software fallback */ |
| 36 | be128 key; | ||
| 43 | }; | 37 | }; |
| 44 | 38 | ||
| 45 | struct p8_ghash_desc_ctx { | 39 | struct p8_ghash_desc_ctx { |
| 46 | u64 shash[2]; | 40 | u64 shash[2]; |
| 47 | u8 buffer[GHASH_DIGEST_SIZE]; | 41 | u8 buffer[GHASH_DIGEST_SIZE]; |
| 48 | int bytes; | 42 | int bytes; |
| 49 | struct shash_desc fallback_desc; | ||
| 50 | }; | 43 | }; |
| 51 | 44 | ||
| 52 | static int p8_ghash_init_tfm(struct crypto_tfm *tfm) | ||
| 53 | { | ||
| 54 | const char *alg = "ghash-generic"; | ||
| 55 | struct crypto_shash *fallback; | ||
| 56 | struct crypto_shash *shash_tfm = __crypto_shash_cast(tfm); | ||
| 57 | struct p8_ghash_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 58 | |||
| 59 | fallback = crypto_alloc_shash(alg, 0, CRYPTO_ALG_NEED_FALLBACK); | ||
| 60 | if (IS_ERR(fallback)) { | ||
| 61 | printk(KERN_ERR | ||
| 62 | "Failed to allocate transformation for '%s': %ld\n", | ||
| 63 | alg, PTR_ERR(fallback)); | ||
| 64 | return PTR_ERR(fallback); | ||
| 65 | } | ||
| 66 | |||
| 67 | crypto_shash_set_flags(fallback, | ||
| 68 | crypto_shash_get_flags((struct crypto_shash | ||
| 69 | *) tfm)); | ||
| 70 | |||
| 71 | /* Check if the descsize defined in the algorithm is still enough. */ | ||
| 72 | if (shash_tfm->descsize < sizeof(struct p8_ghash_desc_ctx) | ||
| 73 | + crypto_shash_descsize(fallback)) { | ||
| 74 | printk(KERN_ERR | ||
| 75 | "Desc size of the fallback implementation (%s) does not match the expected value: %lu vs %u\n", | ||
| 76 | alg, | ||
| 77 | shash_tfm->descsize - sizeof(struct p8_ghash_desc_ctx), | ||
| 78 | crypto_shash_descsize(fallback)); | ||
| 79 | return -EINVAL; | ||
| 80 | } | ||
| 81 | ctx->fallback = fallback; | ||
| 82 | |||
| 83 | return 0; | ||
| 84 | } | ||
| 85 | |||
| 86 | static void p8_ghash_exit_tfm(struct crypto_tfm *tfm) | ||
| 87 | { | ||
| 88 | struct p8_ghash_ctx *ctx = crypto_tfm_ctx(tfm); | ||
| 89 | |||
| 90 | if (ctx->fallback) { | ||
| 91 | crypto_free_shash(ctx->fallback); | ||
| 92 | ctx->fallback = NULL; | ||
| 93 | } | ||
| 94 | } | ||
| 95 | |||
| 96 | static int p8_ghash_init(struct shash_desc *desc) | 45 | static int p8_ghash_init(struct shash_desc *desc) |
| 97 | { | 46 | { |
| 98 | struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm)); | ||
| 99 | struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc); | 47 | struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
| 100 | 48 | ||
| 101 | dctx->bytes = 0; | 49 | dctx->bytes = 0; |
| 102 | memset(dctx->shash, 0, GHASH_DIGEST_SIZE); | 50 | memset(dctx->shash, 0, GHASH_DIGEST_SIZE); |
| 103 | dctx->fallback_desc.tfm = ctx->fallback; | 51 | return 0; |
| 104 | return crypto_shash_init(&dctx->fallback_desc); | ||
| 105 | } | 52 | } |
| 106 | 53 | ||
| 107 | static int p8_ghash_setkey(struct crypto_shash *tfm, const u8 *key, | 54 | static int p8_ghash_setkey(struct crypto_shash *tfm, const u8 *key, |
| @@ -119,7 +66,51 @@ static int p8_ghash_setkey(struct crypto_shash *tfm, const u8 *key, | |||
| 119 | disable_kernel_vsx(); | 66 | disable_kernel_vsx(); |
| 120 | pagefault_enable(); | 67 | pagefault_enable(); |
| 121 | preempt_enable(); | 68 | preempt_enable(); |
| 122 | return crypto_shash_setkey(ctx->fallback, key, keylen); | 69 | |
| 70 | memcpy(&ctx->key, key, GHASH_BLOCK_SIZE); | ||
| 71 | |||
| 72 | return 0; | ||
| 73 | } | ||
| 74 | |||
| 75 | static inline void __ghash_block(struct p8_ghash_ctx *ctx, | ||
| 76 | struct p8_ghash_desc_ctx *dctx) | ||
| 77 | { | ||
| 78 | if (crypto_simd_usable()) { | ||
| 79 | preempt_disable(); | ||
| 80 | pagefault_disable(); | ||
| 81 | enable_kernel_vsx(); | ||
| 82 | gcm_ghash_p8(dctx->shash, ctx->htable, | ||
| 83 | dctx->buffer, GHASH_DIGEST_SIZE); | ||
| 84 | disable_kernel_vsx(); | ||
| 85 | pagefault_enable(); | ||
| 86 | preempt_enable(); | ||
| 87 | } else { | ||
| 88 | crypto_xor((u8 *)dctx->shash, dctx->buffer, GHASH_BLOCK_SIZE); | ||
| 89 | gf128mul_lle((be128 *)dctx->shash, &ctx->key); | ||
| 90 | } | ||
| 91 | } | ||
| 92 | |||
| 93 | static inline void __ghash_blocks(struct p8_ghash_ctx *ctx, | ||
| 94 | struct p8_ghash_desc_ctx *dctx, | ||
| 95 | const u8 *src, unsigned int srclen) | ||
| 96 | { | ||
| 97 | if (crypto_simd_usable()) { | ||
| 98 | preempt_disable(); | ||
| 99 | pagefault_disable(); | ||
| 100 | enable_kernel_vsx(); | ||
| 101 | gcm_ghash_p8(dctx->shash, ctx->htable, | ||
| 102 | src, srclen); | ||
| 103 | disable_kernel_vsx(); | ||
| 104 | pagefault_enable(); | ||
| 105 | preempt_enable(); | ||
| 106 | } else { | ||
| 107 | while (srclen >= GHASH_BLOCK_SIZE) { | ||
| 108 | crypto_xor((u8 *)dctx->shash, src, GHASH_BLOCK_SIZE); | ||
| 109 | gf128mul_lle((be128 *)dctx->shash, &ctx->key); | ||
| 110 | srclen -= GHASH_BLOCK_SIZE; | ||
| 111 | src += GHASH_BLOCK_SIZE; | ||
| 112 | } | ||
| 113 | } | ||
| 123 | } | 114 | } |
| 124 | 115 | ||
| 125 | static int p8_ghash_update(struct shash_desc *desc, | 116 | static int p8_ghash_update(struct shash_desc *desc, |
| @@ -129,49 +120,33 @@ static int p8_ghash_update(struct shash_desc *desc, | |||
| 129 | struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm)); | 120 | struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm)); |
| 130 | struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc); | 121 | struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
| 131 | 122 | ||
| 132 | if (!crypto_simd_usable()) { | 123 | if (dctx->bytes) { |
| 133 | return crypto_shash_update(&dctx->fallback_desc, src, | 124 | if (dctx->bytes + srclen < GHASH_DIGEST_SIZE) { |
| 134 | srclen); | ||
| 135 | } else { | ||
| 136 | if (dctx->bytes) { | ||
| 137 | if (dctx->bytes + srclen < GHASH_DIGEST_SIZE) { | ||
| 138 | memcpy(dctx->buffer + dctx->bytes, src, | ||
| 139 | srclen); | ||
| 140 | dctx->bytes += srclen; | ||
| 141 | return 0; | ||
| 142 | } | ||
| 143 | memcpy(dctx->buffer + dctx->bytes, src, | 125 | memcpy(dctx->buffer + dctx->bytes, src, |
| 144 | GHASH_DIGEST_SIZE - dctx->bytes); | 126 | srclen); |
| 145 | preempt_disable(); | 127 | dctx->bytes += srclen; |
| 146 | pagefault_disable(); | 128 | return 0; |
| 147 | enable_kernel_vsx(); | ||
| 148 | gcm_ghash_p8(dctx->shash, ctx->htable, | ||
| 149 | dctx->buffer, GHASH_DIGEST_SIZE); | ||
| 150 | disable_kernel_vsx(); | ||
| 151 | pagefault_enable(); | ||
| 152 | preempt_enable(); | ||
| 153 | src += GHASH_DIGEST_SIZE - dctx->bytes; | ||
| 154 | srclen -= GHASH_DIGEST_SIZE - dctx->bytes; | ||
| 155 | dctx->bytes = 0; | ||
| 156 | } | ||
| 157 | len = srclen & ~(GHASH_DIGEST_SIZE - 1); | ||
| 158 | if (len) { | ||
| 159 | preempt_disable(); | ||
| 160 | pagefault_disable(); | ||
| 161 | enable_kernel_vsx(); | ||
| 162 | gcm_ghash_p8(dctx->shash, ctx->htable, src, len); | ||
| 163 | disable_kernel_vsx(); | ||
| 164 | pagefault_enable(); | ||
| 165 | preempt_enable(); | ||
| 166 | src += len; | ||
| 167 | srclen -= len; | ||
| 168 | } | ||
| 169 | if (srclen) { | ||
| 170 | memcpy(dctx->buffer, src, srclen); | ||
| 171 | dctx->bytes = srclen; | ||
| 172 | } | 129 | } |
| 173 | return 0; | 130 | memcpy(dctx->buffer + dctx->bytes, src, |
| 131 | GHASH_DIGEST_SIZE - dctx->bytes); | ||
| 132 | |||
| 133 | __ghash_block(ctx, dctx); | ||
| 134 | |||
| 135 | src += GHASH_DIGEST_SIZE - dctx->bytes; | ||
| 136 | srclen -= GHASH_DIGEST_SIZE - dctx->bytes; | ||
| 137 | dctx->bytes = 0; | ||
| 138 | } | ||
| 139 | len = srclen & ~(GHASH_DIGEST_SIZE - 1); | ||
| 140 | if (len) { | ||
| 141 | __ghash_blocks(ctx, dctx, src, len); | ||
| 142 | src += len; | ||
| 143 | srclen -= len; | ||
| 174 | } | 144 | } |
| 145 | if (srclen) { | ||
| 146 | memcpy(dctx->buffer, src, srclen); | ||
| 147 | dctx->bytes = srclen; | ||
| 148 | } | ||
| 149 | return 0; | ||
| 175 | } | 150 | } |
| 176 | 151 | ||
| 177 | static int p8_ghash_final(struct shash_desc *desc, u8 *out) | 152 | static int p8_ghash_final(struct shash_desc *desc, u8 *out) |
| @@ -180,25 +155,14 @@ static int p8_ghash_final(struct shash_desc *desc, u8 *out) | |||
| 180 | struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm)); | 155 | struct p8_ghash_ctx *ctx = crypto_tfm_ctx(crypto_shash_tfm(desc->tfm)); |
| 181 | struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc); | 156 | struct p8_ghash_desc_ctx *dctx = shash_desc_ctx(desc); |
| 182 | 157 | ||
| 183 | if (!crypto_simd_usable()) { | 158 | if (dctx->bytes) { |
| 184 | return crypto_shash_final(&dctx->fallback_desc, out); | 159 | for (i = dctx->bytes; i < GHASH_DIGEST_SIZE; i++) |
| 185 | } else { | 160 | dctx->buffer[i] = 0; |
| 186 | if (dctx->bytes) { | 161 | __ghash_block(ctx, dctx); |
| 187 | for (i = dctx->bytes; i < GHASH_DIGEST_SIZE; i++) | 162 | dctx->bytes = 0; |
| 188 | dctx->buffer[i] = 0; | ||
| 189 | preempt_disable(); | ||
| 190 | pagefault_disable(); | ||
| 191 | enable_kernel_vsx(); | ||
| 192 | gcm_ghash_p8(dctx->shash, ctx->htable, | ||
| 193 | dctx->buffer, GHASH_DIGEST_SIZE); | ||
| 194 | disable_kernel_vsx(); | ||
| 195 | pagefault_enable(); | ||
| 196 | preempt_enable(); | ||
| 197 | dctx->bytes = 0; | ||
| 198 | } | ||
| 199 | memcpy(out, dctx->shash, GHASH_DIGEST_SIZE); | ||
| 200 | return 0; | ||
| 201 | } | 163 | } |
| 164 | memcpy(out, dctx->shash, GHASH_DIGEST_SIZE); | ||
| 165 | return 0; | ||
| 202 | } | 166 | } |
| 203 | 167 | ||
| 204 | struct shash_alg p8_ghash_alg = { | 168 | struct shash_alg p8_ghash_alg = { |
| @@ -213,11 +177,8 @@ struct shash_alg p8_ghash_alg = { | |||
| 213 | .cra_name = "ghash", | 177 | .cra_name = "ghash", |
| 214 | .cra_driver_name = "p8_ghash", | 178 | .cra_driver_name = "p8_ghash", |
| 215 | .cra_priority = 1000, | 179 | .cra_priority = 1000, |
| 216 | .cra_flags = CRYPTO_ALG_NEED_FALLBACK, | ||
| 217 | .cra_blocksize = GHASH_BLOCK_SIZE, | 180 | .cra_blocksize = GHASH_BLOCK_SIZE, |
| 218 | .cra_ctxsize = sizeof(struct p8_ghash_ctx), | 181 | .cra_ctxsize = sizeof(struct p8_ghash_ctx), |
| 219 | .cra_module = THIS_MODULE, | 182 | .cra_module = THIS_MODULE, |
| 220 | .cra_init = p8_ghash_init_tfm, | ||
| 221 | .cra_exit = p8_ghash_exit_tfm, | ||
| 222 | }, | 183 | }, |
| 223 | }; | 184 | }; |
