Checking that the HW Crypto engine is used on the C2

Post Reply
mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

Hello all,

I'm running some bechmarks on WPA/WPA2 hashing speed on the C1 and C2. I'm using pyrit to crunch the keys. So far the performance I got is this:
  • C1: 300 hashes/s
  • C2: 555 hashes/s
WPA/WPA2 uses TKIP/AES as encryption, but I'm not actually touching the encryption, I'm just trying to calculate a 4096 iteration of sha1sum, so SHA1 needs to be accelerated (and the speeds above are actually for 4096*SHA1s).

Now, the problem is - I doubt that pyrit uses C2's hardware crypto acceleration block to compute the hashes. But I'd like to measure if it is or not.

The kernel is

Code: Select all

Linux bellatrix 3.14.65-66 #1 SMP PREEMPT Sat May 28 06:00:55 BRT 2016 aarch64 aarch64 aarch64 GNU/Linux
The relevant kernel config is:

Code: Select all

adrianp@bellatrix:~/development/dictionaries$ zcat /proc/config.gz | grep -i CRYPT
CONFIG_LIB80211_CRYPT_WEP=m
CONFIG_LIB80211_CRYPT_CCMP=m
CONFIG_LIB80211_CRYPT_TKIP=m
# CONFIG_BLK_DEV_CRYPTOLOOP is not set
CONFIG_DM_CRYPT=m
CONFIG_RT2X00_LIB_CRYPTO=y
CONFIG_RTLLIB_CRYPTO_CCMP=m
CONFIG_RTLLIB_CRYPTO_TKIP=m
CONFIG_RTLLIB_CRYPTO_WEP=m
CONFIG_ECRYPT_FS=m
CONFIG_ECRYPT_FS_MESSAGING=y
# CONFIG_ENCRYPTED_KEYS is not set
CONFIG_CRYPTO=y
# Crypto core or helper
CONFIG_CRYPTO_ALGAPI=y
CONFIG_CRYPTO_ALGAPI2=y
CONFIG_CRYPTO_AEAD=y
CONFIG_CRYPTO_AEAD2=y
CONFIG_CRYPTO_BLKCIPHER=y
CONFIG_CRYPTO_BLKCIPHER2=y
CONFIG_CRYPTO_HASH=y
CONFIG_CRYPTO_HASH2=y
CONFIG_CRYPTO_RNG=y
CONFIG_CRYPTO_RNG2=y
CONFIG_CRYPTO_PCOMP=m
CONFIG_CRYPTO_PCOMP2=y
CONFIG_CRYPTO_MANAGER=y
CONFIG_CRYPTO_MANAGER2=y
CONFIG_CRYPTO_USER=m
CONFIG_CRYPTO_MANAGER_DISABLE_TESTS=y
CONFIG_CRYPTO_GF128MUL=m
# CONFIG_CRYPTO_NULL is not set
# CONFIG_CRYPTO_PCRYPT is not set
CONFIG_CRYPTO_WORKQUEUE=y
# CONFIG_CRYPTO_CRYPTD is not set
CONFIG_CRYPTO_AUTHENC=y
# CONFIG_CRYPTO_CRYPTD is not set
CONFIG_CRYPTO_AUTHENC=y
# CONFIG_CRYPTO_TEST is not set
# Authenticated Encryption with Associated Data
CONFIG_CRYPTO_CCM=y
# CONFIG_CRYPTO_GCM is not set
CONFIG_CRYPTO_SEQIV=y
CONFIG_CRYPTO_CBC=y
CONFIG_CRYPTO_CTR=y
# CONFIG_CRYPTO_CTS is not set
CONFIG_CRYPTO_ECB=y
CONFIG_CRYPTO_LRW=m
CONFIG_CRYPTO_PCBC=y
CONFIG_CRYPTO_XTS=m
CONFIG_CRYPTO_CMAC=m
CONFIG_CRYPTO_HMAC=y
# CONFIG_CRYPTO_XCBC is not set
# CONFIG_CRYPTO_VMAC is not set
CONFIG_CRYPTO_CRC32C=y
# CONFIG_CRYPTO_CRC32 is not set
CONFIG_CRYPTO_CRCT10DIF=y
# CONFIG_CRYPTO_GHASH is not set
CONFIG_CRYPTO_MD4=m
CONFIG_CRYPTO_MD5=y
CONFIG_CRYPTO_MICHAEL_MIC=m
CONFIG_CRYPTO_RMD128=m
CONFIG_CRYPTO_RMD160=m
CONFIG_CRYPTO_RMD256=m
CONFIG_CRYPTO_RMD320=m
CONFIG_CRYPTO_SHA1=y
CONFIG_CRYPTO_SHA256=y
CONFIG_CRYPTO_SHA512=m
CONFIG_CRYPTO_TGR192=m
CONFIG_CRYPTO_WP512=m
CONFIG_CRYPTO_AES=y
CONFIG_CRYPTO_ANUBIS=m
CONFIG_CRYPTO_ARC4=y
CONFIG_CRYPTO_BLOWFISH=m
CONFIG_CRYPTO_BLOWFISH_COMMON=m
CONFIG_CRYPTO_CAMELLIA=m
CONFIG_CRYPTO_CAST_COMMON=m
CONFIG_CRYPTO_CAST5=m
CONFIG_CRYPTO_CAST6=m
CONFIG_CRYPTO_DES=y
CONFIG_CRYPTO_FCRYPT=m
CONFIG_CRYPTO_KHAZAD=m
CONFIG_CRYPTO_SALSA20=m
CONFIG_CRYPTO_SEED=m
CONFIG_CRYPTO_SERPENT=m
CONFIG_CRYPTO_TEA=m
CONFIG_CRYPTO_TWOFISH=m
CONFIG_CRYPTO_TWOFISH_COMMON=m
CONFIG_CRYPTO_DEFLATE=y
CONFIG_CRYPTO_ZLIB=m
CONFIG_CRYPTO_LZO=m
# CONFIG_CRYPTO_LZ4 is not set
# CONFIG_CRYPTO_LZ4HC is not set
CONFIG_CRYPTO_ANSI_CPRNG=m
CONFIG_CRYPTO_USER_API=m
CONFIG_CRYPTO_USER_API_HASH=m
CONFIG_CRYPTO_USER_API_SKCIPHER=m
CONFIG_CRYPTO_HW=y
# CONFIG_ARM64_CRYPTO is not set
It may be that CONFIG_ARM64_CRYPTO is the block that is needed, but I'm not sure.

Anyway, I ran the benchmark and strace to see the kernel calls :

Code: Select all

strace pyrit benchmark
and during the benchmarking phase I get relatively few system calls which look like this:

Code: Select all

Running benchmark (336.0 PMKs/s)... | ) = 39..., 39
gettimeofday({1467104702, 431267}, NULL) = 0
gettimeofday({1467104702, 432821}, NULL) = 0
gettimeofday({1467104702, 432917}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 1000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 434156}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 2000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 436399}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 4000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 440713}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 8000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 449373}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 16000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 465697}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 32000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 498061}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 50000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 548438}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 50000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 601811}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 50000000}, NULL) = 0 (Timeout)
futex(0x893db0, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, NULL, ffffffff) = 0
gettimeofday({1467104702, 657553}, NULL) = 0
gettimeofday({1467104702, 657902}, NULL) = 0
gettimeofday({1467104702, 658013}, NULL) = 0
gettimeofday({1467104702, 658110}, NULL) = 0
Running benchmark (403.2 PMKs/s)... / ) = 39..., 39
gettimeofday({1467104702, 658356}, NULL) = 0
gettimeofday({1467104702, 659903}, NULL) = 0
gettimeofday({1467104702, 660005}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 1000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 661254}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 2000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 663572}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 4000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 667938}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 8000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 676337}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 16000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 692852}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 32000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 725222}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 50000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 775610}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 50000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 826425}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 50000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 877433}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 50000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 927821}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 50000000}, NULL) = 0 (Timeout)
gettimeofday({1467104702, 978201}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 50000000}, NULL) = 0 (Timeout)
gettimeofday({1467104703, 30052}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 50000000}, NULL) = 0 (Timeout)
gettimeofday({1467104703, 80443}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 50000000}, NULL) = 0 (Timeout)
gettimeofday({1467104703, 130823}, NULL) = 0
pselect6(0, NULL, NULL, NULL, {0, 50000000}, NULL^Cstrace: Process 11441 detached

So, based on the output above I'm assuming it's not using the crypto engine.

I'd like to ask if anyone managed to use the crypto engine and if applications such as pyrit or even md5sum need to be rewritten in order to take advantage of it (to make new syscalls and pass data), or if it is handled automagically by the kernel (I don't see how). Also, do you guys know of any way to see what functions a process calls in userspace (to peek inside pyrit - which is written in python)? I guess I need to use a profiler...

