0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00
Commit Graph

2 Commits

Author SHA1 Message Date
Heiko Hund
be3f20dc58 introduce base types for strong and weak RNGs
The need of having to call the assert_crypto() member function to ensure
that a cryptographically strong RNG is used where needed, was reported
as potentially insecure, since calling it manually can easily be missed.

In the commit the two new classes StrongRandomAPI and WeakRandomAPI are
introduced. They are to be used instead of just RandomAPI, unless it
doesn't matter what strength the RNG is.

All the places the assert_crypto() was called were converted to using
StrongRandomAPI instead. Also the RNGs for which assert_crypto() was not
throwing are now inheriting from StrongRandomAPI.

Variable names, which have the StrongRandomAPI type, but were called
prng, are changed to rng instead to follow the source code convention.

Signed-off-by: Heiko Hund <heiko@openvpn.net>
2023-11-22 04:49:31 +01:00
Mark Deric
8b93eb0b0a Fix randapi UBSAN bug, signed T:min map to >= 0
The undefined behavior is unary negation of T:min of a signed type
attempting to get a positive value of the same signed type.

This commit adds a unit test that exposes the original bug and well as
a fix for it.

Signed-off-by: Mark Deric <jmark@openvpn.net>
2023-08-15 07:28:35 -07:00