diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-06-01 11:29:01 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-06-01 11:29:05 +0200 |
commit | 589d39c768f74d97ff5be9cedbaaac00aa240c6d (patch) | |
tree | 1353c9c339692a69538e13c1947d9304ac2ba527 /libavformat/rtmpdh.c | |
parent | 8939667b7087c71067a005b8473ded0e47c74259 (diff) | |
parent | 63ce9fd23cfa5ac0d9a862be0da138108dc1c505 (diff) | |
download | ffmpeg-589d39c768f74d97ff5be9cedbaaac00aa240c6d.tar.gz |
Merge commit '63ce9fd23cfa5ac0d9a862be0da138108dc1c505'
* commit '63ce9fd23cfa5ac0d9a862be0da138108dc1c505':
rtmpdh: Use GMP functions directly, instead of nettle wrappers
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/rtmpdh.c')
-rw-r--r-- | libavformat/rtmpdh.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c index 1190fdca0f..91b1349cca 100644 --- a/libavformat/rtmpdh.c +++ b/libavformat/rtmpdh.c @@ -46,8 +46,8 @@ "F71C35FDAD44CFD2D74F9208BE258FF324943328F67329C0" \ "FFFFFFFFFFFFFFFF" -#if CONFIG_NETTLE || CONFIG_GCRYPT -#if CONFIG_NETTLE +#if CONFIG_GMP || CONFIG_GCRYPT +#if CONFIG_GMP #define bn_new(bn) \ do { \ bn = av_malloc(sizeof(*bn)); \ @@ -65,12 +65,17 @@ #define bn_sub_word(bn, w) mpz_sub_ui(bn, bn, w) #define bn_cmp_1(bn) mpz_cmp_ui(bn, 1) #define bn_num_bytes(bn) (mpz_sizeinbase(bn, 2) + 7) / 8 -#define bn_bn2bin(bn, buf, len) nettle_mpz_get_str_256(len, buf, bn) +#define bn_bn2bin(bn, buf, len) \ + do { \ + memset(buf, 0, len); \ + if (bn_num_bytes(bn) <= len) \ + mpz_export(buf, NULL, 1, 1, 0, 0, bn); \ + } while (0) #define bn_bin2bn(bn, buf, len) \ do { \ bn_new(bn); \ if (bn) \ - nettle_mpz_set_str_256_u(bn, len, buf); \ + mpz_import(bn, len, 1, 1, 0, 0, buf); \ } while (0) #define bn_hex2bn(bn, buf, ret) \ do { \ |