Edit: I used a profiler and got the function calls (http://pastebin.com/LFqcVyYP). There are some references to hashlib - https://docs.python.org/2/library/hashlib.html which seems to depend on openssl as a backend. So, I'm guessing openssl should implement the API to the crypto engine, right?

endecotp
Posts: 231
Joined: Sun May 08, 2016 12:30 am
languages_spoken: english
ODROIDs: c2
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by endecotp »

https://lwn.net/Articles/401548/
https://lwn.net/Articles/410763/

I'm not sure what the current status is, but those links might point you in the right direction for more research.

Edit:
https://events.linuxfoundation.org/site ... o-user.pdf

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

Wow! Thank you endecotp. The information is most helpful! I need to do more testing.

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

Edit: Ok, I've looked around a bit on my C2 and it seems that:
1. The kernel doesn't expose /dev/crypto (cryptodev support is not built in)
2. openssl does not use devcrypto as well

Code: Select all

openssl engine
(dynamic) Dynamic engine loading support
I will experiment with enabling devcrypto in kernel and in openssl and let you guys know what performance is like.

Code: Select all

$ openssl speed -evp sha1 
Doing sha1 for 3s on 16 size blocks: 1828950 sha1's in 3.00s
Doing sha1 for 3s on 64 size blocks: 1549657 sha1's in 3.00s
Doing sha1 for 3s on 256 size blocks: 1026352 sha1's in 2.99s
Doing sha1 for 3s on 1024 size blocks: 436346 sha1's in 3.00s
Doing sha1 for 3s on 8192 size blocks: 68581 sha1's in 3.00s
OpenSSL 1.0.2g-fips  1 Mar 2016
built on: reproducible build, date unspecified
options:bn(64,64) rc4(ptr,char) des(idx,cisc,16,int) aes(partial) blowfish(ptr) 
compiler: cc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
sha1              9754.40k    33059.35k    87874.95k   148939.43k   187271.85k

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

I've restarted looking into the cryptodev support on the C2.

So far I've compiled the cryptodev.ko module for the running kernel of the C2 (currently 3.14.65-70). The module loads fine, but compiling a test program lists that hardware acceleration is not working (CONFIG_ARM64_CRYPTO is not set).

Here's how to enable it:

1. Download and prepare your kernel build environment for the C2. Follow the instructions here: https://github.com/umiddelb/armhf/wiki/ ... ARM-device
2. Make a symlink from /lib/modules/`uname -r`/build to your kernel source:

Code: Select all

ln -s /root/linux /lib/modules/`uname -r`/build
3. Set localversion in your kernel to match the existing modules:

Code: Select all

touch .scmversion
make Image
4. Unpack the cryptodev source and compile the module

Code: Select all

$ wget http://download.gna.org/cryptodev-linux/cryptodev-linux-1.8.tar.gz
$ tar zxvf cryptodev-linux-1.8.tar.gz
$ cd cryptodev-linux-1.8/
$ make
$ sudo make install
$ sudo insmod cryptodev.ko
$ gcc -I. -o sha examples/sha.c
$ ./sha                          
Got sha1 with driver sha1-generic
Note: This is not an accelerated cipher
digest: 2f:d4:e1:c6:7a:2d:28:fc:ed:84:9e:e1:bb:76:e7:39:1b:93:eb:12:
I will retry with a new kernel with CONFIG_ARM64_CRYPTO on and report back.

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

In the meantime I also needed to recompile openssl to add cryptodev support. I mostly followed the guide here starting with step 7: https://forum.ubuntu-fr.org/viewtopic.php?id=1540661, but with an added change:
* at step 8 change the line

Code: Select all

MAKE_TEST=make test
to

Code: Select all

MAKE_TEST=/bin/true
in order to disable running selftests (which fail at x509 self-signed ceritificates for some reason). Also skip step 9.

You can build it yourselves, but I've pushed some deb files here for convenience (NOTE: from a security point of view you should never trust my build and you should build your own!): https://github.com/mad-ady/odroid-c2-openssl-cryptodev

Note that running this openssl version might create stability side-effects in your system! (not tested thoroughly yet).

Update: Some preliminary results:

0. Tests without cryptodev, stock openssl, stock kernel:

Code: Select all

$ openssl speed -evp aes-128-cbc
OpenSSL 1.0.2g-fips  1 Mar 2016
built on: reproducible build, date unspecified
options:bn(64,64) rc4(ptr,char) des(idx,cisc,16,int) aes(partial) blowfish(ptr) 
compiler: cc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DSHA1_ASM -DSHA256_ASM -DSHA512_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      45346.01k    51869.69k    53057.16k    53526.53k    54834.34k

$ openssl speed -evp sha1
OpenSSL 1.0.2g-fips  1 Mar 2016
built on: reproducible build, date unspecified
options:bn(64,64) rc4(ptr,char) des(idx,cisc,16,int) aes(partial) blowfish(ptr) 
compiler: cc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
sha1              9789.10k    32556.59k    86593.88k   148590.96k   186900.48k

1. Tests with cryptodev on top of the "stock" kernel (without CONFIG_ARM64_CRYPTO):

Code: Select all

$ openssl speed -evp aes-128-cbc -engine cryptodev
OpenSSL 1.0.2g-fips  1 Mar 2016
built on: reproducible build, date unspecified
options:bn(64,64) rc4(ptr,char) des(idx,cisc,16,int) aes(partial) blowfish(ptr) 
compiler: cc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS -DHASH_MAX_LEN=64 -DL_ENDIAN -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DSHA1_ASM -DSHA256_ASM -DSHA512_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      72341.08k   398893.33k  1010008.18k  3872290.13k         infk

$ openssl speed -evp sha1 -engine cryptodev
OpenSSL 1.0.2g-fips  1 Mar 2016
built on: reproducible build, date unspecified
options:bn(64,64) rc4(ptr,char) des(idx,cisc,16,int) aes(partial) blowfish(ptr) 
compiler: cc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS -DHASH_MAX_LEN=64 -DL_ENDIAN -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
sha1              3861.66k    16090.65k    66448.68k   304023.27k  1611615.72k

2. Tests with cryptodev on top of custom kernel (with CONFIG_ARM64_CRYPTO):

Code: Select all

$  openssl speed -evp aes-128-cbc -engine cryptodev
OpenSSL 1.0.2g-fips  1 Mar 2016
built on: reproducible build, date unspecified
options:bn(64,64) rc4(ptr,char) des(idx,cisc,16,int) aes(partial) blowfish(ptr) 
compiler: cc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS -DHASH_MAX_LEN=64 -DL_ENDIAN -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DSHA1_ASM -DSHA256_ASM -DSHA512_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      59705.66k   183261.87k   932733.44k  2334085.12k         infk

$ openssl speed -evp sha1 -engine cryptodev
OpenSSL 1.0.2g-fips  1 Mar 2016
built on: reproducible build, date unspecified
options:bn(64,64) rc4(ptr,char) des(idx,cisc,16,int) aes(partial) blowfish(ptr) 
compiler: cc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS -DHASH_MAX_LEN=64 -DL_ENDIAN -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
sha1              3666.63k    17152.91k    59140.72k   286579.20k  1661586.92k
$ zcat /proc/config.gz | grep ARM64
CONFIG_ARM64=y
CONFIG_ARM64_HAS_SG_CHAIN=y
# CONFIG_ARM64_ERRATUM_845719 is not set
# CONFIG_ARM64_64K_PAGES is not set
# CONFIG_BUILD_ARM64_APPENDED_DTB_IMAGE is not set
CONFIG_ARM64_CPU_SUSPEND=y
CONFIG_ARM64_ERRATUM_843419=y
CONFIG_ARM64_CRYPTO=y
CONFIG_CRYPTO_SHA1_ARM64_CE=m
CONFIG_CRYPTO_SHA2_ARM64_CE=m
CONFIG_CRYPTO_GHASH_ARM64_CE=m
CONFIG_CRYPTO_AES_ARM64_CE=m
CONFIG_CRYPTO_AES_ARM64_CE_CCM=m
CONFIG_CRYPTO_AES_ARM64_CE_BLK=m
CONFIG_CRYPTO_AES_ARM64_NEON_BLK=m

As far as I can see, for instance, aes-128-cbc reaches 3.8Gbps compared to 53Mbps when using cryptodev api! I'm not sure though if the results are correct or not... Will need to double-check. For small block sizes it seems that the blockdev is slower (e.g. sha1 with 16 bytes) - maybe because of costs of pushing data to the special processor...

The ARM64 crypto-engine seems to perform worse, but the cryptodev test still complains that it is using a generic encoder:

Code: Select all

root@odroid64:~/cryptodev-linux-1.8# ./sha 
Got sha1 with driver sha1-generic
Note: This is not an accelerated cipher
digest: 2f:d4:e1:c6:7a:2d:28:fc:ed:84:9e:e1:bb:76:e7:39:1b:93:eb:12:
Also, the kernel is not loading the new modules automatically - most likely some tuning is necessary to properly test with ARM64 support.

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

Nice work and thank you, im going to give this a try now

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

Glad you're joining in the efforts :)

I'm guessing we need to look into the sha.c example that comes with cryptodev and see how to identify the crypto functions exported by the kernel. So far it only sees the generic ones.

As far as I can see from the kernel modules after enabling the other ARM64 crypto modules I get only these two modules:

Code: Select all

ablk_helper.ko
cryptd.ko

hephooey
Posts: 54
Joined: Tue Mar 22, 2016 4:19 am
languages_spoken: english
ODROIDs: C1+, C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by hephooey »

I think the hardware crypto engine is not the one provided by the optional arm64 features. It is something special to amlogic, there is actually a crypto driver in the official amlogic kernel under drivers/amlogic/crypto. I do not know why it is not in the HK kernel. Does C2 really have these features?

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

I have no drivers/amlogic/crypto directory in my git clone:

Code: Select all

root@odroid64:~/linux# ls drivers/amlogic/crypto
ls: cannot access 'drivers/amlogic/crypto': No such file or directory
Also, I can't find anything amlogic specific when searching for CRYPTO in make menuconfig.

I'm now trying to build the kernel with the ARM64 crypto optimizations built-in (instead of modules). I'm not sure if the crypto engine referenced in the S905 datasheet is a "generic" ARMv8 engine, or if it is something that Amlogic put in. It could be the Amlogic specific, but this means that we can try both approaches (CPU optimizations and special engine).

hephooey
Posts: 54
Joined: Tue Mar 22, 2016 4:19 am
languages_spoken: english
ODROIDs: C1+, C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by hephooey »

I know, you can only find the crypto module in the official amlogic kernel, the latest one I can find is here http://openlinux.amlogic.com:8000/downl ... 1cd.tar.gz. I tried to copy the code and after some modification it seems working, and I got things like aml-hmac-sha256 in /proc/crypto. But when I tried to use it through cryptodev it just stalled forever, sometimes I got an internel error from the kernel sometimes there is just nothing. So this makes me wonder if C2 really support this. Of course it could be something wrong with the kernel or cryptodev.

I am pretty sure the arm64 chip does not support crypto extension, it is checked by kernel in here https://github.com/hardkernel/linux/blo ... #L260-L284. If it support the crypto features it will show up in /proc/cpuinfo.

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

Hmm, interesting... In this case how do you explain the performance I got with openssl+cryptodev? Is it only due to keeping things in kernel/memory alignment/different gcc or optimizations compared to the ubuntu openssl package, or are the readings I got wrong?

hephooey
Posts: 54
Joined: Tue Mar 22, 2016 4:19 am
languages_spoken: english
ODROIDs: C1+, C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by hephooey »

I do not know the answer. My guess is the kernel version is optimized, probably with neon or whatever its arm64 equivalence. In case you are interested, here is the patch to add the amlogic crypto model: http://pastebin.com/vs54UPn6. Maybe it is actually working, and I just do not know how to use it :(

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

I will try your patch hephooey, thanks. I tried with the ARM64 crypto drivers built into the kernel and I saw no significant difference in openssl speed. However the openssl speed test doesn't seem too relevant. Two consecutive tests can generate wildly varying results - e.g. from 2Gbps to 5Gbps throughput. Most likely too few hashes are processed and the time is too slow.

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

Quick update.

I compiled the kernel with your aml crypto patch. Now, good news and bad news. The kernel compiles fine and runs. I recompiled the cryptodev support for this kernel and loaded the cryptodev module. I then ran the sha example (supplied with cryptodev). It now detects the "aml-sha1" driver, but says it's not accelerated (no biggie I think). However, the sha example gets stuck with a ioctl call that never gets answered. Here is a strace:

Code: Select all

root@odroid64:~/cryptodev-linux-1.8# modinfo cryptodev.ko
filename:       /root/cryptodev-linux-1.8/cryptodev.ko
license:        GPL
description:    CryptoDev driver
author:         Nikos Mavrogiannopoulos <nmav@gnutls.org>
depends:        
vermagic:       3.14.65-crypto3 SMP preempt mod_unload aarch64
parm:           cryptodev_verbosity:0: normal, 1: verbose, 2: debug (int)
root@odroid64:~/cryptodev-linux-1.8# insmod cryptodev.ko
root@odroid64:~/cryptodev-linux-1.8# lsmod | grep cryptodev
cryptodev              41084  1
root@odroid64:~/cryptodev-linux-1.8# strace ./sha

c^Acexecve("./sha", ["./sha"], [/* 51 vars */]) = 0
brk(NULL)                               = 0x413000
faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb487b000
faccessat(AT_FDCWD, "/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=99892, ...}) = 0
mmap(NULL, 99892, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb483a000
close(3)                                = 0
faccessat(AT_FDCWD, "/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
openat(AT_FDCWD, "/lib/aarch64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0\267\0\1\0\0\0\350\371\1\0\0\0\0\0"..., 832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1261896, ...}) = 0
mmap(NULL, 1331944, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb46f4000
mprotect(0x7fb4821000, 61440, PROT_NONE) = 0
mmap(0x7fb4830000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x12c000) = 0x7fb4830000
mmap(0x7fb4836000, 13032, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb4836000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb487a000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb4879000
mprotect(0x7fb4830000, 16384, PROT_READ) = 0
mprotect(0x411000, 4096, PROT_READ)     = 0
mprotect(0x7fb487f000, 4096, PROT_READ) = 0
munmap(0x7fb483a000, 99892)             = 0
openat(AT_FDCWD, "/dev/crypto", O_RDWR) = 3
fcntl(3, F_SETFD, FD_CLOEXEC)           = 0
ioctl(3, _IOC(_IOC_READ|_IOC_WRITE, 0x63, 0x66, 0x30), 0x7fe56f9be0) = 0
ioctl(3, _IOC(_IOC_READ|_IOC_WRITE, 0x63, 0x6b, 0x10c), 0x7fe56f9aa8) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 10), ...}) = 0
brk(NULL)                               = 0x413000
brk(0x434000)                           = 0x434000
write(1, "Got sha1 with driver aml-sha1\n", 30Got sha1 with driver aml-sha1
) = 30
write(1, "Note: This is not an accelerated"..., 40Note: This is not an accelerated cipher
) = 40
ioctl(3, _IOC(_IOC_READ|_IOC_WRITE, 0x63, 0x68, 0x30)

There is nothing in dmesg, although I've seen that your patch has an option for debugging (which I think was not enabled in my case). It would be interesting to see how debugging goes. Also the openssl speed tests lock up as well. There might be an API incompatibility or some mismatch of the data being passed to those functions...

LiquidAcid
Posts: 1094
Joined: Fri Oct 11, 2013 11:07 pm
languages_spoken: english
ODROIDs: X2
Has thanked: 0
Been thanked: 2 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by LiquidAcid »

Make to sure to enable hung task detection in the kernel and maybe also decrease the timeout value to get more prompt feedback.

hephooey
Posts: 54
Joined: Tue Mar 22, 2016 4:19 am
languages_spoken: english
ODROIDs: C1+, C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by hephooey »

mad_ady wrote:Quick update.

I compiled the kernel with your aml crypto patch. Now, good news and bad news. The kernel compiles fine and runs. I recompiled the cryptodev support for this kernel and loaded the cryptodev module. I then ran the sha example (supplied with cryptodev). It now detects the "aml-sha1" driver, but says it's not accelerated (no biggie I think). However, the sha example gets stuck with a ioctl call that never gets answered. Here is a strace:

There is nothing in dmesg, although I've seen that your patch has an option for debugging (which I think was not enabled in my case). It would be interesting to see how debugging goes. Also the openssl speed tests lock up as well. There might be an API incompatibility or some mismatch of the data being passed to those functions...
That is pretty much where I got stuck now. I tried to compare the code and the datasheet (page. 93), does not see anything obviously wrong. As you mentioned there are so many things could be the cause. And debuging kernel is not fun at all...

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

Been playing around and now have cryptodev working. Arm64 extensions are visable in /proc/crypto and I have a /dev/crypto from using the instructions from mad_ady.

In regards to openssl I had trouble with the Ubuntu version of openssl (which is fips enabled) so I downloaded and used latest dev version from openssl which is not tailored for ubuntu specifics.

I used following custom config command..

Code: Select all

./Configure linux-aarch64 -DHAVE_CRYPTODEV -DUSE_CRYPTDEV_DIGESTS -march=armv8-a+crypto+crc+fp+simd -mtune=cortex-a53
then made and installed..

Code: Select all

make -j4
sudo make install
I had it fail on the installation as it could not install man pages but works ok.

Firstly initial "openssl speed" test using standard ubuntu binary supplied version of openssl with no support compiled for crytpodev ...

Code: Select all

OpenSSL 1.0.2g-fips  1 Mar 2016
built on: reproducible build, date unspecified
options:bn(64,64) rc4(ptr,char) des(idx,cisc,16,int) aes(partial) blowfish(ptr) 
compiler: cc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -DL_ENDIAN -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -Wl,-Bsymbolic-functions -Wl,-z,relro -Wa,--noexecstack -Wall -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes
md2                  0.00         0.00         0.00         0.00         0.00 
mdc2                 0.00         0.00         0.00         0.00         0.00 
md4              10741.23k    38063.70k   115852.46k   235607.43k   338893.82k
md5               8327.95k    27934.33k    76676.24k   135998.05k   177123.52k
hmac(md5)         9786.78k    32336.42k    85230.45k   144339.24k   181037.77k
sha1              9433.81k    31260.90k    82968.92k   141899.27k   180489.83k
rmd160            8035.55k    24448.53k    57706.47k    87626.26k   104287.96k
rc4             101153.36k   106423.80k   107345.55k   108066.59k   108291.73k
des cbc          25430.91k    26781.61k    27232.13k    27341.14k    27437.77k
des ede3          9264.79k     9461.79k     9522.86k     9546.94k     9564.57k
idea cbc             0.00         0.00         0.00         0.00         0.00 
seed cbc         24779.45k    25800.58k    25976.37k    26155.74k    26116.75k
rc2 cbc          19601.48k    20647.08k    20887.57k    20976.06k    20998.10k
rc5-32/12 cbc        0.00         0.00         0.00         0.00         0.00 
blowfish cbc     44453.48k    49071.03k    50376.22k    50802.95k    50874.49k
cast cbc         32544.10k    34855.84k    35639.78k    35840.00k    35898.32k
aes-128 cbc      49257.75k    52981.43k    54376.69k    54734.83k    54889.11k
aes-192 cbc      43739.70k    46672.15k    47754.17k    48034.08k    48164.62k
aes-256 cbc      39265.61k    41059.98k    41913.22k    42127.77k    42278.32k
camellia-128 cbc    45234.34k    48411.99k    49523.45k    49772.50k    49756.91k
camellia-192 cbc    35893.75k    37871.81k    38555.55k    38661.76k    38713.98k
camellia-256 cbc    35845.86k    37890.53k    38480.53k    38713.30k    38659.73k
sha256           12577.58k    33091.45k    65956.79k    87943.63k    97620.43k
sha512            8949.99k    35851.27k    74357.32k   121833.96k   150277.09k
whirlpool         4970.46k    10693.00k    17795.39k    21404.65k    22886.06k
aes-128 ige      47118.95k    51916.74k    53592.24k    54041.77k    54162.46k
aes-192 ige      42301.78k    46068.22k    47447.82k    47764.51k    47860.81k
aes-256 ige      38233.54k    41344.66k    42356.05k    42506.17k    42774.72k
ghash            61733.31k    68044.40k    70293.02k    70831.98k    71045.26k
                  sign    verify    sign/s verify/s
rsa  512 bits 0.000522s 0.000039s   1917.4  25744.1
rsa 1024 bits 0.002223s 0.000107s    449.8   9374.2
rsa 2048 bits 0.012992s 0.000340s     77.0   2945.5
rsa 4096 bits 0.085897s 0.001204s     11.6    830.5
                  sign    verify    sign/s verify/s
dsa  512 bits 0.000430s 0.000462s   2324.2   2162.2
dsa 1024 bits 0.001139s 0.001321s    877.6    756.7
dsa 2048 bits 0.003653s 0.004165s    273.8    240.1
                              sign    verify    sign/s verify/s
 160 bit ecdsa (secp160r1)   0.0005s   0.0019s   1929.2    536.1
 192 bit ecdsa (nistp192)   0.0005s   0.0018s   1851.5    553.5
 224 bit ecdsa (nistp224)   0.0008s   0.0026s   1272.9    385.5
 256 bit ecdsa (nistp256)   0.0007s   0.0027s   1347.4    377.3
 384 bit ecdsa (nistp384)   0.0016s   0.0053s    626.4    187.1
 521 bit ecdsa (nistp521)   0.0032s   0.0110s    315.7     90.7
 163 bit ecdsa (nistk163)   0.0010s   0.0038s    996.0    260.0
 233 bit ecdsa (nistk233)   0.0018s   0.0054s    560.0    186.6
 283 bit ecdsa (nistk283)   0.0029s   0.0115s    342.9     86.8
 409 bit ecdsa (nistk409)   0.0071s   0.0247s    141.7     40.5
 571 bit ecdsa (nistk571)   0.0160s   0.0540s     62.6     18.5
 163 bit ecdsa (nistb163)   0.0009s   0.0040s   1105.9    253.1
 233 bit ecdsa (nistb233)   0.0017s   0.0056s    578.1    177.4
 283 bit ecdsa (nistb283)   0.0029s   0.0125s    349.2     79.9
 409 bit ecdsa (nistb409)   0.0070s   0.0279s    142.0     35.8
 571 bit ecdsa (nistb571)   0.0158s   0.0607s     63.1     16.5
                              op      op/s
 160 bit ecdh (secp160r1)   0.0014s    715.3
 192 bit ecdh (nistp192)   0.0014s    716.0
 224 bit ecdh (nistp224)   0.0019s    514.5
 256 bit ecdh (nistp256)   0.0021s    474.0
 384 bit ecdh (nistp384)   0.0043s    231.5
 521 bit ecdh (nistp521)   0.0082s    122.0
 163 bit ecdh (nistk163)   0.0019s    521.1
 233 bit ecdh (nistk233)   0.0026s    384.3
 283 bit ecdh (nistk283)   0.0057s    175.1
 409 bit ecdh (nistk409)   0.0124s     81.0
 571 bit ecdh (nistk571)   0.0268s     37.3
 163 bit ecdh (nistb163)   0.0020s    505.5
 233 bit ecdh (nistb233)   0.0028s    362.4
 283 bit ecdh (nistb283)   0.0062s    161.4
 409 bit ecdh (nistb409)   0.0138s     72.5
 571 bit ecdh (nistb571)   0.0310s     32.3
Next latest version of openssl development from git, with cryptodev support compiled in and also machine specific for
-march=armv8-a+crypto+crc+fp+simd -mtune=cortex-a53

I want to change compiler options to support lse as well "-march=armv8-a+crypto+crc+fp+simd+lse" to test

I seem to have some large improvements in some areas and are not sure if this is hardware support as yet...

Code: Select all

OpenSSL 1.1.0-pre6-dev  xx XXX xxxx
built on: reproducible build, date unspecified
options:bn(64,64) rc4(char) des(int) aes(partial) idea(int) blowfish(ptr) 
compiler: gcc -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DVPAES_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DHAVE_CRYPTODEV -DUSE_CRYPTDEV_DIGESTS -DOPENSSLDIR="\"/usr/local/ssl\"" -DENGINESDIR="\"/usr/local/lib/engines-1.1\""  -march=armv8-a+crypto+crc+fp+simd -mtune=cortex-a53
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
md2                  0.00         0.00         0.00         0.00         0.00         0.00 
mdc2              3886.89k     4685.08k     4914.69k     4909.45k     5009.83k     5034.16k
md4              12894.27k    45875.24k   133855.28k   255002.45k   348976.49k   359118.83k
md5              29704.84k    73064.20k   136745.45k   174662.53k   190944.36k   191883.31k
hmac(md5)        10444.93k    34497.14k    89454.88k   148720.40k   184705.19k   188264.10k
sha1             28484.16k    70826.98k   134519.61k   173480.86k   189604.11k   190992.95k
rmd160            8733.39k    26466.35k    61084.57k    90295.10k   104344.92k   108166.95k
rc4              73928.06k    79475.43k    80851.16k    81385.96k    81572.79k    81518.54k
des cbc          24994.79k    26596.51k    27096.41k    27224.84k    27323.85k    27294.01k
des ede3          9228.64k     9422.35k     9019.68k     9091.22k     9559.14k     9553.72k
idea cbc         27885.09k    30187.46k    30843.42k    31014.99k    31145.88k    31124.17k
seed cbc         24385.32k    24969.64k    25096.99k    25846.51k    25918.73k    25991.23k
rc2 cbc          20335.92k    21507.65k    21920.97k    21901.73k    22153.66k    22015.32k
rc5-32/12 cbc        0.00         0.00         0.00         0.00         0.00         0.00 
blowfish cbc     47617.38k    54969.35k    57585.50k    58342.57k    58580.94k    58336.81k
cast cbc         31620.65k    34402.61k    35285.62k    35510.08k    35646.05k    35637.91k
aes-128 cbc      49477.03k    53447.67k    54971.59k    55364.83k    55518.43k    55217.34k
aes-192 cbc      43844.21k    46510.96k    47500.38k    48516.24k    48639.32k    48430.45k
aes-256 cbc      39448.01k    41314.78k    42832.53k    42705.55k    43094.80k    41529.64k
camellia-128 cbc    43841.50k    47162.07k    48336.02k    48641.36k    48704.42k    48560.66k
camellia-192 cbc    34089.83k    36756.37k    37680.83k    37874.10k    37997.86k    37851.38k
camellia-256 cbc    34877.96k    36941.05k    37674.64k    37867.32k    37981.58k    37856.81k
sha256           18395.30k    41844.28k    72126.39k    91372.67k    98510.16k    99199.15k
sha512           14752.15k    58893.37k    92590.28k   132279.10k   151145.11k   151421.80k
whirlpool         5162.69k    11157.79k    18263.65k    21837.65k    23189.87k    23360.76k
aes-128 ige      46868.67k    52238.11k    53937.76k    54375.08k    54354.73k    54012.95k
aes-192 ige      42241.98k    46117.23k    47398.40k    47745.53k    47727.89k    47475.62k
aes-256 ige      38253.38k    41291.55k    42310.87k    42503.46k    42508.88k    42332.57k
ghash            62026.12k    67893.15k    70057.88k    69807.98k    70771.28k    70657.36k
                  sign    verify    sign/s verify/s
rsa  512 bits 0.000254s 0.000022s   3930.6  46094.5
rsa 1024 bits 0.001131s 0.000059s    883.8  16842.0
rsa 2048 bits 0.007214s 0.000196s    138.6   5105.7
rsa 3072 bits 0.021826s 0.000417s     45.8   2396.6
rsa 4096 bits 0.048738s 0.000745s     20.5   1342.8
rsa 7680 bits 0.381852s 0.002518s      2.6    397.1
rsa 15360 bits 2.278000s 0.009738s      0.4    102.7
                  sign    verify    sign/s verify/s
dsa  512 bits 0.000333s 0.000255s   3004.8   3926.4
dsa 1024 bits 0.000701s 0.000714s   1427.5   1400.6
dsa 2048 bits 0.002208s 0.002369s    452.9    422.1
                              sign    verify    sign/s verify/s
 160 bit ecdsa (secp160r1)   0.0003s   0.0011s   3429.7    943.1
 192 bit ecdsa (nistp192)   0.0003s   0.0013s   2951.0    787.9
 224 bit ecdsa (nistp224)   0.0004s   0.0017s   2253.8    590.5
 256 bit ecdsa (nistp256)   0.0003s   0.0005s   3627.8   1883.3
 384 bit ecdsa (nistp384)   0.0011s   0.0044s    891.9    229.5
 521 bit ecdsa (nistp521)   0.0025s   0.0099s    402.8    100.8
 163 bit ecdsa (nistk163)   0.0010s   0.0038s    994.9    260.0
 233 bit ecdsa (nistk233)   0.0019s   0.0053s    535.4    188.5
 283 bit ecdsa (nistk283)   0.0031s   0.0107s    323.4     93.2
 409 bit ecdsa (nistk409)   0.0072s   0.0220s    138.0     45.4
 571 bit ecdsa (nistk571)   0.0158s   0.0467s     63.2     21.4
 163 bit ecdsa (nistb163)   0.0010s   0.0041s    997.7    246.1
 233 bit ecdsa (nistb233)   0.0019s   0.0056s    539.0    178.9
 283 bit ecdsa (nistb283)   0.0031s   0.0116s    322.2     86.5
 409 bit ecdsa (nistb409)   0.0073s   0.0242s    137.7     41.3
 571 bit ecdsa (nistb571)   0.0158s   0.0520s     63.2     19.2
                              op      op/s
 160 bit ecdh (secp160r1)   0.0009s   1131.4
 192 bit ecdh (nistp192)   0.0011s    926.5
 224 bit ecdh (nistp224)   0.0013s    742.4
 256 bit ecdh (nistp256)   0.0004s   2835.1
 384 bit ecdh (nistp384)   0.0037s    271.4
 521 bit ecdh (nistp521)   0.0081s    123.1
 163 bit ecdh (nistk163)   0.0019s    531.9
 233 bit ecdh (nistk233)   0.0026s    387.3
 283 bit ecdh (nistk283)   0.0052s    191.6
 409 bit ecdh (nistk409)   0.0109s     91.4
 571 bit ecdh (nistk571)   0.0232s     43.0
 163 bit ecdh (nistb163)   0.0019s    520.2
 233 bit ecdh (nistb233)   0.0028s    362.9
 283 bit ecdh (nistb283)   0.0057s    175.4
 409 bit ecdh (nistb409)   0.0120s     83.0
 571 bit ecdh (nistb571)   0.0257s     38.9
 253 bit ecdh (X25519)   0.0003s   2905.2
There are some interesting results, new version performs better in many instances using smaller byte sizes and signing / verifying is almost twice as quick. In some other cases performance is slightly worse. I am going to try and change some more compiler flags to see what results I get.

What are peoples thoughts?

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

It's great that you are using optimized compiler flags. That should make a difference even if it's not using the built-in crypto engine.

In terms of speed comparison - I doubt openssl speed is good enough, because it doesn't run long enough to get reproductible results (a test takes ~3s in which time the CPU might be busy with something else). I think we should generate a test file (500MB) that we encrypt with AES with openssl and measure the time.

Also from your tests it's not evident if you are actually using cryptodev. Do you specify -engine manually?

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

mad_ady wrote:Also from your tests it's not evident if you are actually using cryptodev. Do you specify -engine manually?
Hi no I havent been specifying which engine openssl should use but I can see cryptodev is avaliable and it has been compiled with HAVE_CRYPTODEV and DIGESTS.

Here is the output of ...

Code: Select all

odroid@odroid64:~/openssl$ openssl engine -t
(cryptodev) BSD cryptodev engine
     [ available ]
(dynamic) Dynamic engine loading support
     [ unavailable ]
I will look further into the engine config to see what is happening. There are a few more things I would like to try also..

- compile the amlogic crypto drivers to see if any improvements can be made using these.
- compile cryptodev into 4.7 kernel to see if later kernel performs any different

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

As far as I've seen cryptodev is not used unless you call openssl -engine cryptodev speciffically or have cryptodev bound to the algorithms you want in openssl's config. I'm guessing that part of the speedup you see comes from optimized compiler flags

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

mad_ady wrote:As far as I've seen cryptodev is not used unless you call openssl -engine cryptodev speciffically or have cryptodev bound to the algorithms you want in openssl's config.
I was under the impression that openssl will use cryptodev if it sees it, tried the benchmarks again using -engine cryptodev and the same results.

I can also confirm cryptodev is at least being looked at by openssl as when I raise the debug of crypto dev it reports the following...

Code: Select all

Jul 17 17:13:12 odroid64 kernel: [ 9399.890885] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc05a59ac00
Jul 17 17:13:12 odroid64 kernel: [ 9399.890899] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc05a467a00
Jul 17 17:13:12 odroid64 kernel: [ 9399.890904] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc05a88b300
Jul 17 17:13:12 odroid64 kernel: [ 9399.890909] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc05a90c000
Jul 17 17:13:12 odroid64 kernel: [ 9399.890913] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc05a90c600
Jul 17 17:13:12 odroid64 kernel: [ 9399.890917] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc05a90cc00
Jul 17 17:13:12 odroid64 kernel: [ 9399.890921] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc05a90ce00
Jul 17 17:13:12 odroid64 kernel: [ 9399.890926] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc059df4600
Jul 17 17:13:12 odroid64 kernel: [ 9399.890930] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc059df4c00
Jul 17 17:13:12 odroid64 kernel: [ 9399.890934] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc059df4500
Jul 17 17:13:12 odroid64 kernel: [ 9399.890939] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc05bf03500
Jul 17 17:13:12 odroid64 kernel: [ 9399.890943] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc05bf03c00
Jul 17 17:13:12 odroid64 kernel: [ 9399.890947] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc059d30000
Jul 17 17:13:12 odroid64 kernel: [ 9399.890952] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc05bd9dc00
Jul 17 17:13:12 odroid64 kernel: [ 9399.890956] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc05bd9d600
Jul 17 17:13:12 odroid64 kernel: [ 9399.890960] cryptodev: openssl[8424] (cryptodev_open:480): allocated new item at ffffffc05bd9de00
Jul 17 17:13:12 odroid64 kernel: [ 9399.890964] cryptodev: openssl[8424] (cryptodev_open:485): Cryptodev handle initialised, 16 elements in queue
Jul 17 17:13:12 odroid64 kernel: [ 9399.893115] cryptodev: openssl[8424] (crypto_create_session:167): bad cipher: 12
Jul 17 17:13:12 odroid64 kernel: [ 9399.893166] cryptodev: openssl[8424] (crypto_create_session:284): got alignmask 3
Jul 17 17:13:12 odroid64 kernel: [ 9399.893170] cryptodev: openssl[8424] (crypto_create_session:287): preallocating for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.893192] cryptodev: openssl[8424] (crypto_destroy_session:341): Removed session 0x4117078F
Jul 17 17:13:12 odroid64 kernel: [ 9399.893201] cryptodev: openssl[8424] (crypto_destroy_session:344): freeing space for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.893220] cryptodev: openssl[8424] (crypto_create_session:284): got alignmask 3
Jul 17 17:13:12 odroid64 kernel: [ 9399.893224] cryptodev: openssl[8424] (crypto_create_session:287): preallocating for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.893237] cryptodev: openssl[8424] (crypto_destroy_session:341): Removed session 0x865F7CAB
Jul 17 17:13:12 odroid64 kernel: [ 9399.893242] cryptodev: openssl[8424] (crypto_destroy_session:344): freeing space for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.893262] cryptodev: openssl[8424] (crypto_create_session:284): got alignmask 7
Jul 17 17:13:12 odroid64 kernel: [ 9399.893266] cryptodev: openssl[8424] (crypto_create_session:287): preallocating for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.893275] cryptodev: openssl[8424] (crypto_destroy_session:341): Removed session 0xBD9CE6AF
Jul 17 17:13:12 odroid64 kernel: [ 9399.893282] cryptodev: openssl[8424] (crypto_destroy_session:344): freeing space for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.893294] cryptodev: openssl[8424] (crypto_create_session:284): got alignmask 7
Jul 17 17:13:12 odroid64 kernel: [ 9399.893298] cryptodev: openssl[8424] (crypto_create_session:287): preallocating for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.893306] cryptodev: openssl[8424] (crypto_destroy_session:341): Removed session 0x2793EBD8
Jul 17 17:13:12 odroid64 kernel: [ 9399.893312] cryptodev: openssl[8424] (crypto_destroy_session:344): freeing space for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.893325] cryptodev: openssl[8424] (crypto_create_session:284): got alignmask 7
Jul 17 17:13:12 odroid64 kernel: [ 9399.893329] cryptodev: openssl[8424] (crypto_create_session:287): preallocating for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.893336] cryptodev: openssl[8424] (crypto_destroy_session:341): Removed session 0x4BDCAAFB
Jul 17 17:13:12 odroid64 kernel: [ 9399.893342] cryptodev: openssl[8424] (crypto_destroy_session:344): freeing space for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.893438] cryptodev: openssl[8424] (crypto_create_session:284): got alignmask 3
Jul 17 17:13:12 odroid64 kernel: [ 9399.893442] cryptodev: openssl[8424] (crypto_create_session:287): preallocating for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.893450] cryptodev: openssl[8424] (crypto_destroy_session:341): Removed session 0x2BED74EA
Jul 17 17:13:12 odroid64 kernel: [ 9399.893458] cryptodev: openssl[8424] (crypto_destroy_session:344): freeing space for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.893462] cryptodev: openssl[8424] (crypto_create_session:167): bad cipher: 4
Jul 17 17:13:12 odroid64 kernel: [ 9399.894171] cryptodev: openssl[8424] (crypto_create_session:167): bad cipher: 12
Jul 17 17:13:12 odroid64 kernel: [ 9399.894187] cryptodev: openssl[8424] (crypto_create_session:284): got alignmask 3
Jul 17 17:13:12 odroid64 kernel: [ 9399.894191] cryptodev: openssl[8424] (crypto_create_session:287): preallocating for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.894202] cryptodev: openssl[8424] (crypto_destroy_session:341): Removed session 0xE725926F
Jul 17 17:13:12 odroid64 kernel: [ 9399.894208] cryptodev: openssl[8424] (crypto_destroy_session:344): freeing space for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.894220] cryptodev: openssl[8424] (crypto_create_session:284): got alignmask 3
Jul 17 17:13:12 odroid64 kernel: [ 9399.894224] cryptodev: openssl[8424] (crypto_create_session:287): preallocating for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.894236] cryptodev: openssl[8424] (crypto_destroy_session:341): Removed session 0xF10A1F3B
Jul 17 17:13:12 odroid64 kernel: [ 9399.894241] cryptodev: openssl[8424] (crypto_destroy_session:344): freeing space for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.894254] cryptodev: openssl[8424] (crypto_create_session:284): got alignmask 7
Jul 17 17:13:12 odroid64 kernel: [ 9399.894258] cryptodev: openssl[8424] (crypto_create_session:287): preallocating for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.894266] cryptodev: openssl[8424] (crypto_destroy_session:341): Removed session 0xAFC4FB57
Jul 17 17:13:12 odroid64 kernel: [ 9399.894271] cryptodev: openssl[8424] (crypto_destroy_session:344): freeing space for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.894283] cryptodev: openssl[8424] (crypto_create_session:284): got alignmask 7
Jul 17 17:13:12 odroid64 kernel: [ 9399.894287] cryptodev: openssl[8424] (crypto_create_session:287): preallocating for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.894295] cryptodev: openssl[8424] (crypto_destroy_session:341): Removed session 0x1C7F740A
Jul 17 17:13:12 odroid64 kernel: [ 9399.894301] cryptodev: openssl[8424] (crypto_destroy_session:344): freeing space for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.894312] cryptodev: openssl[8424] (crypto_create_session:284): got alignmask 7
Jul 17 17:13:12 odroid64 kernel: [ 9399.894316] cryptodev: openssl[8424] (crypto_create_session:287): preallocating for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.894324] cryptodev: openssl[8424] (crypto_destroy_session:341): Removed session 0xF38ADA59
Jul 17 17:13:12 odroid64 kernel: [ 9399.894329] cryptodev: openssl[8424] (crypto_destroy_session:344): freeing space for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.894421] cryptodev: openssl[8424] (crypto_create_session:284): got alignmask 3
Jul 17 17:13:12 odroid64 kernel: [ 9399.894425] cryptodev: openssl[8424] (crypto_create_session:287): preallocating for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.894433] cryptodev: openssl[8424] (crypto_destroy_session:341): Removed session 0x7531B5B6
Jul 17 17:13:12 odroid64 kernel: [ 9399.894439] cryptodev: openssl[8424] (crypto_destroy_session:344): freeing space for 32 user pages
Jul 17 17:13:12 odroid64 kernel: [ 9399.894444] cryptodev: openssl[8424] (crypto_create_session:167): bad cipher: 4
Jul 17 17:13:12 odroid64 kernel: [ 9399.895619] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc05bd9de00
Jul 17 17:13:12 odroid64 kernel: [ 9399.895626] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc05bd9d600
Jul 17 17:13:12 odroid64 kernel: [ 9399.895630] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc05bd9dc00
Jul 17 17:13:12 odroid64 kernel: [ 9399.895634] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc059d30000
Jul 17 17:13:12 odroid64 kernel: [ 9399.895639] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc05bf03c00
Jul 17 17:13:12 odroid64 kernel: [ 9399.895644] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc05bf03500
Jul 17 17:13:12 odroid64 kernel: [ 9399.895648] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc059df4500
Jul 17 17:13:12 odroid64 kernel: [ 9399.895652] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc059df4c00
Jul 17 17:13:12 odroid64 kernel: [ 9399.895656] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc059df4600
Jul 17 17:13:12 odroid64 kernel: [ 9399.895660] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc05a90ce00
Jul 17 17:13:12 odroid64 kernel: [ 9399.895664] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc05a90cc00
Jul 17 17:13:12 odroid64 kernel: [ 9399.895669] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc05a90c600
Jul 17 17:13:12 odroid64 kernel: [ 9399.895673] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc05a90c000
Jul 17 17:13:12 odroid64 kernel: [ 9399.895677] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc05a88b300
Jul 17 17:13:12 odroid64 kernel: [ 9399.895681] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc05a467a00
Jul 17 17:13:12 odroid64 kernel: [ 9399.895686] cryptodev: openssl[8424] (cryptodev_release:519): freeing item at ffffffc05a59ac00
Jul 17 17:13:12 odroid64 kernel: [ 9399.895691] cryptodev: openssl[8424] (cryptodev_release:541): Cryptodev handle deinitialised, 16 elements freed
Not sure about the bad cipher: 4 & bad cipher: 12 as yet (Edit: believe they are these below)
CRYPTO_CAST_CBC = 4,
CRYPTO_ARC4 = 12,

