-
Notifications
You must be signed in to change notification settings - Fork 212
Open
Description
The s_read_wincsp function has a size_t argument n to specify the number of random bytes to generate.
libtommath/s_mp_rand_platform.c
Line 33 in 8355b88
| static mp_err s_read_wincsp(void *p, size_t n) |
This argument blindly gets converted into a DWORD
libtommath/s_mp_rand_platform.c
Line 46 in 8355b88
| return CryptGenRandom(hProv, (DWORD)n, (BYTE *)p) == TRUE ? MP_OKAY : MP_ERR; |
According to the documentation, a DWORD stores 32-bits. However, a size_t can potentially store more than 32-bits.
For example, if someone wants to generate more than 4 GB of random data on a 64-bit system, then s_read_wincsp might silently not generate the correct amount of random data.
Metadata
Metadata
Assignees
Labels
No labels