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.

AM335x Hardware Crypto Accelerator question

Other Parts Discussed in Thread: AM3352
Hello all,
I am working with Linux on AM3352 chip,
and trying to enable Hardware crypto Acceleration.
After I have done all procedure of following crypto user guide,
when try openssl speed tests including cryptodev,
I can see improve on "AES" speed test, but "MD5" and "SHA" is not.
# MD5
## cryptodev disable
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
md5               3679.20k    14070.46k    41045.79k    80238.37k   109711.91k
        Command being timed: "./apps/openssl speed -evp md5"
        User time (seconds): 14.72
        System time (seconds): 0.09
        Percent of CPU this job got: 98%
 
## cryptodev enable
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
md5               3794.58k    14044.85k    41206.69k    79657.45k   109993.68k
        Command being timed: "./apps/openssl speed -evp md5"
        User time (seconds): 14.75
        System time (seconds): 0.05
        Percent of CPU this job got: 97%
# SHA1
## cryptodev disable
sha1              3403.88k    11610.06k    30515.55k    51650.28k    64844.54k
        Command being timed: "./apps/openssl speed -evp sha1"
        User time (seconds): 14.80
        System time (seconds): 0.03
        Percent of CPU this job got: 98%
## cryptodev enable
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
sha1              3427.62k    11773.82k    30686.30k    51878.05k    64713.99k
        Command being timed: "./apps/openssl speed -evp sha1"
        User time (seconds): 14.77
        System time (seconds): 0.01
        Percent of CPU this job got: 97%
# AES256
## cryptodev disable
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
aes-256-cbc      20365.13k    25080.82k    26202.21k    26563.60k    26680.54k
        Command being timed: "./apps/openssl speed -evp aes-256-cbc"
        User time (seconds): 14.84
        System time (seconds): 0.02
        Percent of CPU this job got: 98%
## cryptodev enable
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
aes-256-cbc      25400.32k    49934.22k   202927.54k  3285401.60k  5858918.40k
        Command being timed: "./apps/openssl speed -evp aes-256-cbc"
        User time (seconds): 0.26
        System time (seconds): 9.33
        Percent of CPU this job got: 63%


I already enabled following drivers on kernel config.
    -*- Cryptographic API  --->
        [*]   Hardware crypto devices  --->
            --- Hardware crypto devices
                <*>   Support for OMAP MD5/SHA1/SHA2 hw accelerator
                <*>   Support for OMAP AES hw engine
                <*>   Support for OMAP DES3DES hw engine
and see following messages on Linux boot.
    [    1.873989] omap-aes 53500000.aes: OMAP AES hw accel rev: 3.2
    [    1.881392] omap-sham 53100000.sham: hw accel on OMAP rev 4.3
Do I need another configuration to make "MD5" and "SHA1" Hardware acceleration work?
I am using Linux kernel based on "ti-linux-kernel.git" Version 3.14.48.
"cryptodev"  source code is get from "AM335xSDK  08_00_00_00".
And, OpenSSL version is "OpenSSL 1.0.1t  3 May 2016", it's already make by self to support
cryptodev accrding to README in cryptodev source code.
 
Best regards,
Yuki
  • I will ask the Crypto experts to comment. They will post directly here.
  • Hi Biser,

    Thanks for your quick response.

    I'm sorry to be pressing, but I'm still waiting for answer.
    Any update on this issue?

    Best regards,
    Yuki
  • I have escalated the request.
  • Please check my test log below with Processor SDK 3.1 prebuilt image, the SHA1 throughput is very close between sw and hw accel. But you can check the interrupt counter of 53100000.sham in /proc/interrupts to ensure hw accel is used.

    root@am335x-evm: cd /sys/devices/system/cpu/cpu0/cpufreq                           
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq# cat scaling_governor         
    ondemand                                                                           
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq# echo userspace > scaling_governor
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq# cat scaling_gucur_freq       
    300000                                                                             
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq# cat scaling_available_frequencies 
    300000 600000 720000 800000                                                        
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq# echo 800000 > scaling_setspeed
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq#                              
                                                                                       
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq# grep sham /proc/interrupts 
    181:     366351      INTC 109 Level     53100000.sham                              
                                                                                       
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq# openssl speed -evp sha1   
    The 'numbers' are in 1000s of bytes per second processed.                          
    type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes   
    sha1               962.22k     3684.90k    22307.45k    51127.24k   641433.60k  
                                                                                       
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq# grep sham /proc/interrupts 
    181:     484932      INTC 109 Level     53100000.sham                              
                                                                                       
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq# modprobe -r omap-sham        
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq#                              
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq# grep sham /proc/interrupts 
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq#                              
                                                                                       
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq# openssl speed -evp sha1   
    The 'numbers' are in 1000s of bytes per second processed.                          
    type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes   
    sha1              1154.08k     4121.90k    18019.66k    65523.95k   571833.11k  
    root@am335x-evm:/sys/devices/system/cpu/cpu0/cpufreq#