I also worked out I could enable crc, crypto, fp & simd modes but if I enabled lse then openssl would fail with an illegal instruction. I could enable this....

-march=armv8-a+crypto+crc+fp+simd

Going to try a few things in the kernel on the off chance I find something and also see if I can compile cryptodev with some optimisations on the off chance arm64 hardware encryption is there.

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

I spent some more time trying to understand what is achievable and the test results. To summarise:

-C2 has 4 x cortex-a53's with fpu (floating Point), asimd (Advanced Single Instruction Multiple Data), CRC32 (Cyclic Redundancy Check 32) and Neon Instructions. These CPU features allow the C2 utilise the following kernel features under ARM64 Accelerated Cryptographic Algorithms...

- AES in ECB/CBC/CTR/XTS modes using NEON instructions
- CRC32 and CRC32C using optional ARMv8 instructions
(I also needed to compile openssl with compiler option "-march" + fp options listed in earlier thread to gain the full benefits.

The following features are unavailable because C2 Cortex CPU's does not have crypto extensions enabled...
- SHA-224/SHA-256 digest algorithm (ARMv8 Crypto Extensions)
- GHASH (for GCM chaining mode) using ARMv8 Crypto Extensions
- AES core cipher using ARMv8 Crypto Extensions
- AES in CCM mode using ARMv8 Crypto Extensions
- AES in ECB/CBC/CTR/XTS modes using ARMv8 Crypto Extensions


The s905 does have a its own amlogic crypto module but requires a working crypto / dma driver which is not currently part of the kernel source.

Finally the optional arm64 drivers and the amlogic drivers should all work with the normal openssl afalg engine, dont believe cryptodev is needed at all. Ill try and confirm this, all my testing done on latest dev version of openssl & cryptodev. I have also tested on 4.7 kernel (small patch for openssl and small patch for cryptodev) with almost identical results.

Will try to patch the kernel to get the amlogic driver working.

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

Great progress! Thanks for the update :)

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

