tkaiser
Posts: 103
Joined: Fri Aug 05, 2016 1:28 pm

BCM2837B0 and ARMv8 Crypto Extensions

Wed Mar 14, 2018 11:47 am

Does the BCM2837B0 in the meantime support ARMv8 crypto extensions? Can anyone with access to the new RPi please execute this quick test to check for this?

Code: Select all

openssl speed -elapsed -evp aes-256-cbc

User avatar
DougieLawson
Posts: 35831
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: BCM2837B0 and ARMv8 Crypto Extensions

Wed Mar 14, 2018 2:11 pm

Code: Select all

pi@hitchhiker:/root $ openssl speed -elapsed -evp aes-256-cbc
You have chosen to measure elapsed time instead of user CPU time.
Doing aes-256-cbc for 3s on 16 size blocks: 2291815 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 64 size blocks: 740776 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 256 size blocks: 198216 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 1024 size blocks: 50845 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 8192 size blocks: 6438 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 16384 size blocks: 3273 aes-256-cbc's in 3.00s
OpenSSL 1.1.0f  25 May 2017
built on: reproducible build, date unspecified
options:bn(64,32) rc4(char) des(long) aes(partial) blowfish(ptr)
compiler: gcc -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/lib/ssl\"" -DENGINESDIR="\"/usr/lib/arm-linux-gnueabihf/engines-1.1\""
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
aes-256-cbc      12223.01k    15803.22k    16914.43k    17355.09k    17580.03k    17874.94k
pi@hitchhiker:/root $
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

tkaiser
Posts: 103
Joined: Fri Aug 05, 2016 1:28 pm

Re: BCM2837B0 and ARMv8 Crypto Extensions

Wed Mar 14, 2018 2:34 pm

DougieLawson wrote:
Wed Mar 14, 2018 2:11 pm

Code: Select all

aes-256-cbc      12223.01k    15803.22k    16914.43k    17355.09k    17580.03k    17874.94k
Thank you! But I fear there's something wrong since my RPi 3 reported the following a while ago (with Jessie back then but the openssl stuff is nothing where OS or compiler version should have a significant impact):

Code: Select all

aes-256-cbc      27073.50k    35401.37k    38504.70k    39369.39k    39616.51k
I wonder how the output of the following looks like directly after execution of the openssl bench?

Code: Select all

vcgencmd measure_clock arm | awk -F"=" '{printf ("%0.0f",$2/1000000); }'
perl -e "printf \"%19b\n\", $(vcgencmd get_throttled | cut -f2 -d=)"
To me it looks like you were frequency capped (600 MHz). Possible?

BTW: With ARMv8 crypto extensions an A53 running at 1.3 GHz for example should show something like this

Code: Select all

aes-256-cbc     145928.50k   337163.26k   498586.20k   577371.48k   605145.77k

User avatar
manuti
Posts: 21
Joined: Mon Jan 09, 2012 1:52 pm
Location: Spain
Contact: Website Twitter

Re: BCM2837B0 and ARMv8 Crypto Extensions

Wed Mar 14, 2018 2:47 pm

DougieLawson wrote:
Wed Mar 14, 2018 2:11 pm
Hi, can you share the output from:

Code: Select all

uname -a
lsb_release -a
and most important:

Code: Select all

cat /proc/cpuinfo
Thanks in advance.
Raspberry para torpeshttp:/raspberryparatorpes.net

User avatar
DougieLawson
Posts: 35831
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: BCM2837B0 and ARMv8 Crypto Extensions

Wed Mar 14, 2018 2:58 pm

Code: Select all

pi@hitchhiker:/root $ vcgencmd measure_clock arm | awk -F"=" '{printf ("%0.0f",$2/1000000); }'
600pi@hitchhiker:/root $ perl -e "printf \"%19b\n\", $(vcgencmd get_throttled |  -f2 -d=)"
1010000000000000000
pi@hitchhiker:/root $ uname -a
Linux hitchhiker 4.14.24-v7+ #1097 SMP Mon Mar 5 16:42:05 GMT 2018 armv7l GNU/Linux
pi@hitchhiker:/root $ lsb_release -a
No LSB modules are available.
Distributor ID: Raspbian
Description:    Raspbian GNU/Linux 9.3 (stretch)
Release:        9.3
Codename:       stretch
pi@hitchhiker:/root $ cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 1
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 2
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

