CAAM cryptodev speed

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

CAAM cryptodev speed

2,117 Views
yilingxu
Contributor III

I run Linux version 4.9.11-1.0.0 on Imx6q, I want to see whether cryptodev can speed up encryption/decryption.

I do this test many times, only one time the test result match what  "i.mx_Linux_User's_Guide.pdf " suggests I should see(Start cryptodev will accelerate encryption/decryption).  Others show me a different story, It seems cryptodev doesn't work at all. What's wrong?

The test results as follow:

root@imx6qsabresd:~# modprobe -r cryptodev
cryptodev: driver unloaded.
root@imx6qsabresd:~# sudo openssl speed -evp aes-128-cbc -engine cryptodev
invalid engine "cryptodev"
1995609296:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:187:filename(/usr/lib/engines/libcryptodev.so): /usr/lib/engines/libcryptodev.so: cannot open shared object file: No such file or directory
1995609296:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:233:
1995609296:error:260B6084:engine routines:DYNAMIC_LOAD:dso not found:eng_dyn.c:467:
1995609296:error:2606A074:engine routines:ENGINE_by_id:no such engine:eng_list.c:390:id=cryptodev
1995609296:error:25066067:DSO support routines:DLFCN_LOAD:could not load the shared library:dso_dlfcn.c:187:filename(libcryptodev.so): libcryptodev.so: cannot open shared object file: No such file or directory
1995609296:error:25070067:DSO support routines:DSO_load:could not load the shared library:dso_lib.c:233:
1995609296:error:260B6084:engine routines:DYNAMIC_LOAD:dso not found:eng_dyn.c:467:
Doing aes-128-cbc for 3s on 16 size blocks: 5529706 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 64 size blocks: 1580875 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 256 size blocks: 410234 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 1024 size blocks: 103837 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 8192 size blocks: 13062 aes-128-cbc's in 3.00s
OpenSSL 1.0.2j 26 Sep 2016
......


root@imx6qsabresd:~# modprobe cryptodev
cryptodev: driver 1.8 loaded.
root@imx6qsabresd:~# sudo openssl speed -evp aes-128-cbc -engine cryptodev
engine "cryptodev" set.
Doing aes-128-cbc for 3s on 16 size blocks: 5536156 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 64 size blocks: 1579256 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 256 size blocks: 411891 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 1024 size blocks: 103832 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 8192 size blocks: 13003 aes-128-cbc's in 3.00s
OpenSSL 1.0.2j 26 Sep 2016
......

root@imx6qsabresd:~# lsmod
Module Size Used by
cryptodev 38503 0
ov5642_camera 78301 0
mxc_v4l2_capture 25674 0
ipu_bg_overlay_sdc 6400 1 mxc_v4l2_capture
ipu_still 2480 1 mxc_v4l2_capture
ipu_prp_enc 6956 1 mxc_v4l2_capture
ipu_csi_enc 4143 1 mxc_v4l2_capture
ipu_fg_overlay_sdc 7062 1 mxc_v4l2_capture
ov5640_camera_mipi_int 23334 0
ov5640_camera_int 20623 0
v4l2_int_device 3121 4 ov5642_camera,ov5640_camera_mipi_int,ov5640_camera_int,mxc_v4l2_capture
mxc_dcic 6640 0
galcore 353929 10

Labels (1)
0 Kudos
Reply
3 Replies

1,553 Views
marouene_boubakri
NXP Employee
NXP Employee

Dear yilingxu‌,

After unloading cryptodev module,you should remove -engine cryptodev in your second command line. 

# openssl speed -evp aes-128-cbc

And than you can compare the results.

Regards

Maro

0 Kudos
Reply

1,553 Views
yilingxu
Contributor III

Hi Maro, 

I do this test again, but the result still not good, it seems 3s is the normal speed, but cryptodev does not speed up.

the test result as follow:

root@imx6qsabresd:/# modprobe cryptodev
cryptodev: driver 1.8 loaded.
root@imx6qsabresd:/# openssl speed -evp aes-128-cbc -engine cryptodev
engine "cryptodev" set.
Doing aes-128-cbc for 3s on 16 size blocks: 5509731 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 64 size blocks: 1565265 aes-128-cbc's in 2.97s
Doing aes-128-cbc for 3s on 256 size blocks: 413766 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 1024 size blocks: 104883 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 8192 size blocks: 13130 aes-128-cbc's in 3.00s
OpenSSL 1.0.2j 26 Sep 2016
......
root@imx6qsabresd:/# modprobe -r cryptodev
cryptodev: driver unloaded.
root@imx6qsabresd:/# openssl speed -evp aes-128-cbc
Doing aes-128-cbc for 3s on 16 size blocks: 5547967 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 64 size blocks: 1585028 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 256 size blocks: 415932 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 1024 size blocks: 105073 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 8192 size blocks: 13195 aes-128-cbc's in 3.00s
OpenSSL 1.0.2j 26 Sep 2016
......

Besides, I find cryptodev.ko directly in rootfs (/lib/modules/ 4.9.11-1.0.0+gc27010d/extra), but I can't find cryptodev source code in linux kernel code download from nxp git . So where can I get cryptodev source code?

Thanks,

Yiling Xu

0 Kudos
Reply

1,553 Views
marouene_boubakri
NXP Employee
NXP Employee

Dear Yiling, 

Please run the following command to be sure that AES-CBC is supported by your Cryptodev.

$ openssl engine cryptodev -c

Cryptodev can be added to your board by adding it to the Yocto recipe or in Buildroot menuconfig.

You can also clone it from the repository here and build it manually.

If this reply answers your question, please click the Correct Answer button.

Regards

Maro