hephooey wrote: That is pretty much where I got stuck now. I tried to compare the code and the datasheet (page. 93), does not see anything obviously wrong. As you mentioned there are so many things could be the cause. And debuging kernel is not fun at all...
I hit the same issue with crypto stalling on ioctl, tried a few more config options now im receiving a crash on startup...

Code: Select all

[    3.204030] aml_aes_dma c883e000.aml_aes: Aml AES_dma
[    3.204287] aml_tdes_dma c883e000.aml_tdes: Aml TDES_dma
[    3.204385] Unable to handle kernel NULL pointer dereference at virtual address 00000008
[    3.204388] pgd = ffffffc002106000
[    3.204393] [00000008] *pgd=000000005d403003, *pmd=000000005d406003, *pte=00600000c4301707
[    3.204399] Internal error: Oops: 96000045 [#1] SMP
[    3.204403] Modules linked in:
[    3.204409] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.65+ #14
[    3.204412] task: ffffffc05d478000 ti: ffffffc05d47c000 task.ti: ffffffc05d47c000
[    3.204427] PC is at crypto_remove_alg+0x50/0x88
[    3.204429] LR is at crypto_remove_alg+0x48/0x88
[    3.204432] pc : [<ffffffc00132b870>] lr : [<ffffffc00132b868>] pstate: 60000045
[    3.204432] sp : ffffffc05d47fb70
[    3.204435] x29: ffffffc05d47fb70 x28: ffffffc001ccb828 
[    3.204438] x27: ffffffc001ccb000 x26: ffffffc001ccb828 
[    3.204440] x25: 0000000000000000 x24: 00000000ffffffea 
[    3.204443] x23: ffffffc0020f8000 x22: ffffffc001ccb708 
[    3.204446] x21: ffffffc05d733810 x20: ffffffc05d47fbc0 
[    3.204448] x19: ffffffc001ccb708 x18: 0000000000000000 
[    3.204450] x17: 000000000000000d x16: 000000000000000e 
[    3.204453] x15: 0000000000000000 x14: 0ffffffffffffffe 
[    3.204455] x13: 0000000000000038 x12: 0000000000000038 
[    3.204457] x11: 000000000000002b x10: 0101010101010101 
[    3.204460] x9 : 0000000000007fb6 x8 : ffffff8041974328 
[    3.204462] x7 : ffffffc001a45a48 x6 : ffffffc001094240 
[    3.204465] x5 : 0000000000000000 x4 : 0000000000000000 
[    3.204467] x3 : 0000000000000000 x2 : 0000000000000000 
[    3.204470] x1 : ffffffc05d47fbc0 x0 : 0000000000000000 
I will try to get back a working system and enable some more debug and hung task detection, I have also had a look at the older arm32 crypto driver which has an extra driver to enable userspace mode. see https://github.com/hardkernel/linux/tre ... gic/crypto

hephooey
Posts: 54
Joined: Tue Mar 22, 2016 4:19 am
languages_spoken: english
ODROIDs: C1+, C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by hephooey »

Interesting. I never tried it myself but it seems the crypto driver for C1 works according to http://forum.odroid.com/viewtopic.php?f=112&t=7579. Maybe it will help to determine whether it is an kernel issue or cryptodev issue. I think the current code stalls at the wait_for_completion in cryptlib.c. I do not think there is similar code in the 3.10 version. However comparing the data sheet, the crypto hardware in S805 and S905 is quite different, not sure how much information we can extract.

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

Should also mention that would like to try to backport the CRC32 support to the hardkernel kernel.

This is currently in 4.x kernels but does not appear to be in 3.14.y

Ref: https://git.kernel.org/cgit/linux/kerne ... t-20160722

hephooey
Posts: 54
Joined: Tue Mar 22, 2016 4:19 am
languages_spoken: english
ODROIDs: C1+, C2
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by hephooey »

The code for C1 (3.10) is actually very interesting. It makes a lot sense reading together with the released S805 data sheet. So the bad new is now I am 95% sure the crypto code in the latest amlogic kernel does not work for C2. For example in the tdes code, the code should write NDMA_TDES_IV_KEY_LO/HI and NDMA_TDES_CONTROL, S805 is almost the same. The HK 3.10 code did exactly that, but the amlogic 3.14 code does not have anything close. I think we need to ask HK/amlogic for proper support of the crypto engine.

I guess it is not impossible to modify the drive in 3.10 to work for 3.14, but at least for AES the some registers are not documented in S805 or S905 data sheet, so it will be very difficult. Also I notice the copywrite holder for the aml-crypto.c in 3.10 is AMD, WTF?

h31
Posts: 6
Joined: Thu Mar 26, 2015 1:00 am
languages_spoken: english, russian
ODROIDs: C1
Location: Russia, St. Petersburg
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by h31 »

Hello.

I've recently tried to enable crypto acceleration on C1. Someone mentioned on this thread that C1 and C2 have very similar crypto accelerators, so I think that our efforts should be combined. You can find the results of my investigation here: http://forum.odroid.com/viewtopic.php?f=111&t=22343.

In short, the crypto acceleration is completely broken on C1. There's a driver in a kernel tree, written in a "quick and dirty" style. Looks like the code was largely copy-pasted from an AMD Geode driver, and author didn't ever bother to change copyrights. I've read on this forum that somebody had managed to use this driver together with OpenSSL via cryptodev layer, but it's totally unusable for in-kernel tasks (IPsec, disk encryption, etc).

I've found a newer version of the driver, and you can grab it from this repo: https://github.com/codesnake/linux/tree ... gic/crypto. It looks much more polished and have many bugs fixed. I've tried to build it against C1's kernel (version 3.10), and surprisingly it compiles without errors, however it doesn't work. I'm not very experienced in kernel development, but looks like it ever wasn't initialized. I've noticed that the new driver uses a completely different model, it's written as a platform driver (the previous one was just a kernel module), maybe that's why it doesn't work.

There's some workarounds if you need a fast encryption on C1 and C2 just now. For user space encryption, you can apply these patches to enable ChaCha20, a cipher which should work faster than AES: https://github.com/cloudflare/sslconfig ... er/patches. For in-kernel tasks, you can use pcrypt: https://wiki.strongswan.org/projects/st ... iki/Pcrypt.

Raybuntu
Posts: 1414
Joined: Mon Nov 30, 2015 4:23 pm
languages_spoken: english, german
ODROIDs: C1+, C2
Has thanked: 3 times
Been thanked: 23 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by Raybuntu »

@h31: It's probably not working because the device tree is incomplete. You need to extend the dts:

https://github.com/hardkernel/linux/blo ... droidc.dts

https://github.com/codesnake/linux/blob ... aes.c#L931

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

hephooey wrote:The HK 3.10 code did exactly that, but the amlogic 3.14 code does not have anything close. I think we need to ask HK/amlogic for proper support of the crypto engine.
The newer amlogic driver is quiet different, in the current amlogic source only the gxl (S905X) has the device tree entries in the source not the gxbb.

There is some documentation in the kernel also and it mentions examples for older chips which do not appear to support HMAC and the device tree entries are slightly different. The doco can be found in amlogic sources under ./Documentation/devicetree/bindings/crypto/aml-crypto.txt and it provides the info on device tree setup.

These are what I suspect the devicetree entries should be for sha1, aes & tdes for gxbb for the new crypto driver taken from the latest amlogic source..

Code: Select all

        aml_aes{
                compatible = "amlogic,aes";
                dev_name = "aml_aes";
                interrupts = <0 36 1>;
                resets = <&clock GCLK_IDX_BLK_MOV>;
                reg = <0x0 0xc8832000 0x0 0x2c4
                        0x0 0xda832000 0x0 0xe4>;
        };
        aml_tdes{
                compatible = "amlogic,des,tdes";
                dev_name = "aml_tdes";
                interrupts = <0 36 1>;
                resets = <&clock GCLK_IDX_BLK_MOV>;
                reg = <0x0 0xc8832000 0x0 0x2c4
                        0x0 0xda832000 0x0 0xe4>;
        };
        aml_sha{
                compatible = "amlogic,sha";
                dev_name = "aml_sha";
                interrupts = <0 36 1>;
                resets = <&clock GCLK_IDX_BLK_MOV>;
                reg = <0x0 0xc8832000 0x0 0x2c4
                        0x0 0xda832000 0x0 0xe4>;
        };
They are taken from the examples in the amlogic doco and the registers appear to line up but need to check further. Compiling up a version now to see what happens. The resets exist on the odroid kernel and the address'es appear to line up with the datasheet.

Edit: Still no luck, if it runs self tests on the crypto at startup it hangs (need to investigate further), if I disable crypto self tests on boot both the aes & tdes modules load but it seems to then have a problem initialising the sha driver (Unable to handle kernel NULL pointer dereference at virtual address 00000008)...

Code: Select all

[    3.723281]  mmcblk0boot0: unknown partition table
[    3.739233] cectx c810023c.aocec: aml_cec_probe(): can't find hdmirx
[    3.748902] aml_aes_dma c8832000.aml_aes: Aml AES_dma
[    3.752631] aml_tdes_dma c8832000.aml_tdes: Aml TDES_dma
[    3.757103] Unable to handle kernel NULL pointer dereference at virtual address 00000008
[    3.764924] pgd = ffffffc002226000
[    3.768411] [00000008] *pgd=000000005d003003, *pmd=000000005d006003, *pte=00600000c4301707
[    3.779772] Internal error: Oops: 96000045 [#1] PREEMPT SMP
[    3.783410] Modules linked in:
[    3.789718] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 3.14.65 #12
[    3.793841] task: ffffffc05d06c000 ti: ffffffc05d0e8000 task.ti: ffffffc05d0e8000
[    3.801264] PC is at crypto_remove_alg+0x50/0x88
[    3.805830] LR is at crypto_remove_alg+0x48/0x88
[    3.810400] pc : [<ffffffc00138c8d8>] lr : [<ffffffc00138c8d0>] pstate: 80000245
[    3.817730] sp : ffffffc05d0ebb60
[    3.821496] x29: ffffffc05d0ebb60 x28: ffffffc001dc40e0 
[    3.829789] x27: ffffffc001dc3000 x26: ffffffc001dc39d8 
[    3.835034] x25: 0000000000000000 x24: ffffffc001dc39d8 
[    3.840293] x23: ffffffc002215000 x22: ffffffc001dc38b8 
[    3.845544] x21: ffffffc05d35e810 x20: ffffffc05d0ebbb0 
[    3.850774] x19: ffffffc001dc38b8 x18: 0000000000000000 
[    3.856016] x17: 0000000000000000 x16: 0000000000000000 
[    3.861304] x15: 0000000000000000 x14: 0fffffffffffffff 
[    3.866584] x13: 0000000000000038 x12: 0000000000000038 
[    3.871864] x11: 000000000000002b x10: 0101010101010101 
[    3.877096] x9 : 0000000000000000 x8 : ffffff8042438f90 
[    3.882367] x7 : 0000000000000000 x6 : ffffffc001de4000 
[    3.887623] x5 : 0000000000000000 x4 : 0000000000000000 
[    3.892887] x3 : 0000000000000000 x2 : 0000000000000000 
[    3.898145] x1 : ffffffc05d0ebbb0 x0 : 0000000000000000 
[    3.903423] 
[    3.903423] PC: 0xffffffc00138c858:
[    3.910908] c858  f0003c00 91006063 9128a021 91022000 52800de2 941549db f0003c00 9102a000
[    3.921871] c878  94154932 d503201f aa1403e1 17ffffc5 a9be7bfd 910003fd a90153f3 aa0003f3
[    3.929998] c898  aa1e03e0 aa0103f4 d503201f f9400260 eb00027f 540002a0 b9402263 90004ea0
[    3.938095] c8b8  aa1303e2 9130e000 321b0063 d2800041 b9002263 97f538a5 a9400e64 aa1403e1
[    3.946175] c8d8  f9000483 aa1303e0 d2800002 f9000064 a9004e73 97ffff07 52800000 a94153f3
[    3.954290] c8f8  a8c27bfd d65f03c0 12800020 a94153f3 a8c27bfd d65f03c0 a9bc7bfd 910003fd
[    3.962413] c918  a90153f3 a9025bf5 aa0003f4 aa1e03e0 90004eb6 9100c3b5 d503201f a90357b5
[    3.970515] c938  913042c0 941567bd f9400280 eb00029f 54000900 f9400681 f9000401 f9000020
[    3.978605] 
[    3.978605] LR: 0xffffffc00138c850:
[    3.986141] c850  d0003da1 912be063 f0003c00 91006063 9128a021 91022000 52800de2 941549db
[    3.997097] c870  f0003c00 9102a000 94154932 d503201f aa1403e1 17ffffc5 a9be7bfd 910003fd
[    4.005201] c890  a90153f3 aa0003f3 aa1e03e0 aa0103f4 d503201f f9400260 eb00027f 540002a0
[    4.013349] c8b0  b9402263 90004ea0 aa1303e2 9130e000 321b0063 d2800041 b9002263 97f538a5
[    4.021473] c8d0  a9400e64 aa1403e1 f9000483 aa1303e0 d2800002 f9000064 a9004e73 97ffff07
[    4.029645] c8f0  52800000 a94153f3 a8c27bfd d65f03c0 12800020 a94153f3 a8c27bfd d65f03c0
[    4.037818] c910  a9bc7bfd 910003fd a90153f3 a9025bf5 aa0003f4 aa1e03e0 90004eb6 9100c3b5
[    4.045949] c930  d503201f a90357b5 913042c0 941567bd f9400280 eb00029f 54000900 f9400681
[    4.054091] 
[    4.054091] SP: 0xffffffc05d0ebae0:
[    4.062062] bae0  5d0ebbb0 ffffffc0 5d35e810 ffffffc0 01dc38b8 ffffffc0 02215000 ffffffc0
[    4.073253] bb00  01dc39d8 ffffffc0 00000000 00000000 01dc39d8 ffffffc0 01dc3000 ffffffc0
[    4.081356] bb20  01dc40e0 ffffffc0 5d0ebb60 ffffffc0 0138c8d0 ffffffc0 5d0ebb60 ffffffc0
[    4.089469] bb40  0138c8d8 ffffffc0 80000245 00000000 5d35e810 ffffffc0 73b64000 00000000
[    4.097599] bb60  5d0ebb80 ffffffc0 0138cf18 ffffffc0 01d60c10 ffffffc0 5d0ebbb0 ffffffc0
[    4.105715] bb80  5d0ebbc0 ffffffc0 01392e38 ffffffc0 01dc3870 ffffffc0 ffffffea 00000000
[    4.113857] bba0  5d35e810 ffffffc0 73b63028 ffffffc0 5d0ebbb0 ffffffc0 5d0ebbb0 ffffffc0
[    4.121951] bbc0  5d0ebbe0 ffffffc0 017542c4 ffffffc0 73b63000 ffffffc0 73b64000 00000000
[    4.130048] 
[    4.130048] X1: 0xffffffc05d0ebb30:
[    4.138263] bb30  0138c8d0 ffffffc0 5d0ebb60 ffffffc0 0138c8d8 ffffffc0 80000245 00000000
[    4.149595] bb50  5d35e810 ffffffc0 73b64000 00000000 5d0ebb80 ffffffc0 0138cf18 ffffffc0
[    4.157692] bb70  01d60c10 ffffffc0 5d0ebbb0 ffffffc0 5d0ebbc0 ffffffc0 01392e38 ffffffc0
[    4.165786] bb90  01dc3870 ffffffc0 ffffffea 00000000 5d35e810 ffffffc0 73b63028 ffffffc0
[    4.173847] bbb0  5d0ebbb0 ffffffc0 5d0ebbb0 ffffffc0 5d0ebbe0 ffffffc0 017542c4 ffffffc0
[    4.181912] bbd0  73b63000 ffffffc0 73b64000 00000000 5d0ebc50 ffffffc0 014e0f3c ffffffc0
[    4.189968] bbf0  5d35e810 ffffffc0 01dc37a8 ffffffc0 5d35e870 ffffffc0 00000000 00000000
[    4.198034] bc10  01dc37d0 ffffffc0 00000000 00000000 01c18198 ffffffc0 01c58768 ffffffc0
[    4.206146] 
[    4.206146] X6: 0xffffffc001de3f80:
[    4.214016] 3f80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.225114] 3fa0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.233217] 3fc0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.241244] 3fe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.249282] 4000  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.257361] 4020  00000000 00000000 741fde00 ffffffc0 741fdd00 ffffffc0 741fdc00 ffffffc0
[    4.264100] random: nonblocking pool is initialized
[    4.269384] 4040  00000000 00000000 00000001 00000000 00000001 00000000 00000000 00000000
[    4.280392] 4060  00000000 00000001 00000000 00000000 00000000 00000000 0081adee 00000000
[    4.288496] 
[    4.288496] X19: 0xffffffc001dc3838:
[    4.296408] 3838  00000000 00000000 73894f00 ffffffc0 00000000 00000000 00000000 00000000
[    4.307713] 3858  73b63000 ffffffc0 73b63000 ffffffc0 00010001 00000000 017532e8 ffffffc0
[    4.315844] 3878  01754700 ffffffc0 01754680 ffffffc0 01754760 ffffffc0 017547b8 ffffffc0
[    4.323973] 3898  00000000 00000000 00000000 00000000 00000000 00000000 00000014 00000000
[    4.332123] 38b8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.340219] 38d8  000000a0 00000040 00000058 00000000 0000012c 00000000 31616873 00000000
[    4.348333] 38f8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.356458] 3918  00000000 00000000 00000000 00000000 00000000 00000000 2d6c6d61 31616873
[    4.364570] 
[    4.364570] X20: 0xffffffc05d0ebb30:
[    4.372906] bb30  0138c8d0 ffffffc0 5d0ebb60 ffffffc0 0138c8d8 ffffffc0 80000245 00000000
[    4.384352] bb50  5d35e810 ffffffc0 73b64000 00000000 5d0ebb80 ffffffc0 0138cf18 ffffffc0
[    4.392438] bb70  01d60c10 ffffffc0 5d0ebbb0 ffffffc0 5d0ebbc0 ffffffc0 01392e38 ffffffc0
[    4.400506] bb90  01dc3870 ffffffc0 ffffffea 00000000 5d35e810 ffffffc0 73b63028 ffffffc0
[    4.408589] bbb0  5d0ebbb0 ffffffc0 5d0ebbb0 ffffffc0 5d0ebbe0 ffffffc0 017542c4 ffffffc0
[    4.416679] bbd0  73b63000 ffffffc0 73b64000 00000000 5d0ebc50 ffffffc0 014e0f3c ffffffc0
[    4.424755] bbf0  5d35e810 ffffffc0 01dc37a8 ffffffc0 5d35e870 ffffffc0 00000000 00000000
[    4.432837] bc10  01dc37d0 ffffffc0 00000000 00000000 01c18198 ffffffc0 01c58768 ffffffc0
[    4.440928] 
[    4.440928] X21: 0xffffffc05d35e790:
[    4.448919] e790  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.460188] e7b0  00000000 00000000 014e0a60 ffffffc0 00000000 00000000 00000000 00000000
[    4.468241] e7d0  00000004 00000000 5d345400 ffffffc0 00000000 00000000 00000000 00000000
[    4.476277] e7f0  00000000 00000000 00000000 00000000 5d347600 ffffffc0 ffffffff 00000000
[    4.484364] e810  01d732a0 ffffffc0 5d345700 ffffffc0 5d347600 ffffffc0 74195470 ffffffc0
[    4.492464] e830  5d35e628 ffffffc0 01d732b0 ffffffc0 5d190980 ffffffc0 01d72fd0 ffffffc0
[    4.500537] e850  5d3467f8 ffffffc0 00000003 00000007 00000000 00000000 00000000 00000000
[    4.508630] e870  00000000 00000000 5d35e878 ffffffc0 5d35e878 ffffffc0 5d06c000 ffffffc0
[    4.516735] 
[    4.516735] X22: 0xffffffc001dc3838:
[    4.524306] 3838  00000000 00000000 73894f00 ffffffc0 00000000 00000000 00000000 00000000
[    4.535373] 3858  73b63000 ffffffc0 73b63000 ffffffc0 00010001 00000000 017532e8 ffffffc0
[    4.543484] 3878  01754700 ffffffc0 01754680 ffffffc0 01754760 ffffffc0 017547b8 ffffffc0
[    4.551593] 3898  00000000 00000000 00000000 00000000 00000000 00000000 00000014 00000000
[    4.559718] 38b8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.567772] 38d8  000000a0 00000040 00000058 00000000 0000012c 00000000 31616873 00000000
[    4.575866] 38f8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.583950] 3918  00000000 00000000 00000000 00000000 00000000 00000000 2d6c6d61 31616873
[    4.592037] 
[    4.592037] X23: 0xffffffc002214f80:
[    4.599431] 4f80  00000000 00000000 01dc22a0 ffffffc0 00000000 00000000 00000000 00000000
[    4.610407] 4fa0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.618476] 4fc0  00000000 00000000 00000001 00000000 00000000 00000000 01dc22c8 ffffffc0
[    4.626569] 4fe0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.634654] 5000  00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000
[    4.642721] 5020  00000000 00000000 00000000 00000000 00000001 00000000 0000000f 00000000
[    4.650793] 5040  73ad1800 ffffffc0 73ad1400 ffffffc0 00000000 00000000 00000000 00000000
[    4.658886] 5060  5d3d8c00 ffffffc0 0007a120 00000190 00000001 00000002 00000001 00000000
[    4.666966] 
[    4.666966] X24: 0xffffffc001dc3958:
[    4.673968] 3958  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.684749] 3978  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.692857] 3998  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.700966] 39b8  01752a08 ffffffc0 01754480 ffffffc0 00000000 00000000 00000000 00000000
[    4.709109] 39d8  017532e8 ffffffc0 01754700 ffffffc0 01754680 ffffffc0 01754760 ffffffc0
[    4.717258] 39f8  017547b8 ffffffc0 00000000 00000000 00000000 00000000 00000000 00000000
[    4.725368] 3a18  00000020 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.733402] 3a38  00000000 00000000 00000080 00000040 00000058 00000000 0000012c 00000000
[    4.741433] 
[    4.741433] X26: 0xffffffc001dc3958:
[    4.748380] 3958  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.759163] 3978  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.767182] 3998  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.775245] 39b8  01752a08 ffffffc0 01754480 ffffffc0 00000000 00000000 00000000 00000000
[    4.783348] 39d8  017532e8 ffffffc0 01754700 ffffffc0 01754680 ffffffc0 01754760 ffffffc0
[    4.791428] 39f8  017547b8 ffffffc0 00000000 00000000 00000000 00000000 00000000 00000000
[    4.799586] 3a18  00000020 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.807691] 3a38  00000000 00000000 00000080 00000040 00000058 00000000 0000012c 00000000
[    4.815793] 
[    4.815793] X27: 0xffffffc001dc2f80:
[    4.822625] 2f80  006c6d61 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.833349] 2fa0  00000000 00000000 00000000 00000000 00000000 00000000 01950da8 ffffffc0
[    4.841393] 2fc0  0174eef8 ffffffc0 01750060 ffffffc0 01750030 ffffffc0 00000000 00000000
[    4.849511] 2fe0  00000000 00000000 00000000 00000000 00000010 00000020 00000010 00000000
[    4.857634] 3000  0174eeb0 ffffffc0 0174eee0 ffffffc0 00000000 00000000 00000000 00000000
[    4.865741] 3020  01dc2f00 ffffffc0 01dc3140 ffffffc0 01dc3030 ffffffc0 01dc3030 ffffffc0
[    4.873850] 3040  00000485 00000010 00000030 00000000 0000012c 00000001 28636263 29736561
[    4.881997] 3060  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.890086] 
[    4.890086] X28: 0xffffffc001dc4060:
[    4.896946] 4060  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.907681] 4080  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.915703] 40a0  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.923794] 40c0  01752a38 ffffffc0 01752a78 ffffffc0 00000000 00000000 00000000 00000000
[    4.931928] 40e0  01754e60 ffffffc0 01754f68 ffffffc0 00000000 00000000 01754a60 ffffffc0
[    4.940017] 4100  01754a80 ffffffc0 01bb46c8 ffffffc0 00000000 00000000 00000000 00000000
[    4.948096] 4120  00000000 00000000 00000000 00000000 019c4bd0 ffffffc0 00000000 00000000
[    4.956221] 4140  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.964286] 
[    4.964286] X29: 0xffffffc05d0ebae0:
[    4.970870] bae0  5d0ebbb0 ffffffc0 5d35e810 ffffffc0 01dc38b8 ffffffc0 02215000 ffffffc0
[    4.981474] bb00  01dc39d8 ffffffc0 00000000 00000000 01dc39d8 ffffffc0 01dc3000 ffffffc0
[    4.989529] bb20  01dc40e0 ffffffc0 5d0ebb60 ffffffc0 0138c8d0 ffffffc0 5d0ebb60 ffffffc0
[    4.997633] bb40  0138c8d8 ffffffc0 80000245 00000000 5d35e810 ffffffc0 73b64000 00000000
[    5.005754] bb60  5d0ebb80 ffffffc0 0138cf18 ffffffc0 01d60c10 ffffffc0 5d0ebbb0 ffffffc0
[    5.013852] bb80  5d0ebbc0 ffffffc0 01392e38 ffffffc0 01dc3870 ffffffc0 ffffffea 00000000
[    5.021988] bba0  5d35e810 ffffffc0 73b63028 ffffffc0 5d0ebbb0 ffffffc0 5d0ebbb0 ffffffc0
[    5.030121] bbc0  5d0ebbe0 ffffffc0 017542c4 ffffffc0 73b63000 ffffffc0 73b64000 00000000
[    5.038252] 
[    5.041655] Process swapper/0 (pid: 1, stack limit = 0xffffffc05d0e8058)
[    5.046148] Stack: (0xffffffc05d0ebb60 to 0xffffffc05d0ec000)
[    5.051842] bb60: 5d0ebb80 ffffffc0 0138cf18 ffffffc0 01d60c10 ffffffc0 5d0ebbb0 ffffffc0
[    5.059949] bb80: 5d0ebbc0 ffffffc0 01392e38 ffffffc0 01dc3870 ffffffc0 ffffffea 00000000
[    5.068057] bba0: 5d35e810 ffffffc0 73b63028 ffffffc0 5d0ebbb0 ffffffc0 5d0ebbb0 ffffffc0
[    5.076164] bbc0: 5d0ebbe0 ffffffc0 017542c4 ffffffc0 73b63000 ffffffc0 73b64000 00000000
[    5.084272] bbe0: 5d0ebc50 ffffffc0 014e0f3c ffffffc0 5d35e810 ffffffc0 01dc37a8 ffffffc0
[    5.092379] bc00: 5d35e870 ffffffc0 00000000 00000000 01dc37d0 ffffffc0 00000000 00000000
[    5.100487] bc20: 01c18198 ffffffc0 01c58768 ffffffc0 01cf6340 ffffffc0 00000000 00000000
[    5.108595] bc40: 5d0ebc70 ffffffc0 01d09000 ffffffc0 5d0ebc70 ffffffc0 014def40 ffffffc0
[    5.116702] bc60: 02005000 ffffffc0 5d35e810 ffffffc0 5d0ebcb0 ffffffc0 014df224 ffffffc0
[    5.124809] bc80: 5d35e810 ffffffc0 01dc37d0 ffffffc0 5d35e870 ffffffc0 00000000 00000000
[    5.132917] bca0: 01d73000 ffffffc0 01c0a7b0 ffffffc0 5d0ebce0 ffffffc0 014dd088 ffffffc0
[    5.141024] bcc0: 00000000 00000000 01dc37d0 ffffffc0 014df170 ffffffc0 01c0a7b0 ffffffc0
[    5.149132] bce0: 5d0ebd20 ffffffc0 014dea00 ffffffc0 01dc37d0 ffffffc0 73894f00 ffffffc0
[    5.157239] bd00: 00000000 00000000 01d73460 ffffffc0 5d1d48a8 ffffffc0 5d345768 ffffffc0
[    5.165347] bd20: 5d0ebd40 ffffffc0 014de5e8 ffffffc0 01dc37d0 ffffffc0 73894f00 ffffffc0
[    5.173454] bd40: 5d0ebd80 ffffffc0 014df9e0 ffffffc0 01dc37d0 ffffffc0 00000000 00000000
[    5.181562] bd60: 00000000 00000000 00000006 00000000 01de4000 ffffffc0 00000000 00000000
[    5.189669] bd80: 5d0ebda0 ffffffc0 014e0f00 ffffffc0 01dc37a8 ffffffc0 00000000 00000000
[    5.197777] bda0: 5d0ebdc0 ffffffc0 01c50774 ffffffc0 5d0e8000 ffffffc0 01c5075c ffffffc0
[    5.205884] bdc0: 5d0ebdd0 ffffffc0 01081694 ffffffc0 5d0ebe50 ffffffc0 01c189d4 ffffffc0
[    5.213991] bde0: 00000259 00000000 01de4000 ffffffc0 01c58778 ffffffc0 00000006 00000000
[    5.222099] be00: 01de4000 ffffffc0 01c0a7b0 ffffffc0 01c18100 ffffffc0 01c58768 ffffffc0
[    5.230207] be20: 01cf55e8 ffffffc0 00000000 00000000 5d0ebe50 ffffffc0 01b17060 ffffffc0
[    5.236802] switch_vpu_mem_pd: viu_vd1 OFF
[    5.236806] switch_vpu_mem_pd: afbc_dec OFF
[    5.236808] switch_vpu_mem_pd: di_post OFF
[    5.236811] switch_vpu_mem_pd: viu_vd2 OFF
[    5.254616] be40: 00000006 00000006 01c18198 ffffffc0 5d0ebeb0 ffffffc0 018dd9d0 ffffffc0
[    5.262723] be60: 01de4000 ffffffc0 01de4000 ffffffc0 00000000 00000000 00000000 00000000
[    5.270830] be80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.278937] bea0: 00000000 00000000 00000000 00000000 00000000 00000000 010843b0 ffffffc0
[    5.287045] bec0: 018dd9b0 ffffffc0 00000000 00000000 00000000 00000000 00000000 00000000
[    5.295152] bee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.303261] bf00: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.311367] bf20: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.319475] bf40: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.327583] bf60: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.335690] bf80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.343797] bfa0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.351905] bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000005 00000000
[    5.360013] bfe0: 00000000 00000000 00000000 00000000 aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa
[    5.368117] Call trace:
[    5.371354] [<ffffffc00138c8d8>] crypto_remove_alg+0x50/0x88
[    5.376141] [<ffffffc00138cf18>] crypto_unregister_alg+0x40/0xd0
[    5.382094] [<ffffffc001392e38>] crypto_unregister_ahash+0x20/0x30
[    5.388218] [<ffffffc0017542c4>] aml_sha_probe+0x2a4/0x460
[    5.393652] [<ffffffc0014e0f3c>] platform_drv_probe+0x2c/0x68
[    5.399342] [<ffffffc0014def40>] really_probe+0x78/0x230
[    5.404603] [<ffffffc0014df224>] __driver_attach+0xb4/0xb8
[    5.410037] [<ffffffc0014dd088>] bus_for_each_dev+0x70/0xb0
[    5.415557] [<ffffffc0014dea00>] driver_attach+0x30/0x40
[    5.420818] [<ffffffc0014de5e8>] bus_add_driver+0x160/0x218
[    5.426339] [<ffffffc0014df9e0>] driver_register+0x68/0x128
[    5.431859] [<ffffffc0014e0f00>] __platform_driver_register+0x70/0x80
[    5.438244] [<ffffffc001c50774>] aml_sha_driver_init+0x18/0x20
[    5.444021] [<ffffffc001081694>] do_one_initcall+0xdc/0x140
[    5.449541] [<ffffffc001c189d4>] kernel_init_freeable+0x198/0x238
[    5.455580] [<ffffffc0018dd9d0>] kernel_init+0x20/0xe0
[    5.460666] Code: b9002263 97f538a5 a9400e64 aa1403e1 (f9000483) 
[    5.469330] ---[ end trace f04c75565209f219 ]---
[    5.472546] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    5.472546] 
[    5.482342] CPU0: stopping
[    5.485482] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G      D      3.14.65 #12
[    5.491999] Call trace:
[    5.495155] [<ffffffc001088e40>] dump_backtrace+0x0/0x128
[    5.499764] [<ffffffc001088f8c>] show_stack+0x24/0x30
[    5.504769] [<ffffffc0018e04a8>] dump_stack+0x88/0xac
[    5.509771] [<ffffffc001090010>] handle_IPI+0x1c0/0x1d0
[    5.514943] [<ffffffc00108143c>] gic_handle_irq+0x84/0x88
[    5.520289] Exception stack(0xffffffc001cffdd0 to 0xffffffc001cffef0)
[    5.526673] fdc0:                                     01cfc000 ffffffc0 018f5000 ffffffc0
[    5.534781] fde0: 01cfff10 ffffffc0 01085138 ffffffc0 01108fd0 ffffffc0 00000000 00000000
[    5.542889] fe00: 74195d14 ffffffc0 00000000 01000000 01e6c000 ffffffc0 0000038e 00000000
[    5.550996] fe20: 30000000 00038074 00a10e31 00000000 3b9aca00 00000000 01cffd50 ffffffc0
[    5.559104] fe40: 000003ff 00000000 00000000 00000000 000727d8 00000000 000002f8 00000000
[    5.567211] fe60: 000002f8 00000000 00080000 00000000 0000000e 00000000 00000004 00000000
[    5.575319] fe80: 00000002 00000000 01cfc000 ffffffc0 018f5000 ffffffc0 01dde000 ffffffc0
[    5.583426] fea0: 01d09a6c ffffffc0 01ddd8d6 ffffffc0 01b1afc0 ffffffc0 01cfc000 ffffffc0
[    5.591534] fec0: 01d09980 ffffffc0 01080478 ffffffc0 00000000 00000040 01cfff10 ffffffc0
[    5.599640] fee0: 01085134 ffffffc0 01cfff10 ffffffc0
[    5.604644] [<ffffffc001083dac>] el1_irq+0x6c/0xd8
[    5.609391] [<ffffffc001108fd0>] cpu_startup_entry+0x238/0x288
[    5.615165] [<ffffffc0018dd9a4>] rest_init+0x8c/0x98
[    5.620082] [<ffffffc001c18824>] start_kernel+0x364/0x37c
[    5.625428] CPU3: stopping
[    5.628674] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G      D      3.14.65 #12
[    5.635087] Call trace:
[    5.638426] [<ffffffc001088e40>] dump_backtrace+0x0/0x128
[    5.642852] [<ffffffc001088f8c>] show_stack+0x24/0x30
[    5.647854] [<ffffffc0018e04a8>] dump_stack+0x88/0xac
[    5.652856] [<ffffffc001090010>] handle_IPI+0x1c0/0x1d0
[    5.658031] [<ffffffc00108143c>] gic_handle_irq+0x84/0x88
[    5.663378] Exception stack(0xffffffc05d13fe30 to 0xffffffc05d13ff50)
[    5.669761] fe20:                                     5d13c000 ffffffc0 018f5000 ffffffc0
[    5.677870] fe40: 5d13ff70 ffffffc0 01085138 ffffffc0 01108fd0 ffffffc0 00000000 00000000
[    5.685978] fe60: 741b9d14 ffffffc0 00000000 01000000 00000418 00000000 00000014 00000000
[    5.694085] fe80: 30000000 00038074 00a10e31 00000000 3b9aca00 00000000 5d13fdb0 ffffffc0
[    5.702192] fea0: ffff8cf4 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.710299] fec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.718407] fee0: 00000000 00000000 5d13c000 ffffffc0 018f5000 ffffffc0 01dde000 ffffffc0
[    5.726515] ff00: 01d09a6c ffffffc0 01ddd8d6 ffffffc0 01b1afc0 ffffffc0 5d13c000 ffffffc0
[    5.734623] ff20: 02226000 00000000 01080220 ffffffc0 00000000 00000040 5d13ff70 ffffffc0
[    5.742728] ff40: 01085134 ffffffc0 5d13ff70 ffffffc0
[    5.747732] [<ffffffc001083dac>] el1_irq+0x6c/0xd8
[    5.752476] [<ffffffc001108fd0>] cpu_startup_entry+0x238/0x288
[    5.758254] [<ffffffc00108fa54>] secondary_start_kernel+0x114/0x120
[    5.764463] CPU2: stopping
[    5.768193] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G      D      3.14.65 #12
[    5.774122] Call trace:
[    5.777882] [<ffffffc001088e40>] dump_backtrace+0x0/0x128
[    5.781887] [<ffffffc001088f8c>] show_stack+0x24/0x30
[    5.786890] [<ffffffc0018e04a8>] dump_stack+0x88/0xac
[    5.791891] [<ffffffc001090010>] handle_IPI+0x1c0/0x1d0
[    5.797066] [<ffffffc00108143c>] gic_handle_irq+0x84/0x88
[    5.802413] Exception stack(0xffffffc05d13be30 to 0xffffffc05d13bf50)
[    5.808797] be20:                                     5d138000 ffffffc0 018f5000 ffffffc0
[    5.816905] be40: 5d13bf70 ffffffc0 01085138 ffffffc0 01108fd0 ffffffc0 00000000 00000000
[    5.825013] be60: 741add14 ffffffc0 00000000 01000000 00000418 00000000 00000014 00000000
[    5.833120] be80: 60000000 00036d61 00a0e721 00000000 3b9aca00 00000000 5d13bdb0 ffffffc0
[    5.841227] bea0: ffff8cee 00000000 00000002 00000000 00000000 00000000 00000000 00000000
[    5.849335] bec0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    5.857442] bee0: 00000001 00000000 5d138000 ffffffc0 018f5000 ffffffc0 01dde000 ffffffc0
[    5.865550] bf00: 01d09a6c ffffffc0 01ddd8d6 ffffffc0 01b1afc0 ffffffc0 5d138000 ffffffc0
[    5.873658] bf20: 02226000 00000000 01080220 ffffffc0 00000000 00000040 5d13bf70 ffffffc0
[    5.881764] bf40: 01085134 ffffffc0 5d13bf70 ffffffc0
[    5.886767] [<ffffffc001083dac>] el1_irq+0x6c/0xd8
[    5.891511] [<ffffffc001108fd0>] cpu_startup_entry+0x238/0x288
[    5.897289] [<ffffffc00108fa54>] secondary_start_kernel+0x114/0x120
[   36.114522] ------------[ cut here ]------------
[   36.118420] WARNING: CPU: 1 PID: 1 at kernel/watchdog.c:259 watchdog_timer_fn+0x254/0x290()
[   36.125653] Watchdog detected hard LOCKUP on cpu 2
[   36.130224] Modules linked in:
[   36.138019] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G      D      3.14.65 #12
[   36.143359] Call trace:
[   36.147267] [<ffffffc001088e40>] dump_backtrace+0x0/0x128
[   36.151217] [<ffffffc001088f8c>] show_stack+0x24/0x30
[   36.156127] [<ffffffc0018e04a8>] dump_stack+0x88/0xac
[   36.161131] [<ffffffc0010af688>] warn_slowpath_common+0x98/0xc0
[   36.166995] [<ffffffc0010af714>] warn_slowpath_fmt+0x64/0x78
[   36.172601] [<ffffffc00114761c>] watchdog_timer_fn+0x254/0x290
[   36.178380] [<ffffffc0010d88c4>] __run_hrtimer+0x94/0x318
[   36.183726] [<ffffffc0010d9620>] hrtimer_interrupt+0x100/0x288
[   36.189507] [<ffffffc00164e62c>] meson_timer_interrupt+0x34/0xb0
[   36.195457] [<ffffffc001109b5c>] handle_irq_event_percpu+0x8c/0x2d8
[   36.201667] [<ffffffc001109df8>] handle_irq_event+0x50/0x80
[   36.207187] [<ffffffc00110d454>] handle_fasteoi_irq+0xa4/0x148
[   36.212965] [<ffffffc001109094>] generic_handle_irq+0x3c/0x58
[   36.218658] [<ffffffc001084538>] handle_IRQ+0x50/0xd0
[   36.223660] [<ffffffc001081400>] gic_handle_irq+0x48/0x88
[   36.229006] Exception stack(0xffffffc05d0eb470 to 0xffffffc05d0eb590)
[   36.235390] b460:                                     01ed3000 ffffffc0 000003e8 00000000
[   36.243499] b480: 5d0eb5b0 ffffffc0 0164e3bc ffffffc0 027495b1 00000000 000f4240 00000000
[   36.251606] b4a0: 00002710 00000000 01624cf8 ffffffc0 00000000 00000000 00000000 00000000
[   36.259713] b4c0: 0000035d 00000000 00000001 00000000 00000013 00000000 043bacc0 ffffff80
[   36.267821] b4e0: 00000001 00000000 ffffffff 00000000 73871a50 ffffffc0 00000260 00000000
[   36.275928] b500: 00000013 00000000 00000000 00000000 cb012c71 00000000 7376e55b 00000000
[   36.284036] b520: 00000001 00000000 01ed3000 ffffffc0 000003e8 00000000 027491d3 00000000
[   36.292143] b540: 0000005a 00000000 000076c0 00000000 00418958 00000000 5d0eb750 ffffffc0
[   36.300251] b560: 96000045 00000000 01dc3000 ffffffc0 5d06c000 ffffffc0 5d0eb5b0 ffffffc0
[   36.308357] b580: 013f2ae0 ffffffc0 5d0eb5b0 ffffffc0
[   36.313360] [<ffffffc001083dac>] el1_irq+0x6c/0xd8
[   36.318107] [<ffffffc0013f2ae0>] __delay+0x40/0x88
[   36.322848] [<ffffffc0013f2b50>] __const_udelay+0x28/0x30
[   36.328196] [<ffffffc0018def3c>] panic+0x1fc/0x208
[   36.332939] [<ffffffc0010b29e4>] do_exit+0xa14/0xa18
[   36.337855] [<ffffffc001089128>] die+0x190/0x1a8
[   36.342427] [<ffffffc0018ded30>] __do_kernel_fault.part.1+0x7c/0x8c
[   36.348637] [<ffffffc001095044>] do_page_fault+0x35c/0x360
[   36.354071] [<ffffffc001095110>] do_translation_fault+0xc8/0xf8
[   36.359935] [<ffffffc001081240>] do_mem_abort+0x50/0xa8
[   36.365109] Exception stack(0xffffffc05d0eb9a0 to 0xffffffc05d0ebac0)
[   36.371494] b9a0: 01dc38b8 ffffffc0 5d0ebbb0 ffffffc0 5d0ebb60 ffffffc0 0138c8d8 ffffffc0
[   36.379601] b9c0: 00000000 00000000 00000000 00000000 00000000 00000000 000000d0 00000000
[   36.387708] b9e0: 738bc780 ffffffc0 01dd8780 ffffffc0 01dd9888 ffffffc0 00000000 00000000
[   36.395816] ba00: 00000000 00000000 5d015c8c ffffffc0 00000000 00000000 00000050 00000050
[   36.403924] ba20: 00000141 ffffffc0 5d236400 ffffffc0 00000000 00000100 01dd9888 ffffffc0
[   36.412031] ba40: 00000000 00000000 5d0ebbb0 ffffffc0 00000000 00000000 00000000 00000000
[   36.420138] ba60: 00000000 00000000 00000000 00000000 01de4000 ffffffc0 00000000 00000000
[   36.428246] ba80: 42438f90 ffffff80 00000000 00000000 01010101 01010101 0000002b 00000000
[   36.436353] baa0: 00000038 00000000 00000038 00000000 ffffffff 0fffffff 00000000 00000000
[   36.444460] [<ffffffc001083c30>] el1_da+0x20/0x74
[   36.449117] [<ffffffc00138cf18>] crypto_unregister_alg+0x40/0xd0
[   36.455070] [<ffffffc001392e38>] crypto_unregister_ahash+0x20/0x30
[   36.461195] [<ffffffc0017542c4>] aml_sha_probe+0x2a4/0x460
[   36.466627] [<ffffffc0014e0f3c>] platform_drv_probe+0x2c/0x68
[   36.472319] [<ffffffc0014def40>] really_probe+0x78/0x230
[   36.477580] [<ffffffc0014df224>] __driver_attach+0xb4/0xb8
[   36.483014] [<ffffffc0014dd088>] bus_for_each_dev+0x70/0xb0
[   36.488534] [<ffffffc0014dea00>] driver_attach+0x30/0x40
[   36.493795] [<ffffffc0014de5e8>] bus_add_driver+0x160/0x218
[   36.499315] [<ffffffc0014df9e0>] driver_register+0x68/0x128
[   36.504836] [<ffffffc0014e0f00>] __platform_driver_register+0x70/0x80
[   36.511219] [<ffffffc001c50774>] aml_sha_driver_init+0x18/0x20
[   36.516996] [<ffffffc001081694>] do_one_initcall+0xdc/0x140
[   36.522517] [<ffffffc001c189d4>] kernel_init_freeable+0x198/0x238
[   36.528554] [<ffffffc0018dd9d0>] kernel_init+0x20/0xe0
[   36.533641] ---[ end trace f04c75565209f21a ]---

