]> git.ipfire.org Git - thirdparty/openssl.git/commit
rand: implement an unbiased random integer from a range
authorPauli <pauli@openssl.org>
Wed, 25 Oct 2023 06:48:43 +0000 (17:48 +1100)
committerTomas Mraz <tomas@openssl.org>
Wed, 1 Nov 2023 11:05:28 +0000 (12:05 +0100)
commit55755fbf42ec073e86651065c5cce6f64662c9e6
tree06c35f5a1f21f79091dce9f2e0a1de4eb43bf995
parent74ff15e1a1987686812c465ee3200bc25efa0e8f
rand: implement an unbiased random integer from a range

Refer: https://github.com/apple/swift/pull/39143 for a description
of the algorithm.

It is optimal in the sense of having:

* no divisions
* minimal number of blocks of random bits from the generator

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22499)
crypto/rand/build.info
crypto/rand/rand_uniform.c [new file with mode: 0644]
include/crypto/rand.h