processor       : 3
model name      : ARMv7 Processor rev 4 (v7l)
BogoMIPS        : 38.40
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xd03
CPU revision    : 4

Hardware        : BCM2835
Revision        : a020d3
Serial          : 000000003f3cd8c4
pi@hitchhiker:/root $
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23397
Joined: Sat Jul 30, 2011 7:41 pm

Re: BCM2837B0 and ARMv8 Crypto Extensions

Wed Mar 14, 2018 3:01 pm

AFAIK, the SoC is exactly the same as before, with some minor changes in bootcode, and the ability to clock a bit higher,. But I'll try and confirm that.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

tkaiser
Posts: 103
Joined: Fri Aug 05, 2016 1:28 pm

Re: BCM2837B0 and ARMv8 Crypto Extensions

Wed Mar 14, 2018 3:04 pm

DougieLawson wrote:
Wed Mar 14, 2018 2:58 pm

Code: Select all

pi@hitchhiker:/root $ vcgencmd measure_clock arm | awk -F"=" '{printf ("%0.0f",$2/1000000); }'
600pi@hitchhiker:/root $ perl -e "printf \"%19b\n\", $(vcgencmd get_throttled |  -f2 -d=)"
1010000000000000000
Yep, that's undervoltage:

Code: Select all

1010000000000000000
|||             |||_ under-voltage
|||             ||_ currently throttled
|||             |_ arm frequency capped
|||_ under-voltage has occurred since last reboot
||_ throttling has occurred since last reboot
|_ arm frequency capped has occurred since last reboot
So you were running just with 600 MHz since the openssl benchmark is a bit too demanding for your power supply (or the cable between Raspi and PSU). AFAIK when input voltage drops below 4.65V or something like that the firmware clocks the ARM cores down to 600 MHz.

BTW: I usually run this 'raspimon' tool we bundle with our OMV image for Raspberry Pi in parallel when doing any benchmarks. Provides a nice way to get a clue what's going on (DVFS voltages hopefully now included on the new board)

User avatar
manuti
Posts: 21
Joined: Mon Jan 09, 2012 1:52 pm
Location: Spain
Contact: Website Twitter

Re: BCM2837B0 and ARMv8 Crypto Extensions

Wed Mar 14, 2018 4:09 pm

Undervoltage and cat /proc/cpuinfo didn't show any "AES" features support
Raspberry para torpeshttp:/raspberryparatorpes.net

User avatar
HawaiianPi
Posts: 4535
Joined: Mon Apr 08, 2013 4:53 am
Location: Aloha, Oregon USA

Re: BCM2837B0 and ARMv8 Crypto Extensions

Sun Mar 18, 2018 11:23 am

This is what I got with my new 3B+ that arrived this morning.

Code: Select all

~ $ openssl speed -elapsed -evp aes-256-cbc
You have chosen to measure elapsed time instead of user CPU time.
Doing aes-256-cbc for 3s on 16 size blocks: 5486221 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 64 size blocks: 1795446 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 256 size blocks: 486934 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 1024 size blocks: 124372 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 8192 size blocks: 15646 aes-256-cbc's in 3.00s
Doing aes-256-cbc for 3s on 16384 size blocks: 7826 aes-256-cbc's in 3.00s
OpenSSL 1.1.0f  25 May 2017
built on: reproducible build, date unspecified
options:bn(64,32) rc4(char) des(long) aes(partial) blowfish(ptr)
compiler: gcc -DDSO_DLFCN -DHAVE_DLFCN_H -DNDEBUG -DOPENSSL_THREADS -DOPENSSL_NO_STATIC_ENGINE -DOPENSSL_PIC -DOPENSSL_BN_ASM_MONT -DOPENSSL_BN_ASM_GF2m -DSHA1_ASM -DSHA256_ASM -DSHA512_ASM -DAES_ASM -DBSAES_ASM -DGHASH_ASM -DECP_NISTZ256_ASM -DPOLY1305_ASM -DOPENSSLDIR="\"/usr/lib/ssl\"" -DENGINESDIR="\"/usr/lib/arm-linux-gnueabihf/engines-1.1\""
The 'numbers' are in 1000s of bytes per second processed.
type             16 bytes     64 bytes    256 bytes   1024 bytes   8192 bytes  16384 bytes
aes-256-cbc      29259.85k    38302.85k    41551.70k    42452.31k    42724.01k    42740.39k
Comparing my results to your older Pi3B results,

