Skip to content

AMD Phenom II X4 945: aes-128-ctr no-asm faster than default? #9640

Closed

Description

@msalat

no-asm build:

./config no-asm && make -j4
LD_LIBRARY_PATH=. apps/openssl speed -evp aes-128-ctr
OpenSSL 1.1.1c  28 May 2019
built on: Fri Aug 16 20:34:19 2019 UTC
options:bn(64,64) rc4(int) des(int) aes(partial) idea(int) blowfish(ptr) 
compiler: gcc -fPIC -pthread -m64 -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -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-ctr     108246.23k   124655.66k   132020.57k   133663.06k   134567.25k   134610.94k

vs

make clean && ./config && make -j 4
LD_LIBRARY_PATH=. apps/openssl speed -evp aes-128-ctr
OpenSSL 1.1.1c  28 May 2019
built on: Mon Aug 19 19:48:39 2019 UTC
options:bn(64,64) rc4(8x,int) des(int) aes(partial) idea(int) blowfish(ptr) 
compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_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-ctr      75094.91k    83253.10k    86420.82k    87620.15k    87553.37k    87599.79k

PS: Crypto++ 8.2.0 is telling something about 286 MiB/s for AES/CTR (128 Bit)

Activity

  1. added
    issue: bug report
    on Aug 19, 2019
  2. bernd-edlinger commented on Aug 20, 2019

    @bernd-edlinger
    Member

    I think your performance numbers are influenced by building openssl twice,
    that will heat up the core and the frequncey will probably be throttled.
    That might make the second performance measurement look worse.
    I saw a similar effect when I used you work-flow.
    Instead try building the asm and no-asm in different build directories,
    and allow some time to cool down between the tests.

  3. msalat commented on Aug 21, 2019

    @msalat
    Author

    Ok... wrote some perl script which checks (parallel, fork()) cpu MHz from /proc/cpuinfo (the lines with the 4 numbers, expressed as GHz) every 0.2s and sensors cpu temperature every 1s...
    here the output of openssl speed -evp aes-128-ctr compiled with ./config without options:

    $ perl openssl-with-sensors.pl 
    temp1:        +27.5°C  (high = +70.0°C)
    Doing aes-128-ctr for 3s on 16 size blocks: 0.8 0.8 3.0 0.8 
    temp1:        +27.8°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +29.4°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +30.9°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    14022483 aes-128-ctr's in 2.99s
    Doing aes-128-ctr for 3s on 64 size blocks: 0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +32.5°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.0°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.5°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    3896411 aes-128-ctr's in 3.00s
    Doing aes-128-ctr for 3s on 256 size blocks: 0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.8°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.8°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +35.0°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    1013557 aes-128-ctr's in 2.99s
    Doing aes-128-ctr for 3s on 1024 size blocks: 0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.5°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.5°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.8°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    255429 aes-128-ctr's in 3.00s
    Doing aes-128-ctr for 3s on 8192 size blocks: 0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +35.0°C  (high = +70.0°C)
    0.8 0.8 3.0 2.3 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +35.0°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +35.0°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    32071 aes-128-ctr's in 2.99s
    Doing aes-128-ctr for 3s on 16384 size blocks: 0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +35.1°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +35.1°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +35.2°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    16014 aes-128-ctr's in 2.99s
    OpenSSL 1.1.1c  28 May 2019
    built on: Wed Aug 21 18:35:35 2019 UTC
    options:bn(64,64) rc4(8x,int) des(int) aes(partial) idea(int) blowfish(ptr) 
    compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_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-ctr      75036.70k    83123.43k    86779.46k    87186.43k    87868.10k    87750.29k
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    temp1:        +34.9°C  (high = +70.0°C)
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    ...
    

    and now with ./config no-asm:

    temp1:        +27.1°C  (high = +70.0°C)
    Doing aes-128-ctr for 3s on 16 size blocks: 0.8 0.8 3.0 0.8 
    temp1:        +27.2°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +28.8°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +30.4°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    19764208 aes-128-ctr's in 2.99s
    Doing aes-128-ctr for 3s on 64 size blocks: 0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +32.0°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +33.5°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.5°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    5802676 aes-128-ctr's in 2.99s
    Doing aes-128-ctr for 3s on 256 size blocks: 0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.0°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +33.9°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.0°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    1538342 aes-128-ctr's in 2.99s
    Doing aes-128-ctr for 3s on 1024 size blocks: 0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.5°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.6°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.5°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    390305 aes-128-ctr's in 2.99s
    Doing aes-128-ctr for 3s on 8192 size blocks: 0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.5°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.9°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +35.0°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    49020 aes-128-ctr's in 2.99s
    Doing aes-128-ctr for 3s on 16384 size blocks: 0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +34.8°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +35.0°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 1.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    temp1:        +35.0°C  (high = +70.0°C)
    0.8 0.8 3.0 0.8 
    0.8 0.8 3.0 0.8 
    24538 aes-128-ctr's in 2.98s
    OpenSSL 1.1.1c  28 May 2019
    built on: Wed Aug 21 18:34:01 2019 UTC
    options:bn(64,64) rc4(int) des(int) aes(partial) idea(int) blowfish(ptr) 
    compiler: gcc -fPIC -pthread -m64 -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -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-ctr     105761.65k   124204.44k   131710.89k   133669.67k   134304.96k   134909.59k
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    temp1:        +34.9°C  (high = +70.0°C)
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    temp1:        +33.2°C  (high = +70.0°C)
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    temp1:        +31.6°C  (high = +70.0°C)
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    temp1:        +30.1°C  (high = +70.0°C)
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    0.8 0.8 0.8 0.8 
    temp1:        +28.5°C  (high = +70.0°C)
    0.8 0.8 0.8 0.8 
    ^C
    
  4. bernd-edlinger commented on Aug 22, 2019

    @bernd-edlinger
    Member

    Ah, well, so it is not a thermal problem.
    But I still don't know what is wrong.

    I assume you don't have a environment variable OPENSSL_ia32cap,
    if you do please remove that since it can cause sub-optimal performance.

    I own a similar CPU: according to /proc/cpuinfo
    it's a AMD A10-5750M APU with Radeon(tm) HD Graphics
    So when I build current 1.1.1-stable with no-asm I get:

    $ apps/openssl speed -evp aes-128-ctr
    Doing aes-128-ctr for 3s on 16 size blocks: 24445846 aes-128-ctr's in 3.00s
    Doing aes-128-ctr for 3s on 64 size blocks: 7361130 aes-128-ctr's in 2.99s
    Doing aes-128-ctr for 3s on 256 size blocks: 1936758 aes-128-ctr's in 3.00s
    Doing aes-128-ctr for 3s on 1024 size blocks: 491232 aes-128-ctr's in 3.00s
    Doing aes-128-ctr for 3s on 8192 size blocks: 61622 aes-128-ctr's in 3.00s
    Doing aes-128-ctr for 3s on 16384 size blocks: 30889 aes-128-ctr's in 3.00s
    OpenSSL 1.1.1d-dev  xx XXX xxxx
    built on: Wed Aug 21 21:49:38 2019 UTC
    options:bn(64,64) rc4(int) des(int) aes(partial) idea(int) blowfish(ptr) 
    compiler: gcc -pthread -m64 -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -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-ctr     130377.85k   157562.65k   165270.02k   167673.86k   168269.14k   168695.13k
    

    and with asm:

    $ apps/openssl speed -evp aes-128-ctr
    Doing aes-128-ctr for 3s on 16 size blocks: 55324223 aes-128-ctr's in 3.00s
    Doing aes-128-ctr for 3s on 64 size blocks: 39059428 aes-128-ctr's in 2.99s
    Doing aes-128-ctr for 3s on 256 size blocks: 16328388 aes-128-ctr's in 3.00s
    Doing aes-128-ctr for 3s on 1024 size blocks: 5108670 aes-128-ctr's in 3.00s
    Doing aes-128-ctr for 3s on 8192 size blocks: 707156 aes-128-ctr's in 2.99s
    Doing aes-128-ctr for 3s on 16384 size blocks: 355776 aes-128-ctr's in 2.99s
    OpenSSL 1.1.1d-dev  xx XXX xxxx
    built on: Thu Aug 22 08:59:21 2019 UTC
    options:bn(64,64) rc4(8x,int) des(int) aes(partial) idea(int) blowfish(ptr) 
    compiler: gcc -pthread -m64 -Wa,--noexecstack -Wall -O3 -g -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_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-ctr     295062.52k   836054.65k  1393355.78k  1743759.36k  1937465.54k  1949509.69k
    

    Could you please try this patch

    diff --git a/apps/speed.c b/apps/speed.c
    index 2014950..6ee35d8 100644
    --- a/apps/speed.c
    +++ b/apps/speed.c
    @@ -3220,6 +3220,9 @@ int speed_main(int argc, char **argv)
             printf("%s ", BF_options());
     #endif
             printf("\n%s\n", OpenSSL_version(OPENSSL_CFLAGS));
    +extern unsigned int OPENSSL_ia32cap_P[4];
    +        printf("OPENSSL_ia32cap=0x%lx:0x%lx\n", OPENSSL_ia32cap_P[0] | (long)OPENSSL_ia32cap_P[1]<<32,
    +                                               OPENSSL_ia32cap_P[2] | (long)OPENSSL_ia32cap_P[3]<<32);
         }
     
         if (pr_header) {
    

    It need to be built with no-pic because the symbol is in crypto and usually not exported.

    So this prints on my system the following
    OPENSSL_ia32cap=0x3e983a0b078bffff:0x8

    What do you get on your system?

  5. msalat commented on Aug 22, 2019

    @msalat
    Author

    no, there is no openssl-like environment variable (ubuntu 18.04 amd64, nothing special)

    ok, tried to patch

    patch < patch.txt
    can't find file to patch at input line 5
    Perhaps you should have used the -p or --strip option?
    The text leading up to this was:
    --------------------------
    |diff --git a/apps/speed.c b/apps/speed.c
    |index 2014950..6ee35d8 100644
    |--- a/apps/speed.c
    |+++ b/apps/speed.c
    --------------------------
    File to patch: apps/speed.c
    patching file apps/speed.c
    

    then

    ./config -no-pic
    make -j4
    ...
    ${LDCMD:-gcc} -pthread -m64 -Wa,--noexecstack -Wall -O3 -L.   \
    	-o test/cipherlist_test test/cipherlist_test.o \
    	 -lssl test/libtestutil.a -lcrypto -ldl -pthread 
    test/cipher_overhead_test.o: In function `cipher_overhead':
    cipher_overhead_test.c:(.text+0x1f): undefined reference to `ssl3_num_ciphers'
    cipher_overhead_test.c:(.text+0x81): undefined reference to `ssl3_get_cipher'
    cipher_overhead_test.c:(.text+0xa2): undefined reference to `ssl_cipher_get_overhead'
    collect2: error: ld returned 1 exit status
    Makefile:8168: recipe for target 'test/cipher_overhead_test' failed
    make[1]: *** [test/cipher_overhead_test] Error 1
    make[1]: *** Waiting for unfinished jobs....
    make[1]: Leaving directory '/home/jb/workspace/cipher/openssl-1.1.1c'
    Makefile:172: recipe for target 'all' failed
    make: *** [all] Error 2
    

    what I'm doing wrong?

  6. bernd-edlinger commented on Aug 22, 2019

    @bernd-edlinger
    Member

    I guess you need to make distclean first.

  7. bernd-edlinger commented on Aug 22, 2019

    @bernd-edlinger
    Member

    and no "-" in no-pic

  8. msalat commented on Aug 22, 2019

    @msalat
    Author

    ok, did make distclean; there is no ./config nopic, just ./config no-pic

    Output:

    OpenSSL 1.1.1c  28 May 2019
    built on: Thu Aug 22 16:01:04 2019 UTC
    options:bn(64,64) rc4(8x,int) des(int) aes(partial) idea(int) blowfish(ptr) 
    compiler: gcc -pthread -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DAES_ASM -DVPAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_ASM -DPOLY1305_ASM -DNDEBUG
    OPENSSL_ia32cap=0x802009078bffff:0x0
    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-ctr      75451.99k    83436.42k    86713.77k    87465.98k    87739.05k    87758.17k
    
  9. bernd-edlinger commented on Aug 22, 2019

    @bernd-edlinger
    Member

    Your CPU does not support AESNI instructions, bit 0x200000000000000 in the OPENSSL_ia32cap.
    Actually not any hardware acceleration for AES seems to be available, therefore the performance
    is not very good. Apparently the default implementation is using key bits as indexes in the tables
    and is therefore not executing in constant time but neither is the software implementation.

  10. msalat commented on Aug 22, 2019

    @msalat
    Author

    Yes, it's a Phenom II X4... no AESNI. Is "constant time" preferred because side channel attacks? Then my speed comparison with Crypto++ is perhaps unfair... Thanks!

  11. bernd-edlinger commented on Aug 22, 2019

    @bernd-edlinger
    Member

    Yes there is a small side channel due to the non-constant time AESNI is both faster and more secure.
    alternative approaches are possible using bit-slicing, especially for ctr mode, but unfortunately
    the assember module is slower but still not constant time.

  12. bernd-edlinger commented on Aug 23, 2019

    @bernd-edlinger
    Member

    And by the way, thanks for reporting this.
    So this means probably we can drop this specific assembler module.

  13. bernd-edlinger commented on Aug 23, 2019

    @bernd-edlinger
    Member

    Fix in #9675 you can try it, if you want, it should even improve
    on 32bit ./Configure linux-x86

  14. msalat commented on Aug 23, 2019

    @msalat
    Author

    much better:

    $ ./config && make ...
    
    OpenSSL 1.1.1d-dev  xx XXX xxxx
    built on: Fri Aug 23 17:55:46 2019 UTC
    options:bn(64,64) rc4(8x,int) des(int) aes(partial) idea(int) blowfish(ptr) 
    compiler: gcc -fPIC -pthread -m64 -Wa,--noexecstack -Wall -O3 -DOPENSSL_USE_NODELETE -DL_ENDIAN -DOPENSSL_PIC -DOPENSSL_CPUID_OBJ -DOPENSSL_IA32_SSE2 -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_MONT5 -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DKECCAK1600_ASM -DRC4_ASM -DMD5_ASM -DVPAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DX25519_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-ctr     106519.83k   123966.29k   131723.95k   133707.43k   134474.41k   134474.41k
    
  15. added a commit that references this issue on Sep 7, 2019
    87bea65
  16. added
    resolved: fixed
    triaged: bug
    and removed
    issue: bug report
    on Nov 26, 2019
  17. added a commit that references this issue on Mar 28, 2020
    3b55d2b
  18. added a commit that references this issue on Aug 21, 2021
    f5e3f61
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolved: fixedtriaged: bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions