Hi,
As per the original question, I am trying to verify the hardware acceleration in AM5728 EVM. According to this link, Cryptodev kernel module is not supported on AM57XX SoCs.
So I ran the openssl commands through the AF_ALG engine on AM5728 EVM. This engine was available in the TI Linux PSDK 6.03 at /usr/lib/engines-1.1/afalg.so .I am getting following output -
root@am57xx-evm:/# openssl speed -evp aes-128-cbc -engine afalg engine "afalg" set. Doing aes-128-cbc for 3s on 16 size blocks: 157308 aes-128-cbc's in 0.24s Doing aes-128-cbc for 3s on 64 size blocks: 151927 aes-128-cbc's in 0.18s Doing aes-128-cbc for 3s on 256 size blocks: 49680 aes-128-cbc's in 0.11s Doing aes-128-cbc for 3s on 1024 size blocks: 31503 aes-128-cbc's in 0.05s Doing aes-128-cbc for 3s on 8192 size blocks: 10444 aes-128-cbc's in 0.02s Doing aes-128-cbc for 3s on 16384 size blocks: 5827 aes-128-cbc's in 0.01s OpenSSL 1.1.1b 26 Feb 2019 built on: Sun Apr 19 02:06:32 2020 UTC options:bn(64,32) rc4(char) des(long) aes(partial) idea(int) blowfish(ptr) compiler: arm-linux-gnueabihf-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=recipe-sysroot -isystem/home/gtbldadm/tools/gcc-arm-2019.03/arm-linux-gnueabihf/include -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map= -fdebug-prefix-map= -fdebug-prefix-map= -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG -isystem/home/gtbldadm/tools/gcc-arm-2019.03/arm-linux-gnueabihf/include The 'numbers' are in 1000s of bytes per second processed. type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes aes-128-cbc 10487.20k 54018.49k 115618.91k 645181.44k 4277862.40k 9546956.80k
root@am57xx-evm:/# time -v openssl speed -evp aes-128-cbc -engine afalg engine "afalg" set. Doing aes-128-cbc for 3s on 16 size blocks: 160212 aes-128-cbc's in 0.22s Doing aes-128-cbc for 3s on 64 size blocks: 151701 aes-128-cbc's in 0.13s Doing aes-128-cbc for 3s on 256 size blocks: 49034 aes-128-cbc's in 0.08s Doing aes-128-cbc for 3s on 1024 size blocks: 30981 aes-128-cbc's in 0.05s Doing aes-128-cbc for 3s on 8192 size blocks: 10376 aes-128-cbc's in 0.04s Doing aes-128-cbc for 3s on 16384 size blocks: 5813 aes-128-cbc's in 0.01s OpenSSL 1.1.1b 26 Feb 2019 built on: Sun Apr 19 02:06:32 2020 UTC options:bn(64,32) rc4(char) des(long) aes(partial) idea(int) blowfish(ptr) compiler: arm-linux-gnueabihf-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard --sysroot=recipe-sysroot -isystem/home/gtbldadm/tools/gcc-arm-2019.03/arm-linux-gnueabihf/include -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map= -fdebug-prefix-map= -fdebug-prefix-map= -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG -isystem/home/gtbldadm/tools/gcc-arm-2019.03/arm-linux-gnueabihf/include The 'numbers' are in 1000s of bytes per second processed. type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes 16384 bytes aes-128-cbc 11651.78k 74683.57k 156908.80k 634490.88k 2125004.80k 9524019.20k Command being timed: "openssl speed -evp aes-128-cbc -engine afalg" User time (seconds): 0.54 System time (seconds): 8.78 Percent of CPU this job got: 50% Elapsed (wall clock) time (h:mm:ss or m:ss): 0m 18.51s Average shared text size (kbytes): 0 Average unshared data size (kbytes): 0 Average stack size (kbytes): 0 Average total size (kbytes): 0 Maximum resident set size (kbytes): 14624 Average resident set size (kbytes): 0 Major (requiring I/O) page faults: 0 Minor (reclaiming a frame) page faults: 187 Voluntary context switches: 96175 Involuntary context switches: 2622 Swaps: 0 File system inputs: 0 File system outputs: 0 Socket messages sent: 0 Socket messages received: 0 Signals delivered: 0 Page size (bytes): 4096 Exit status: 0
I now have following queries regarding hardware acceleration -
- What is the difference between afalg and cryptodev engine? If afalg is also supported as crypto engine, why it is not mentioned in TI's documentation?
- What are the list of algorithms supported by this engine? How can I verify that this engine is actually using hardware accelarator?
- After enabling this engine in /etc/ssl/openssl.cnf and setting it to default, will openssl use this engine by default? And thereby use hardware crypto accelerator by default?
Kindly revert.
Regards,
Devashish