Does IMX6Q Cryptographic Acceleration work in Linux 4.1.15?

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

Does IMX6Q Cryptographic Acceleration work in Linux 4.1.15?

586 Views
ivyliu
Contributor IV

Hi All,

Has anyone worked with IMX6Q Cryptographic Acceleration with Linux 4.1.15?

I am very new to cryptographic algorithm. I just tested the speed of aes and rc4 on my IMX6 Quad board with Linux 4.1.15. From the result below, we can see the hardware did improve aes speed in 16/64/1024 bytes, but get worse in 256 bytes and there is no improvement in RC4.

Is the way I am using wrong?

Is there any patch I need to use?

# openssl speed -evp aes-128-cbc
Doing aes-128-cbc for 3s on 16 size blocks: 47957 aes-128-cbc's in 0.10s
Doing aes-128-cbc for 3s on 64 size blocks: 42772 aes-128-cbc's in 0.02s
Doing aes-128-cbc for 3s on 256 size blocks: 40349 aes-128-cbc's in 0.03s
Doing aes-128-cbc for 3s on 1024 size blocks: 27385 aes-128-cbc's in 0.04s
Doing aes-128-cbc for 3s on 8192 size blocks: 8508 aes-128-cbc's in 0.00s
OpenSSL 1.0.2h 3 May 2016
built on: reproducible build, date unspecified
options:bn(64,32) rc4(ptr,char) des(idx,cisc,16,long) aes(partial) idea(int) blowfish(ptr)
compiler: arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/home/workspace2/psc-arm-yocto-bsp/build-geminivfe/tmp/sysroots -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE
_DLFCN_H -DL_ENDIAN -DTERMIO -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/workspace2/psc-arm-yocto-bsp/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/openssl/1.0.2h-r0=/usr/src/debug/openssl/1.0.2h-r0 -fdebug-prefix-map=/home/workspace2/psc-arm-yocto-bsp/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/workspace2/psc-arm-yocto-bsp/build/tmp/sysroots= -Wall -Wa,--noexecstack -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF
2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
aes-128-cbc 7673.12k 136870.40k 344311.47k 701056.00k infk


# openssl speed -evp aes-128-cbc -engine cryptodev
engine "cryptodev" set.
Doing aes-128-cbc for 3s on 16 size blocks: 48346 aes-128-cbc's in 0.09s
Doing aes-128-cbc for 3s on 64 size blocks: 42793 aes-128-cbc's in 0.01s
Doing aes-128-cbc for 3s on 256 size blocks: 40272 aes-128-cbc's in 0.04s
Doing aes-128-cbc for 3s on 1024 size blocks: 27395 aes-128-cbc's in 0.03s
Doing aes-128-cbc for 3s on 8192 size blocks: 8503 aes-128-cbc's in 0.00s
OpenSSL 1.0.2h 3 May 2016
built on: reproducible build, date unspecified
options:bn(64,32) rc4(ptr,char) des(idx,cisc,16,long) aes(partial) idea(int) blowfish(ptr)
compiler: arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/home/workspace2/psc-arm-y
octo-bsp/build/tmp/sysroots -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE
_DLFCN_H -DL_ENDIAN -DTERMIO -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/workspace2/psc-arm-yocto-bsp/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/openssl/1.0.2h-r0=/usr/src/debug/openssl/1.0.2h-r0 -fdebug-prefix-map=/home/workspace2/psc-arm-yocto-bsp/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/workspace2/psc-arm-yocto-bsp/build/tmp/sysroots= -Wall -Wa,--noexecstack -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF
2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
aes-128-cbc 8594.84k 273875.20k 257740.80k 935082.67k infk

# openssl speed -evp rc4 
Doing rc4 for 3s on 16 size blocks: 9022661 rc4's in 3.00s
Doing rc4 for 3s on 64 size blocks: 2938185 rc4's in 3.00s
Doing rc4 for 3s on 256 size blocks: 791755 rc4's in 3.00s
Doing rc4 for 3s on 1024 size blocks: 201967 rc4's in 3.00s
Doing rc4 for 3s on 8192 size blocks: 25355 rc4's in 3.00s
OpenSSL 1.0.2h 3 May 2016
built on: reproducible build, date unspecified
options:bn(64,32) rc4(ptr,char) des(idx,cisc,16,long) aes(partial) idea(int) blowfish(ptr)
compiler: arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/home/workspace2/psc-arm-yocto-bsp/build/tmp/sysroots -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE
_DLFCN_H -DL_ENDIAN -DTERMIO -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/workspace2/psc-arm-yocto-bsp/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/openssl/1.0.2h-r0=/usr/src/debug/openssl/1.0.2h-r0 -fdebug-prefix-map=/home/workspace2/psc-arm-yocto-bsp/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/workspace2/psc-arm-yocto-bsp/build/tmp/sysroots= -Wall -Wa,--noexecstack -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF
2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
rc4 48120.86k 62681.28k 67563.09k 68938.07k 69236.05k

# openssl speed -evp rc4 -engine cryptodev
engine "cryptodev" set.
Doing rc4 for 3s on 16 size blocks: 9069058 rc4's in 3.00s
Doing rc4 for 3s on 64 size blocks: 2938390 rc4's in 3.00s
Doing rc4 for 3s on 256 size blocks: 792343 rc4's in 3.00s
Doing rc4 for 3s on 1024 size blocks: 202019 rc4's in 3.00s
Doing rc4 for 3s on 8192 size blocks: 25358 rc4's in 3.00s
OpenSSL 1.0.2h 3 May 2016
built on: reproducible build, date unspecified
options:bn(64,32) rc4(ptr,char) des(idx,cisc,16,long) aes(partial) idea(int) blowfish(ptr)
compiler: arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/home/workspace2/psc-arm-yocto-bsp/build/tmp/sysroots -I. -I.. -I../include -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE
_DLFCN_H -DL_ENDIAN -DTERMIO -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/workspace2/psc-arm-yocto-bsp/build/tmp/work/cortexa9hf-neon-poky-linux-gnueabi/openssl/1.0.2h-r0=/usr/src/debug/openssl/1.0.2h-r0 -fdebug-prefix-map=/home/workspace2/psc-arm-yocto-bsp/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/workspace2/psc-arm-yocto-bsp/build/tmp/sysroots= -Wall -Wa,--noexecstack -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF
2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM
The 'numbers' are in 1000s of bytes per second processed.
type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
rc4 48368.31k 62685.65k 67613.27k 68955.82k 69244.25k

Thanks and Best Regards,

Ivy

Labels (2)
0 Kudos
2 Replies

404 Views
Yuri
NXP Employee
NXP Employee

Hello,

  Looks like CAAM cryptodev driver was not installed :

$ modprobe cryptodev
$ openssl speed -evp aes-128-cbc -engine cryptodev

Have a great day,
Yuri

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

404 Views
ivyliu
Contributor IV

Hi Yuri,

Thanks for your reply.

I did install the driver.

And I test it again today, it is getting worse.

# modprobe cryptodev
cryptodev: driver 1.8 loaded.

# lsmod
Module Size Used by
cryptodev 37229 0

# openssl speed -evp aes-128-cbc
Doing aes-128-cbc for 3s on 16 size blocks: 42534 aes-128-cbc's in 0.02s
Doing aes-128-cbc for 3s on 64 size blocks: 38909 aes-128-cbc's in 0.10s
Doing aes-128-cbc for 3s on 256 size blocks: 37372 aes-128-cbc's in 0.10s
Doing aes-128-cbc for 3s on 1024 size blocks: 27444 aes-128-cbc's in 0.02s
Doing aes-128-cbc for 3s on 8192 size blocks: 8038 aes-128-cbc's in 0.01s
OpenSSL 1.0.2h 3 May 2016

type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
aes-128-cbc 34027.20k 24901.76k 95672.32k 1405132.80k 6584729.60k


# openssl speed -evp aes-128-cbc -engine cryptodev
engine "cryptodev" set.
Doing aes-128-cbc for 3s on 16 size blocks: 48313 aes-128-cbc's in 0.10s
Doing aes-128-cbc for 3s on 64 size blocks: 42964 aes-128-cbc's in 0.06s
Doing aes-128-cbc for 3s on 256 size blocks: 40275 aes-128-cbc's in 0.05s
Doing aes-128-cbc for 3s on 1024 size blocks: 27367 aes-128-cbc's in 0.04s
Doing aes-128-cbc for 3s on 8192 size blocks: 8513 aes-128-cbc's in 0.00s
OpenSSL 1.0.2h 3 May 2016

type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes
aes-128-cbc 7730.08k 45828.27k 206208.00k 700595.20k infk

Thanks and Best Regards,

Ivy

0 Kudos