Koxx
Posts: 103
Joined: Tue Jun 16, 2015 6:04 am
languages_spoken: english, french
ODROIDs: C1
Has thanked: 0
Been thanked: 1 time
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by Koxx »

Hi,
nothing new on the subject ?

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

Koxx wrote:Hi,
nothing new on the subject ?
I was hoping to get back to this at some stage but I suspect that even if it can be made to work performance may be lacking, I would love to know.

I did find some ways to improve crypto performance using alternatives and I have some other things to try...

- Compile openssl with 5.4.1 version or later of gcc and specify the following environment variable to specifically target C2 architecture. This is what I have used using gcc 6.2.0....

export CFLAGS="-mtune=cortex-a53 -march=armv8-a -mcpu=cortex-a53+crc+fp+simd"

- Enable in kernel config and recompile kernel will improve some arm64 crypto functions by using NEON instructions.

Code: Select all

config CRYPTO_AES_ARM64_NEON_BLK
	tristate "AES in ECB/CBC/CTR/XTS modes using NEON instructions"
	depends on ARM64 && KERNEL_MODE_NEON
	select CRYPTO_BLKCIPHER
	select CRYPTO_AES
	select CRYPTO_SIMD
- Attempt to use upstream kernel which has some new support for arm64 crypto including the following drivers (can maybe try to backport to our old kernel)...

