There was a misunderstanding betewen bits and bytes for the parameter
value for generating random big numbers.
---
libavformat/rtmpdh.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c
index f2deecd..e24725d 100644
--- a/libavformat/rtmpdh.c
+++ b/libavformat/rtmpdh.c
@@ -83,12 +83,12 @@
#define bn_bn2hex(bn) mpz_get_str(NULL, 16, bn)
#define bn_freestr(str) free(str)
#define bn_modexp(bn, y, q, p) mpz_powm(bn, y, q, p)
-#define bn_random(bn, num_bytes) \
+#define bn_random(bn, num_bits) \
do { \
gmp_randstate_t rs; \
gmp_randinit_mt(rs); \
gmp_randseed_ui(rs, av_get_random_seed()); \
- mpz_urandomb(bn, rs, num_bytes); \
+ mpz_urandomb(bn, rs, num_bits); \
gmp_randclear(rs); \
} while (0)
#elif CONFIG_GCRYPT
@@ -112,7 +112,7 @@ static char* bn_bn2hex(FFBigNum bn)
}
#define bn_freestr(str) free(str)
#define bn_modexp(bn, y, q, p) gcry_mpi_powm(bn, y, q, p)
-#define bn_random(bn, num_bytes) gcry_mpi_randomize(bn, num_bytes,
GCRY_WEAK_RANDOM)
+#define bn_random(bn, num_bits) gcry_mpi_randomize(bn, num_bits,
GCRY_WEAK_RANDOM)
#endif
#define MAX_BYTES 18000
@@ -130,7 +130,7 @@ static FFBigNum dh_generate_key(FF_DH *dh)
bn_new(dh->priv_key);
if (!dh->priv_key)
return NULL;
- bn_random(dh->priv_key, num_bytes);
+ bn_random(dh->priv_key, 8 * num_bytes);
bn_new(dh->pub_key);
if (!dh->pub_key) {
--
2.3.2 (Apple Git-55)
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel