This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SK-AM64: Hardware crypto failures with cryptodev (SA2UL)

Part Number: SK-AM64

Following the tutorial :

https://software-dl.ti.com/processor-sdk-linux/esd/AM64X/latest/exports/docs/linux/Foundational_Components/Kernel/Kernel_Drivers/Crypto.html

I am trying to use the cryptodev device with openssl on TI's pre-built images.

The hwrng device is working fine.

The cryptodev kernel module is installed.

root@am64xx-evm:~# lsmod | grep cryptodev

cryptodev              57344  2

But, Openssl can not use the cryptographic hardware accelerator.

root@am64xx-evm:~# openssl speed -evp aes-128-cbc -engine cryptodev

invalid engine "cryptodev"

The SDK I use is ti-processor-sdk-linux-rt-am64xx-evm-08.02.00.23-Linux-x86-Install.bin

Also, It states that it supports OpenSSL with an SS2UL engine.

Are there any steps I am missing?

Does the version SDK support the feature?

Regards,

Sean

  • Hi Sean,

    The current Processor SDK Linux for AM64x only support RNG hardware accelerator, AES and SHAM hardware accelerators are not supported for user space applications.

  • Hi Sean,

    Sorry for the confusion, AES and SHAM hardware accelerators are actually supported for user space applications.

    root@am64xx-evm:~# openssl speed -evp aes-128-cbc -engine cryptodev

    invalid engine "cryptodev"

    It turns out that the engine name in the command above is not correct, it should be "devcrypto" instead of "cryptodev".

    root@am64xx-evm:~# openssl speed -evp aes-128-cbc -engine devcrypto                                                                                                                                                                                                                                                            
    engine "devcrypto" set.
    Doing aes-128-cbc for 3s on 16 size blocks: 88279 aes-128-cbc's in 0.03s
    Doing aes-128-cbc for 3s on 64 size blocks: 87470 aes-128-cbc's in 0.06s
    Doing aes-128-cbc for 3s on 256 size blocks: 87080 aes-128-cbc's in 0.09s
    Doing aes-128-cbc for 3s on 1024 size blocks: 78354 aes-128-cbc's in 0.07s
    Doing aes-128-cbc for 3s on 8192 size blocks: 46220 aes-128-cbc's in 0.04s
    Doing aes-128-cbc for 3s on 16384 size blocks: 31034 aes-128-cbc's in 0.01s
    OpenSSL 1.1.1l  24 Aug 2021
    built on: Sat Apr  9 19:38:31 2022 UTC
    options:bn(64,64) rc4(char) des(int) aes(partial) idea(int) blowfish(ptr) 
    compiler: aarch64-none-linux-gnu-gcc  --sysroot=recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fmacro-prefix-map=                      -fdebug-prefix-map=                      -fdebug-prefix-map=                      -fdebug-prefix-map=  -DOPENSSL_USE_NODELETE -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_B
    N_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DNDEBUG
    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      47082.13k    93301.33k   247694.22k  1146207.09k  9465856.00k 50846105.60k
    

    You can check the engine name using command:

    root@am64xx-evm:~# openssl engine -t -c
    (devcrypto) /dev/crypto engine
     [DES-CBC, DES-EDE3-CBC, AES-128-CBC, AES-192-CBC, AES-256-CBC, AES-128-CTR, AES-192-CTR, AES-256-CTR, AES-128-ECB, AES-192-ECB, AES-256-ECB, MD5, SHA1, SHA224, SHA256, SHA384, SHA512]
         [ available ]
    (dynamic) Dynamic engine loading support
         [ unavailable ]