Code: Select all

config CRYPTO_SHA256_ARM64
	tristate "SHA-224/SHA-256 digest algorithm for arm64"
	select CRYPTO_HASH

config CRYPTO_SHA512_ARM64
	tristate "SHA-384/SHA-512 digest algorithm for arm64"
	select CRYPTO_HASH
- Attempt to use amlogic driver found here to enable an alternative to cyptodev to to see if it helps get any of the amlogic crypto hardware drivers we have tried working.

http://openlinux.amlogic.com:8000/downl ... 145.tar.gz

Edit: This also looks interesting there is much happening in various area's :) ...

https://www.spinics.net/lists/arm-kernel/msg553564.html

2nd Edit: info on the full patchset for 4.11 which excites me :D

https://www.spinics.net/lists/arm-kernel/msg553558.html

r4w
Posts: 6
Joined: Fri Nov 16, 2018 2:14 am
languages_spoken: english
Location: London
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by r4w »

I'm new and a bit of outsider as I have a S905X and using Libreelec with it. I'm aware it's a very old topic, but I'm trying to understand if it's possible to use the hardware crypto engine in Libreelec in order to optimize OpenVPN speeds and cpu utilization.
I'm trying to build a Libreelec 9.0 with those kernel options:

Code: Select all

CONFIG_ARM64_CRYPTO=y
CONFIG_CRYPTO_SHA1_ARM64_CE=m
CONFIG_CRYPTO_SHA2_ARM64_CE=m
CONFIG_CRYPTO_GHASH_ARM64_CE=m
CONFIG_CRYPTO_AES_ARM64_CE=m
CONFIG_CRYPTO_AES_ARM64_CE_CCM=m
CONFIG_CRYPTO_AES_ARM64_CE_BLK=m
CONFIG_CRYPTO_AES_ARM64_NEON_BLK=m
Do I need a special compiled version of OpenSSL too or should try to use the HW crypto out of the box?
Any help is very appreciated :)

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