Code: Select all

type                       16 bytes     64 bytes     256 bytes    1024 bytes   8192 bytes   16384 bytes
Your Pi3B: aes-256-cbc     27073.50k    35401.37k    38504.70k    39369.39k    39616.51k
My Pi3B+: aes-256-cbc      29259.85k    38302.85k    41551.70k    42452.31k    42724.01k    42740.39k
it does seem the new model is faster.

Oh, and I got 0 (zero) for the output of the other command you asked Dougie to run.

Raspberry Pi model 3B+ (made in the UK, ordered from Newark)
Raspbian Stretch with Desktop 2018-03-13 (dist-upgraded)
Samsung 32GB EVO+ µSD card
RAVPower RP-PC002W phone charger
Monoprice Premium 3 foot long micro-USB cable (23 AWG OFC power wires).

No case. No fan. No heatsink. Ambient temp approximately 20C/68F.

Test run via SSH, but the Pi3B+ was connected to a 1080p HDMI monitor and 5GHz wireless.

I ran the test several times in rapid succession (only a few seconds between runs) and got basically the same results each time.
My mind is like a browser. 27 tabs are open, 9 aren't responding,
lots of pop-ups...and where is that annoying music coming from?

tkaiser
Posts: 103
Joined: Fri Aug 05, 2016 1:28 pm

Re: BCM2837B0 and ARMv8 Crypto Extensions

Sun Mar 18, 2018 1:20 pm

HawaiianPi wrote:
Sun Mar 18, 2018 11:23 am
Comparing my results to your older Pi3B results
Thanks a bunch. Yes, that's the exepected difference between running a Pi 3 B without under-voltage vs. a Pi 3 B+ also without under-voltage. It's 1200 MHz vs. 1400 MHz but since memory bandwidth is also important it's not a 17% percentage speed bump one could expect by looking at the cpufreq differences but less than 10% (only with the insanely inappropriate sysbench pseudo cpu benchmark one sees scores scaling linearly with cpufreq when using the same sysbench binary since this 'benchmark' is so weird).

And now imagine you would boot the BCM2837B0 with a 64-bit kernel and the BCM2837B0 would implement ARMv8 crypto extensions. Then we would talk about AES crypto stuff running magnitudes faster, at least ten times faster given the memory bandwidth issue :)

The below numbers are from a Rock64 which is conservatively clocked at just 1.3 GHz instead of the possible 1.5GHz -- I had no time yet to start implementing DVFS/cpufreq tuning):

Code: Select all

Cortex A53 freq/mode              16 bytes     64 bytes     256 bytes    1024 bytes   8192 bytes
1200 MHz 32-bit: aes-256-cbc      27073.50k    35401.37k    38504.70k    39369.39k    39616.51k
1400 MHz 32-bit: aes-256-cbc      29259.85k    38302.85k    41551.70k    42452.31k    42724.01k
1300 MHz 64-bit: aes-256-cbc     145928.50k   337163.26k   498586.20k   577371.48k   605145.77k
BTW: still no idea whether BCM2837 and BCM2837B0 implement ARMv8 Crypto Extensions or not. It would require to bring up the SoC in ARMv8/64-bit mode since otherwise modern features will be hidden. So someone wanting to give it a quick try with https://github.com/bamarni/pi64/releases ?

tkaiser
Posts: 103
Joined: Fri Aug 05, 2016 1:28 pm

Re: BCM2837B0 and ARMv8 Crypto Extensions

Sun Mar 18, 2018 1:33 pm

