HSE RNG performance on RDB3 SDK BSP39

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

HSE RNG performance on RDB3 SDK BSP39

802 Views
hittzt
Senior Contributor I

Hi,

 

Recently, I tested HSE rng performance based on SDK BSP39 release codes, results as following:

 

root@nxp-s32g:~# dmesg | grep hse
[ 2.242979] hse-uio 40210000.mu0b: standard firmware, version 2.22.0
[ 2.248118] hse-uio 40210000.mu0b: successfully registered device
[ 2.372888] hse 40211000.mu1b: standard firmware, version 2.22.0
[ 2.379794] hse 40211000.mu1b: registered algs sha1,hmac(sha1)
[ 2.384559] hse 40211000.mu1b: registered algs sha224,hmac(sha224)
[ 2.389713] hse 40211000.mu1b: registered algs sha256,hmac(sha256)
[ 2.394839] hse 40211000.mu1b: registered algs sha384,hmac(sha384)
[ 2.399969] hse 40211000.mu1b: registered algs sha512,hmac(sha512)
[ 2.405020] hse 40211000.mu1b: registered alg ctr(aes)
[ 2.409007] hse 40211000.mu1b: registered alg cbc(aes)
[ 2.418716] hse 40211000.mu1b: registered alg ecb(aes)
[ 2.422709] hse 40211000.mu1b: registered alg cfb(aes)
[ 2.426699] hse 40211000.mu1b: registered alg ofb(aes)
[ 2.430701] hse 40211000.mu1b: registered alg gcm(aes)
[ 2.434686] hse 40211000.mu1b: registered hwrng-hse
[ 2.438327] hse 40211000.mu1b: device ready, status 0x4B20
root@nxp-s32g:~#
root@nxp-s32g:~#
root@nxp-s32g:~# time rngtest -c 1000 < /dev/hwrng
rngtest 6.15
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...


[ 367.785712] kworker/dying (11) used greatest stack depth: 8528 bytes left
[ 739.821032] kmemleak: 24 new suspected memory leaks (see /sys/kernel/debug/kmemleak)
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 1000
rngtest: FIPS 140-2 failures: 0
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 0
rngtest: FIPS 140-2(2001-10-10) Long run: 0
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=8.984; avg=14.473; max=15.834)Kibits/s
rngtest: FIPS tests speed: (min=20.356; avg=57.682; max=59.791)Mibits/s
rngtest: Program run time: 1349844876 microseconds

real 22m29.886s
user 0m0.349s
sys 0m1.621s
root@nxp-s32g:~#
root@nxp-s32g:~#
root@nxp-s32g:~#

And to compare, I also test /dev/random performance:

root@nxp-s32g:~#
root@nxp-s32g:~# time rngtest -c 1000 < /dev/random
rngtest 6.15
Copyright (c) 2004 by Henrique de Moraes Holschuh
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

rngtest: starting FIPS tests...
rngtest: bits received from input: 20000032
rngtest: FIPS 140-2 successes: 999
rngtest: FIPS 140-2 failures: 1
rngtest: FIPS 140-2(2001-10-10) Monobit: 0
rngtest: FIPS 140-2(2001-10-10) Poker: 0
rngtest: FIPS 140-2(2001-10-10) Runs: 1
rngtest: FIPS 140-2(2001-10-10) Long run: 0
rngtest: FIPS 140-2(2001-10-10) Continuous run: 0
rngtest: input channel speed: (min=307.637; avg=681.878; max=706.425)Mibits/s
rngtest: FIPS tests speed: (min=54.033; avg=59.311; max=59.980)Mibits/s
rngtest: Program run time: 349912 microseconds

real 0m0.353s
user 0m0.317s
sys 0m0.036s
root@nxp-s32g:~#

 

The diff of time spend by these hwrng and random is too large.

Would you please help to confirm the issue?

 

Thanks,

Zhantao

0 Kudos
Reply
3 Replies

763 Views
horiageanta
NXP Employee
NXP Employee

Hi,

On the topic of comparing performance of /dev/random vs. /dev/hwrng, it's expected to have a difference of several orders of magnitude considering that:

  • /dev/random is a pseudo random number generator - it's seeded from time to time (rarely) from the kernel entropy pool; HSE RNG is one of the contributors to the pool, but it's not the only source
  • /dev/hwrng is a hardware / true random number generator - all bits extracted from it are entropy generated by HSE RNG
Tags (3)
0 Kudos
Reply

750 Views
hittzt
Senior Contributor I

Hi,

 

Yes, I know that /dev/hwrng should be one of sources of /dev/random, but I think the performance between these two device diffs too much, so I want to know what causes this difference and the real performance of HSE RNG.

 

Thanks,

Zhantao

0 Kudos
Reply

782 Views
Daniel-Aguirre
NXP TechSupport
NXP TechSupport

Hi,

For what we can see, HSE performance information seems to be confidential, can you help us opening a ticket under the NXP online services? 

We do apologize for the inconvenience.

Please, let us know.

0 Kudos
Reply