Those are the arm64 crypto optimizations that I suspect can be used with a cryptodev-enabled openssl, it's not the crypto engine. The crypto engine is something amlogic proprietary that nobody figured out how to enable/use yet.

r4w
Posts: 6
Joined: Fri Nov 16, 2018 2:14 am
languages_spoken: english
Location: London
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by r4w »

mad_ady wrote:Those are the arm64 crypto optimizations that I suspect can be used with a cryptodev-enabled openssl, it's not the crypto engine. The crypto engine is something amlogic proprietary that nobody figured out how to enable/use yet.
Thanks for the clarification. I'm just looking at anything that can improve the OpenSSL/OpenVPN performance, maybe the other good idea is just to recompile OpenSSL with all the optimizations.

This is the current performance using Openssl from Entware:

Code: Select all

zen:/opt # openssl speed -evp aes-128-cbc
Doing aes-128-cbc for 3s on 16 size blocks: 26849456 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 64 size blocks: 18818708 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 256 size blocks: 8512534 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 1024 size blocks: 2727534 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 8192 size blocks: 371187 aes-128-cbc's in 3.00s
OpenSSL 1.0.2l  25 May 2017
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: /home/kodi/w82/build.LibreELEC-S905.arm-8.2.4.3/toolchain/bin/armv8a-libreelec-linux-gnueabi-gcc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -march=armv8-a+crc -mabi=aapcs-linux -Wno-psabi -Wa,-mno-warn-deprecated -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -fomit-frame-pointer -Wall -pipe -Os -flto -ffat-lto-objects -march=armv8-a+crc -mtune=cortex-a53 -fuse-ld=gold -fuse-linker-plugin -flto -O3 -Wall -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -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     143676.02k   402808.47k   726402.90k   934111.98k  1013587.97k
Happy to test anything :)

mad_ady
Posts: 8835
Joined: Wed Jul 15, 2015 5:00 pm
languages_spoken: english
ODROIDs: XU4, C1+, C2, C4, N1, N2, H2, Go, Go Advance
Location: Bucharest, Romania
Has thanked: 586 times
Been thanked: 531 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by mad_ady »

You can try what was already discussed in the thread - kernel with cryptodev support and openssl with cryptodev support. If you can force openssl to use cryptodev, it should speed up openvpn as well.
Out of curiosity, what throughput are you getting for openvpn?

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