tkaiser wrote:
Sun Mar 18, 2018 1:20 pm
memory bandwidth
Since mentioning this... it's not always about bandwidth but often also about latency. A good way to check in detail is https://github.com/ssvb/tinymembench

Results look then like this for example: https://github.com/ssvb/tinymembench/wi ... -(BCM2836)

(but comparing old tinymembench results with freshly made ones is always dangerous since kernel and on the RPi ThreadX version and settings are important). So it would only make some sense to compare 3B and 3B+ both running with latest 4.9.80 and latest firmware and switching to performance cpufreq governor just to be sure...

Sebbb
Posts: 1
Joined: Mon Jun 25, 2018 11:28 pm

Re: BCM2837B0 and ARMv8 Crypto Extensions

Mon Jun 25, 2018 11:30 pm

Hello,

it seems you need to buy an additional license to use the Cryptography Extension of the Raspberry Pi 3

See https://static.docs.arm.com/ddi0501/f/D ... hy_trm.pdf
About the Cortex-A53 processor Cryptography Extension
The Cortex-A53 processor Cryptography Extension supports the ARMv8 Cryptography
Extensions. The Cryptography Extensions add new A64, A32, and T32 instructions to
Advanced SIMD that accelerate Advanced Encryption Standard (AES) encryption and
decryption, and the Secure Hash Algorithm (SHA) functions SHA-1, SHA-224, and SHA-256.
Note:
The optional Cryptography Extension is not included in the base product. ARM supplies the
Cryptography Extension only under an additional licence to the Cortex-A53 processor and
Advanced SIMD and Floating-point support licences.
Does anybody know if it's possible to buy those - as it's possible for the codecs?

User avatar
Gavinmc42
Posts: 3641
Joined: Wed Aug 28, 2013 3:31 am

Re: BCM2837B0 and ARMv8 Crypto Extensions

Tue Jun 26, 2018 6:48 am

I use Gentoo64 for ARMv8A/Aarch64 coding
viewtopic.php?f=54&t=188448

What does that license statement mean, is it a license for hardware or software?
If it is hardware then it is on the die or it is not.
I don't think it is like the MPEG codec license which is software.
Software can identify the cryptography instructions implemented by reading:
•ID_AA64ISAR0_EL1 in the AArch64 execution state.
Huh! :?
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 23397
Joined: Sat Jul 30, 2011 7:41 pm

Re: BCM2837B0 and ARMv8 Crypto Extensions

Tue Jun 26, 2018 7:30 am

Sebbb wrote:
Mon Jun 25, 2018 11:30 pm
Hello,

it seems you need to buy an additional license to use the Cryptography Extension of the Raspberry Pi 3

See https://static.docs.arm.com/ddi0501/f/D ... hy_trm.pdf
About the Cortex-A53 processor Cryptography Extension
The Cortex-A53 processor Cryptography Extension supports the ARMv8 Cryptography
Extensions. The Cryptography Extensions add new A64, A32, and T32 instructions to
Advanced SIMD that accelerate Advanced Encryption Standard (AES) encryption and
decryption, and the Secure Hash Algorithm (SHA) functions SHA-1, SHA-224, and SHA-256.
Note:
The optional Cryptography Extension is not included in the base product. ARM supplies the
Cryptography Extension only under an additional licence to the Cortex-A53 processor and
Advanced SIMD and Floating-point support licences.
Does anybody know if it's possible to buy those - as it's possible for the codecs?
That is licence for the HW, so you buy it then add the requisite HW to the die, so no, it cannot be added later without redeisgning the HW, which would cost about $1M Plus the licence....
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

metebalci
Posts: 1
Joined: Wed Apr 03, 2019 11:06 am

Re: BCM2837B0 and ARMv8 Crypto Extensions

Wed Apr 03, 2019 11:10 am

BCM2837 does not support sha1, sha2 and aes instructions. I checked ID_AA64ISAR0_EL1 system register through JTAG, and all of SHA2, SHA1 and AES fields are 0x0, meaning it is not implemented. On the other hand, CRC32 is implemented, CRC32 field is 0x1.

Return to “General discussion”