LSDK Sec Engine Integration

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LSDK Sec Engine Integration

Jump to solution
2,166 Views
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 Kudos
1 Solution
2,112 Views
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

View solution in original post

0 Kudos
11 Replies
2,148 Views
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 Kudos
2,141 Views
rashmikj
Contributor III

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

Module cryptodev not found in modules.dep

0 Kudos
2,136 Views
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 Kudos
2,128 Views
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 Kudos
2,125 Views
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 Kudos
2,123 Views
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 Kudos
2,120 Views
yipingwang
NXP TechSupport
NXP TechSupport

Please use the above instruction which I posted just now.

0 Kudos
2,115 Views
rashmikj
Contributor III

Sorry I couldn't follow . Which Instruction??

0 Kudos
2,113 Views
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 Kudos
2,102 Views
rashmikj
Contributor III

Thank you. Its working

0 Kudos
2,108 Views
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 Kudos