You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
rtmpdh: Generate the whole private exponent using av_get_random_seed() with nettle/gmp
Don't use a PRNG for generating it; that defies the intended use within the cryptograhic handshake. Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
@@ -81,13 +81,15 @@
|
|||||||
ret = 1; \
|
ret = 1; \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define bn_modexp(bn, y, q, p) mpz_powm(bn, y, q, p)
|
#define bn_modexp(bn, y, q, p) mpz_powm(bn, y, q, p)
|
||||||
#define bn_random(bn, num_bits) \
|
#define bn_random(bn, num_bits) \
|
||||||
do { \
|
do { \
|
||||||
gmp_randstate_t rs; \
|
int bits = num_bits; \
|
||||||
gmp_randinit_mt(rs); \
|
mpz_set_ui(bn, 0); \
|
||||||
gmp_randseed_ui(rs, av_get_random_seed()); \
|
for (bits = num_bits; bits > 0; bits -= 32) { \
|
||||||
mpz_urandomb(bn, rs, num_bits); \
|
mpz_mul_2exp(bn, bn, 32); \
|
||||||
gmp_randclear(rs); \
|
mpz_add_ui(bn, bn, av_get_random_seed()); \
|
||||||
|
} \
|
||||||
|
mpz_fdiv_r_2exp(bn, bn, num_bits); \
|
||||||
} while (0)
|
} while (0)
|
||||||
#elif CONFIG_GCRYPT
|
#elif CONFIG_GCRYPT
|
||||||
#define bn_new(bn) bn = gcry_mpi_new(1)
|
#define bn_new(bn) bn = gcry_mpi_new(1)
|
||||||
|
Reference in New Issue
Block a user