LSDK Sec Engine Integration

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

LSDK Sec Engine Integration

跳至解决方案
3,069 次查看
rashmikj
Contributor III

Hi, I am trying to integrate cryptodev_linux component. I used the following commands to generate bootpartition.

$ flex-builder -c cryptodev_linux -a arm64
$ flex-builder -c openssl -a arm64
$ flex-builder -i merge-component -a arm64:
$ flex-builder -i mkbootpartition -a arm64

I copied the bootpartition in sd card and used the following command in the kit.

flex-installer -b bootpartition_LS_arm64_lts_5.4.tgz -r rootfs_lsdk2004_ubuntu_main_arm64.tgz -d /dev/mmcblk0

when i reboot the kit and run the following command ,

modprobe caamalg

It shows error as 

"caamalg not found in modules.dep"

How do i  make openssl use sec engine for the operations?? Kindly help.

0 项奖励
回复
1 解答
3,015 次查看
yipingwang
NXP TechSupport
NXP TechSupport

Please execute the following commands

$ flex-builder -c cryptodev_linux -a arm64
$ flex-builder -c openssl -a arm64:
$ flex-builder -i merge-component -a arm64
$ flex-builder -i mkbootpartition -a arm64

$ flex-builder -i mkrfs -r ubuntu:main

Then run the following command, please note you need to use /dev/mmcblk0(the device name)

# flex-installer -b bootpartition_LS_arm64_lts_5.4.tgz -r rootfs_lsdk2004_ubuntu_main_arm64.tgz -d /dev/mmcblk0

在原帖中查看解决方案

0 项奖励
回复
11 回复数
3,051 次查看
yipingwang
NXP TechSupport
NXP TechSupport

If you want to use "modprobe caamalg", you need to build caamalg as Linux Kernel module when build Linux Kernel image, you need to configure "CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API" as "m" in Linux Kernel configuration file.

However in the default Linux Kernel configuration file, these SEC related Kernel options have already been configured as built-in mode, so "modprobe caamalg" is not needed.

# CONFIG_CRYPTO_DEV_MARVELL_CESA is not set
CONFIG_CRYPTO_DEV_FSL_CAAM_COMMON=y
CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_DESC=y
CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API_DESC=y
CONFIG_CRYPTO_DEV_FSL_CAAM=y
# CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG is not set
CONFIG_CRYPTO_DEV_FSL_CAAM_JR=y
CONFIG_CRYPTO_DEV_FSL_CAAM_RINGSIZE=9
# CONFIG_CRYPTO_DEV_FSL_CAAM_INTC is not set
CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API=y
CONFIG_CRYPTO_DEV_FSL_CAAM_CRYPTO_API_QI=y
CONFIG_CRYPTO_DEV_FSL_CAAM_AHASH_API=y
CONFIG_CRYPTO_DEV_FSL_CAAM_PKC_API=y
CONFIG_CRYPTO_DEV_FSL_CAAM_RNG_API=y

 

You need to use "modprobe cryptodev" for hardware offloading with OpenSSL.

0 项奖励
回复
3,044 次查看
rashmikj
Contributor III

When i use modprobe cryptodev also , I get the same error.

Module cryptodev not found in modules.dep

0 项奖励
回复
3,039 次查看
yipingwang
NXP TechSupport
NXP TechSupport

Please mount the second SD partition to /mnt, then check whether cryptodev.ko exists in module folder.

$ mount /dev/mmcblk0p2 /mnt

root@localhost:~# find /mnt/modules/ -name cryptodev.ko
/mnt/modules/4.19.90/extra/cryptodev.ko
/mnt/modules/5.4.3/extra/cryptodev.ko

If cryptodev.ko exists in the bootpartition, please check whether it exists in the rootfs filesystem.

root@localhost:~# find / -name cryptodev.ko
/boot/modules/4.19.90/extra/cryptodev.ko
/boot/modules/5.4.3/extra/cryptodev.ko

You could use the pre_built images which could be downloaded as the following.

$ wget https://www.nxp.com/lgfiles/sdk/lsdk2004/bootpartition_LS_arm64_lts_5.4.tgz
$ wget https://www.nxp.com/lgfiles/sdk/lsdk2004/rootfs_lsdk2004_ubuntu_main_arm64.tgz

0 项奖励
回复
3,031 次查看
rashmikj
Contributor III

I tried the steps suggested by you . I have attached error enclosed.

How do i integrate cryptodev with openssl and create an image as i want it to be part of the image. I tried these steps as suggested by you in one of my pevious query 

flex-builder -c cryptodev_linux -a arm64 $
flex-builder -c openssl -a arm64 $
flex-builder -i mkrfs -r yocto:tiny $ f
flex-builder -i merge-component -r yocto:tiny $
flex-builder -i mklinux -r yocto:tiny $
flex-builder -i mkfw -m ls1046ardb -b qspi

But still when i type modprobe cryptodev , I get the following error,

Cryptodev not found in modules.dep.

 

0 项奖励
回复
3,028 次查看
yipingwang
NXP TechSupport
NXP TechSupport

In LSDK 20.04, Kernel module cryptodev.ko is integrated in bootpartition.

Please execute the following commands

$ flex-builder -c cryptodev_linux -a arm64
$ flex-builder -c openssl -a arm64:
$ flex-builder -i merge-component -a arm64
$ flex-builder -i mkbootpartition -a arm64

$ flex-builder -i mkrfs -r ubuntu:main

Then run the following command, please note you need to use /dev/mmcblk0(the device name)

# flex-installer -b bootpartition_LS_arm64_lts_5.4.tgz -r rootfs_lsdk2004_ubuntu_main_arm64.tgz -d /dev/mmcblk0

0 项奖励
回复
3,026 次查看
rashmikj
Contributor III

Thanks for the reply.

I tried your previous instruction.

When i enter the following , I get this error

root@TinyLinux:/mnt# /mnt/modules/5.4.3/extra/cryptodev.ko
-sh: /mnt/modules/5.4.3/extra/cryptodev.ko: Permission denied

0 项奖励
回复
3,023 次查看
yipingwang
NXP TechSupport
NXP TechSupport

Please use the above instruction which I posted just now.

0 项奖励
回复
3,018 次查看
rashmikj
Contributor III

Sorry I couldn't follow . Which Instruction??

0 项奖励
回复
3,016 次查看
yipingwang
NXP TechSupport
NXP TechSupport

Please execute the following commands

$ flex-builder -c cryptodev_linux -a arm64
$ flex-builder -c openssl -a arm64:
$ flex-builder -i merge-component -a arm64
$ flex-builder -i mkbootpartition -a arm64

$ flex-builder -i mkrfs -r ubuntu:main

Then run the following command, please note you need to use /dev/mmcblk0(the device name)

# flex-installer -b bootpartition_LS_arm64_lts_5.4.tgz -r rootfs_lsdk2004_ubuntu_main_arm64.tgz -d /dev/mmcblk0

0 项奖励
回复
3,005 次查看
rashmikj
Contributor III

Thank you. Its working

0 项奖励
回复
3,011 次查看
rashmikj
Contributor III

Sir , 

I executed those instructions. everything worked fine. Now how do i link openssl with cryptodev ?

For that I executed ur previous instruction

root@localhost:~# find /mnt/modules/ -name cryptodev.ko

root@TinyLinux:/mnt# /mnt/modules/5.4.3/extra/cryptodev.ko
-sh: /mnt/modules/5.4.3/extra/cryptodev.ko: Permission denied

0 项奖励
回复