This checks whether the ARMv8.5-A optional TRNG extensions RNDR and RNDRRS are available and, if they are, uses them for random entropy purposes.
They are nearly functionally identical to the x86 RDRAND/RDSEED extensions and are used in a similar manner.
Currently, there appears to be only one actual hardware implementation – the Amazon Graviton 3. (See the rnd
column in the link.) However, future hardware implementations may become available.
It’s not possible to directly query for the capability in userspace, but the Linux kernel added support for querying the extension via getauxval
in version 5.6 (in 2020), so this is limited to Linux-only for now.
Reviewers may want to launch any of the c7g
instances from AWS to test the Graviton 3 hardware. Alternatively, QEMU emulates these opcodes for aarch64
with CPU setting max
.
Output from Graviton 3 hardware:
0ubuntu@ip:~/bitcoin$ src/bitcoind -regtest
12023-01-06T20:01:48Z Bitcoin Core version v24.99.0-3670266ce89a (release build)
22023-01-06T20:01:48Z Using the 'arm_shani(1way,2way)' SHA256 implementation
32023-01-06T20:01:48Z Using RNDR and RNDRRS as additional entropy sources
42023-01-06T20:01:48Z Default data directory /home/ubuntu/.bitcoin
Graviton 2 (doesn’t support extensions):
0ubuntu@ip:~/bitcoin$ src/bitcoind -regtest
12023-01-06T20:05:04Z Bitcoin Core version v24.99.0-3670266ce89a (release build)
22023-01-06T20:05:04Z Using the 'arm_shani(1way,2way)' SHA256 implementation
32023-01-06T20:05:04Z Default data directory /home/ubuntu/.bitcoin
This partially closes #26796. As noted in that issue, OpenSSL added support for these extensions a little over a year ago.