r4w wrote:
mad_ady wrote:Those are the arm64 crypto optimizations that I suspect can be used with a cryptodev-enabled openssl, it's not the crypto engine. The crypto engine is something amlogic proprietary that nobody figured out how to enable/use yet.
Thanks for the clarification. I'm just looking at anything that can improve the OpenSSL/OpenVPN performance, maybe the other good idea is just to recompile OpenSSL with all the optimizations.

This is the current performance using Openssl from Entware:

Code: Select all

zen:/opt # openssl speed -evp aes-128-cbc
Doing aes-128-cbc for 3s on 16 size blocks: 26849456 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 64 size blocks: 18818708 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 256 size blocks: 8512534 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 1024 size blocks: 2727534 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 8192 size blocks: 371187 aes-128-cbc's in 3.00s
OpenSSL 1.0.2l  25 May 2017
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: /home/kodi/w82/build.LibreELEC-S905.arm-8.2.4.3/toolchain/bin/armv8a-libreelec-linux-gnueabi-gcc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -march=armv8-a+crc -mabi=aapcs-linux -Wno-psabi -Wa,-mno-warn-deprecated -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -fomit-frame-pointer -Wall -pipe -Os -flto -ffat-lto-objects -march=armv8-a+crc -mtune=cortex-a53 -fuse-ld=gold -fuse-linker-plugin -flto -O3 -Wall -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -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     143676.02k   402808.47k   726402.90k   934111.98k  1013587.97k
Happy to test anything :)
Your results are much better than I have seen on the odroid c2, which kernel version is being used? Also which optional extensions are enabled on your SOC, does it include crypto in the cpu features list?

Code: Select all

brad@odroidc2:~/scpcom/linux$ cat /proc/cpuinfo | grep Features
Features        : fp asimd evtstrm crc32 cpuid
Features        : fp asimd evtstrm crc32 cpuid
Features        : fp asimd evtstrm crc32 cpuid
Features        : fp asimd evtstrm crc32 cpuid

r4w
Posts: 6
Joined: Fri Nov 16, 2018 2:14 am
languages_spoken: english
Location: London
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by r4w »

mad_ady wrote:You can try what was already discussed in the thread - kernel with cryptodev support and openssl with cryptodev support. If you can force openssl to use cryptodev, it should speed up openvpn as well.
Out of curiosity, what throughput are you getting for openvpn?
I can't see how to add cryptodev support to the kernel, outside the mentioned arm64 crypto optimizations.
I didn't test the throughput of OpenVPN as I'm still setting up the box for this purpose, I use mainly the box for what it's meant for, a media player.
I'm familiar with OpenVPN, so that's one of my next steps though.
brad wrote:
r4w wrote:
mad_ady wrote:Those are the arm64 crypto optimizations that I suspect can be used with a cryptodev-enabled openssl, it's not the crypto engine. The crypto engine is something amlogic proprietary that nobody figured out how to enable/use yet.
Thanks for the clarification. I'm just looking at anything that can improve the OpenSSL/OpenVPN performance, maybe the other good idea is just to recompile OpenSSL with all the optimizations.

This is the current performance using Openssl from Entware:

Code: Select all

zen:/opt # openssl speed -evp aes-128-cbc
Doing aes-128-cbc for 3s on 16 size blocks: 26849456 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 64 size blocks: 18818708 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 256 size blocks: 8512534 aes-128-cbc's in 3.00s
Doing aes-128-cbc for 3s on 1024 size blocks: 2727534 aes-128-cbc's in 2.99s
Doing aes-128-cbc for 3s on 8192 size blocks: 371187 aes-128-cbc's in 3.00s
OpenSSL 1.0.2l  25 May 2017
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: /home/kodi/w82/build.LibreELEC-S905.arm-8.2.4.3/toolchain/bin/armv8a-libreelec-linux-gnueabi-gcc -I. -I.. -I../include  -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -D_REENTRANT -DDSO_DLFCN -DHAVE_DLFCN_H -march=armv8-a+crc -mabi=aapcs-linux -Wno-psabi -Wa,-mno-warn-deprecated -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -fomit-frame-pointer -Wall -pipe -Os -flto -ffat-lto-objects -march=armv8-a+crc -mtune=cortex-a53 -fuse-ld=gold -fuse-linker-plugin -flto -O3 -Wall -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -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     143676.02k   402808.47k   726402.90k   934111.98k  1013587.97k
Happy to test anything :)
Your results are much better than I have seen on the odroid c2, which kernel version is being used? Also which optional extensions are enabled on your SOC, does it include crypto in the cpu features list?

Code: Select all

brad@odroidc2:~/scpcom/linux$ cat /proc/cpuinfo | grep Features
Features        : fp asimd evtstrm crc32 cpuid
Features        : fp asimd evtstrm crc32 cpuid
Features        : fp asimd evtstrm crc32 cpuid
Features        : fp asimd evtstrm crc32 cpuid
The kernel I'm trying to compile comes from Libreelec 9.0 Development for Amlogic, Kernel version is Linux/arm 3.14.29.
I'm currently running 8.4.2.1 on my box, but it should still be 3.14.x something, I'll confirm it tonight.

If I remember correctly, my CPU features shows an AES flag too, I'll provide an output later.

r4w
Posts: 6
Joined: Fri Nov 16, 2018 2:14 am
languages_spoken: english
Location: London
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by r4w »

My current kernel is:

Linux zen 3.14.29 #1 SMP Sun Jun 17 23:35:26 AWST 2018 aarch64 GNU/Linux

CPU info:

Code: Select all

zen:~ # cat /proc/cpuinfo
Processor       : AArch64 Processor rev 4 (aarch64)
processor       : 0
processor       : 1
processor       : 2
processor       : 3
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 wp half thumb fastmult vfp edsp neon vfpv3 tlsi vfpv4 idiva idivt
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : Amlogic
Serial          : 210a8200b77a086d0db9509363f0a710
Revision        : 020a

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

r4w wrote:My current kernel is:

Linux zen 3.14.29 #1 SMP Sun Jun 17 23:35:26 AWST 2018 aarch64 GNU/Linux

CPU info:

Code: Select all

zen:~ # cat /proc/cpuinfo
Processor       : AArch64 Processor rev 4 (aarch64)
processor       : 0
processor       : 1
processor       : 2
processor       : 3
Features        : fp asimd evtstrm aes pmull sha1 sha2 crc32 wp half thumb fastmult vfp edsp neon vfpv3 tlsi vfpv4 idiva idivt
CPU implementer : 0x41
CPU architecture: 8
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : Amlogic
Serial          : 210a8200b77a086d0db9509363f0a710
Revision        : 020a
The cpu cores include all the bells and whistles for aarch64 crypto features. I had some improvements (even on the C2's A53's with only asimd no crypto) to optimise the openssl compile to force to A53 core and specific features for C2. Later versions of gcc (7 / 8) should do this well by default anyway if compiled natively.

The Linux mainline kernel (although still in development for amlogic machines) has some major improvements for aarch64 crypto including a number of new drivers which can be enabled when building the kernel.

I never got the amlogic hardware crypto device to work in the S905 C2 soc, I tried using an amlogic driver version that was once working on the S805 32 bit cpu's and got the driver to compile and load on the 3.14 aarch64 but it would fail trying to use it. It still intrigues me if it could be made to work as it has access to nice size registers on aarch64.

Lastly there is some code floating around for various crypto coins which allows running larger algorithms on the Mali gpu (it has access to the neon, fp, asimd and maybe crypto features as well)

r4w
Posts: 6
Joined: Fri Nov 16, 2018 2:14 am
languages_spoken: english
Location: London
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by r4w »

brad wrote: The cpu cores include all the bells and whistles for aarch64 crypto features. I had some improvements (even on the C2's A53's with only asimd no crypto) to optimise the openssl compile to force to A53 core and specific features for C2. Later versions of gcc (7 / 8) should do this well by default anyway if compiled natively.

The Linux mainline kernel (although still in development for amlogic machines) has some major improvements for aarch64 crypto including a number of new drivers which can be enabled when building the kernel.

I never got the amlogic hardware crypto device to work in the S905 C2 soc, I tried using an amlogic driver version that was once working on the S805 32 bit cpu's and got the driver to compile and load on the 3.14 aarch64 but it would fail trying to use it. It still intrigues me if it could be made to work as it has access to nice size registers on aarch64.

Lastly there is some code floating around for various crypto coins which allows running larger algorithms on the Mali gpu (it has access to the neon, fp, asimd and maybe crypto features as well)
That's all very interesting. Do you think that using the cryptodev kernel module would help me to improve the performance? Otherwise, I can try the GPU way as long as the crypto algorithms are compatible with OpenVPN (while cbc should have acceptable performance, I'm interested to see if I can improve AES-GCM). I'm going to try to compile cryptodev with the libreelec toolchain and see what I get from it.

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

r4w wrote: That's all very interesting. Do you think that using the cryptodev kernel module would help me to improve the performance? Otherwise, I can try the GPU way as long as the crypto algorithms are compatible with OpenVPN (while cbc should have acceptable performance, I'm interested to see if I can improve AES-GCM). I'm going to try to compile cryptodev with the libreelec toolchain and see what I get from it.
It would be interesting to see if cryptodev worked with 3.14.y and the amlogic hardware module. If it was working could test some differences between amlogic hardware crypto device and the arm cpu core features (or utilise both). You would need to get the amlogic driver module loaded firstly (I recall I had issues here trying to work out how to reconfigure it for devicetree)

I'm not exactly sure if the Mali in the LibreELEC would support OpenCL (compute on GPU), or it would be possible to produce drivers for "data transit" purposes on a GPU such as for VPN. The GPU would be more useful for batch operations in parallel rather than the stream of a single data connection.

Looks like board has some support in mainline but no support for the amlogic crypto device - http://linux-meson.com/doku.php

A new mainline kernel might show some benefits though as work has been done for aarch64 and crypto. Below is the current compatible drivers for the aarch64 features in mainline, some might only work/ perform well with A57 cores rather than A53 cores. I do notice "GHASH/AES-GCM using ARMv8 Crypto Extensions" is listed.

https://git.kernel.org/pub/scm/linux/ke ... to/Kconfig

r4w
Posts: 6
Joined: Fri Nov 16, 2018 2:14 am
languages_spoken: english
Location: London
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by r4w »

brad wrote: It would be interesting to see if cryptodev worked with 3.14.y and the amlogic hardware module. If it was working could test some differences between amlogic hardware crypto device and the arm cpu core features (or utilise both). You would need to get the amlogic driver module loaded firstly (I recall I had issues here trying to work out how to reconfigure it for devicetree)

I'm not exactly sure if the Mali in the LibreELEC would support OpenCL (compute on GPU), or it would be possible to produce drivers for "data transit" purposes on a GPU such as for VPN. The GPU would be more useful for batch operations in parallel rather than the stream of a single data connection.

Looks like board has some support in mainline but no support for the amlogic crypto device - http://linux-meson.com/doku.php

A new mainline kernel might show some benefits though as work has been done for aarch64 and crypto. Below is the current compatible drivers for the aarch64 features in mainline, some might only work/ perform well with A57 cores rather than A53 cores. I do notice "GHASH/AES-GCM using ARMv8 Crypto Extensions" is listed.

https://git.kernel.org/pub/scm/linux/ke ... to/Kconfig
I have decided to give armbian a go to see how kernel 4.19 performs and I don't see any notable differences between that and kernel 3.14 (outside I can't get the wireless to work).
However, this is a preliminary test over the 100Mbit interface with AES-128-CBC:

Code: Select all

slatini:~ slatini$ iperf3 -c 192.168.224.1 -t 10 -p 5201
Connecting to host 192.168.224.1, port 5201
[  5] local 192.168.224.10 port 57750 connected to 192.168.224.1 port 5201
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-1.00   sec  3.01 MBytes  25.3 Mbits/sec
[  5]   1.00-2.00   sec  7.50 MBytes  62.9 Mbits/sec
[  5]   2.00-3.00   sec  9.08 MBytes  76.2 Mbits/sec
[  5]   3.00-4.00   sec  9.02 MBytes  75.7 Mbits/sec
[  5]   4.00-5.00   sec  9.62 MBytes  80.7 Mbits/sec
[  5]   5.00-6.00   sec  8.83 MBytes  74.0 Mbits/sec
[  5]   6.00-7.00   sec  9.37 MBytes  78.6 Mbits/sec
[  5]   7.00-8.00   sec  8.94 MBytes  75.0 Mbits/sec
[  5]   8.00-9.00   sec  9.61 MBytes  80.6 Mbits/sec
[  5]   9.00-10.00  sec  9.02 MBytes  75.6 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.00  sec  84.0 MBytes  70.5 Mbits/sec                  sender
[  5]   0.00-10.00  sec  83.9 MBytes  70.4 Mbits/sec                  receiver
I have tried 4 and 8 streams, maximum I have seen was 79Mbit.
CPU utilization was around 50% for the OpenVPN process (OpenVPN 2.4.4). Client is running OpenVPN 2.4.6 on a Mac.
I'm still running some tests but I think it would be acceptable for me to get a S912 device (so more cores available and a gigabit interface) to build a micro-server.

audiotechguy
Posts: 160
Joined: Sat Apr 09, 2016 2:49 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by audiotechguy »

So what’s the final result, is the C2 able to use hardware encryption for Linux with full disk encryption for example, either on GPU acceleration or some other way ?


Sent from my iPhone using Tapatalk

brad
Posts: 1351
Joined: Tue Mar 29, 2016 1:22 pm
languages_spoken: english
ODROIDs: C2 N1 N2 N2+ H2 H2+ (64 bit ftw)
Location: Australia
Has thanked: 114 times
Been thanked: 167 times
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by brad »

audiotechguy wrote:So what’s the final result, is the C2 able to use hardware encryption for Linux with full disk encryption for example, either on GPU acceleration or some other way ?
Unfortunately not, all it can do is use the neon and floating point features of the A52 cores as far as I know. I tried to get the amlogic crypto driver working but had no luck at the time.

The benchmarks posted above for the later S905X based LibreElec board were much better than the C2 (this SOC has arm crypto extensions enabled on the 4 x A53 cores) but still none of the SOC's have the Amlogic crypto module with a working driver as far as i'm aware.

In regards to using C2's Mali - 450 GPU for encryption I don't think so but higher speced Mali GPU's with compute libraries exposed maybe.

audiotechguy
Posts: 160
Joined: Sat Apr 09, 2016 2:49 pm
languages_spoken: english
Has thanked: 0
Been thanked: 0
Contact:

Re: Checking that the HW Crypto engine is used on the C2

Post by audiotechguy »

One of my main interests are I know that the odroid c2 emmc is around 100mb/s read and write, my question was with LUKS then what is the read and write speed of the EMMC of the C2 and also Cpu load in general from not having AES accelerator on the hardware, I’m not too familiar with other stats of encryption speed.


Sent from my iPhone using Tapatalk

Post Reply

Return to “Ubuntu”

Who is online

Users browsing this forum: No registered users and 2 guests