[OpenWrt-Devel] [PATCH] mpc85xx: revert enabling the crypto acceleration driver in the kernel config instead of packaging it

Achim Gottinger achim at ag-web.biz
Thu May 31 14:12:20 EDT 2018



Am 31.05.2018 um 19:12 schrieb Achim Gottinger:
> Hello List,
>
> Since the commit 
> https://git.openwrt.org/?p=openwrt/openwrt.git;a=commit;h=c00e5a4f09115ec976fac7dc380f576ef6a24fab 
> strongswan is broken on WDR4900v1.
> An bug report can be seen here: 
> https://bugs.openwrt.org/index.php?do=details&task_id=1262.
> To get strongswan working again i made an patch which reverts the 
> changes from above commit.
> Now if the caam modules are loaded strongswan still fails but without 
> the caam modules loades it works as expected.
> With the caam modules build in caam can not be disabled by the openwrt 
> user.
>
> ---------------------------
> diff --git a/package/kernel/linux/modules/crypto.mk 
> b/package/kernel/linux/modules/crypto.mk
> index 2ea2d2c0e7..4074e2679a 100644
> --- a/package/kernel/linux/modules/crypto.mk
> +++ b/package/kernel/linux/modules/crypto.mk
> @@ -271,6 +271,31 @@ endef
>
>  $(eval $(call KernelPackage,crypto-hmac))
>
> +define KernelPackage/crypto-hw-caam
> +  TITLE:=Freescale CAAM driver (SEC4)
> +  DEPENDS:=@TARGET_mpc85xx +kmod-crypto-aead +kmod-crypto-authenc 
> +kmod-crypto-hash +kmod-random-core
> +  KCONFIG:= \
> +       CONFIG_CRYPTO_HW=y \
> +       CONFIG_CRYPTO_DEV_FSL_CAAM \
> +       CONFIG_CRYPTO_DEV_FSL_CAAM_JR \
> +       CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API \
> +       CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API \
> +       CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API \
> +       CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9 \
> +       CONFIG_CRYPTO_DEV_FSL_CAAM_IMX=n \
> +       CONFIG_CRYPTO_DEV_FSL_CAAM_INTC=n \
> +       CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG=n
> +  FILES:= \
> +       $(LINUX_DIR)/drivers/crypto/caam/caam.ko \
> +       $(LINUX_DIR)/drivers/crypto/caam/caamalg.ko \
> +       $(LINUX_DIR)/drivers/crypto/caam/caamhash.ko \
> +       $(LINUX_DIR)/drivers/crypto/caam/caam_jr.ko \
> +       $(LINUX_DIR)/drivers/crypto/caam/caamrng.ko
> +  AUTOLOAD:=$(call AutoLoad,09,caam caamalg caamhash caam_jr caamrng)
> +  $(call AddDepends/crypto)
> +endef
> +
> +$(eval $(call KernelPackage,crypto-hw-caam))
>
>  define KernelPackage/crypto-hw-ccp
>    TITLE:=AMD Cryptographic Coprocessor
> diff --git a/target/linux/mpc85xx/config-4.9 
> b/target/linux/mpc85xx/config-4.9
> index 68568c4a62..dc2e5a8820 100644
> --- a/target/linux/mpc85xx/config-4.9
> +++ b/target/linux/mpc85xx/config-4.9
> @@ -47,16 +47,16 @@ CONFIG_CRYPTO_AEAD2=y
>  CONFIG_CRYPTO_AKCIPHER=y
>  CONFIG_CRYPTO_AKCIPHER2=y
>  CONFIG_CRYPTO_AUTHENC=y
> -CONFIG_CRYPTO_DEV_FSL_CAAM=y
> -CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y
> -CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y
> +#CONFIG_CRYPTO_DEV_FSL_CAAM=y
> +#CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y
> +#CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y
>  # CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set
>  # CONFIG_CRYPTO_DEV_FSL_CAAM_IMX is not set
>  # CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set
> -CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y
> -CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API=y
> -CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9
> -CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y
> +#CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y
> +#CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API=y
> +#CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9
> +#CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y
>  CONFIG_CRYPTO_HASH=y
>  CONFIG_CRYPTO_HASH2=y
>  CONFIG_CRYPTO_HW=y
> ---------------------------
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/listinfo/openwrt-devel

Had to modify the patch to include the caam_pkc.ko module. I also found 
that the caamrng.ko module does not load. In case this breaks things 
would it make sense to use two targets one with and one without build in 
caam support. I mainly use  openwrt  for vpn routers so I rely on 
working strongswan packages.

-----------------------------------------
diff --git a/package/kernel/linux/modules/crypto.mk 
b/package/kernel/linux/modules/crypto.mk
index 2ea2d2c0e7..dbb0d59012 100644
--- a/package/kernel/linux/modules/crypto.mk
+++ b/package/kernel/linux/modules/crypto.mk
@@ -271,6 +271,33 @@ endef

  $(eval $(call KernelPackage,crypto-hmac))

+define KernelPackage/crypto-hw-caam
+  TITLE:=Freescale CAAM driver (SEC4)
+  DEPENDS:=@TARGET_mpc85xx +kmod-crypto-aead +kmod-crypto-authenc 
+kmod-crypto-hash +kmod-random-core
+  KCONFIG:= \
+       CONFIG_CRYPTO_HW=y \
+       CONFIG_CRYPTO_DEV_FSL_CAAM \
+       CONFIG_CRYPTO_DEV_FSL_CAAM_JR \
+       CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API \
+       CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API \
+       CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API \
+       CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API \
+       CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9 \
+       CONFIG_CRYPTO_DEV_FSL_CAAM_IMX=n \
+       CONFIG_CRYPTO_DEV_FSL_CAAM_INTC=n \
+       CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG=n
+  FILES:= \
+       $(LINUX_DIR)/drivers/crypto/caam/caam.ko \
+       $(LINUX_DIR)/drivers/crypto/caam/caamalg.ko \
+       $(LINUX_DIR)/drivers/crypto/caam/caamhash.ko \
+       $(LINUX_DIR)/drivers/crypto/caam/caam_pkc.ko \
+       $(LINUX_DIR)/drivers/crypto/caam/caam_jr.ko \
+       $(LINUX_DIR)/drivers/crypto/caam/caamrng.ko
+  AUTOLOAD:=$(call AutoLoad,09,caam caamalg caamhash caam_jr caam_pkc 
caamrng)
+  $(call AddDepends/crypto)
+endef
+
+$(eval $(call KernelPackage,crypto-hw-caam))

  define KernelPackage/crypto-hw-ccp
    TITLE:=AMD Cryptographic Coprocessor
diff --git a/target/linux/mpc85xx/config-4.9 
b/target/linux/mpc85xx/config-4.9
index 68568c4a62..dc2e5a8820 100644
--- a/target/linux/mpc85xx/config-4.9
+++ b/target/linux/mpc85xx/config-4.9
@@ -47,16 +47,16 @@ CONFIG_CRYPTO_AEAD2=y
  CONFIG_CRYPTO_AKCIPHER=y
  CONFIG_CRYPTO_AKCIPHER2=y
  CONFIG_CRYPTO_AUTHENC=y
-CONFIG_CRYPTO_DEV_FSL_CAAM=y
-CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y
-CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y
+#CONFIG_CRYPTO_DEV_FSL_CAAM=y
+#CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y
+#CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y
  # CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set
  # CONFIG_CRYPTO_DEV_FSL_CAAM_IMX is not set
  # CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set
-CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y
-CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API=y
-CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9
-CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y
+#CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y
+#CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API=y
+#CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9
+#CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y
  CONFIG_CRYPTO_HASH=y
  CONFIG_CRYPTO_HASH2=y
  CONFIG_CRYPTO_HW=y
-----------------------------------------

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/listinfo/openwrt-devel


More information about the openwrt-devel mailing list