diff options
Diffstat (limited to 'libavformat/rtmpdh.c')
-rw-r--r-- | libavformat/rtmpdh.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c index 0593eac943..8eb088237b 100644 --- a/libavformat/rtmpdh.c +++ b/libavformat/rtmpdh.c @@ -4,20 +4,20 @@ * Copyright (c) 2009-2010 Howard Chu * Copyright (c) 2012 Samuel Pitoiset * - * This file is part of Libav. + * This file is part of FFmpeg. * - * Libav is free software; you can redistribute it and/or + * FFmpeg is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * - * Libav is distributed in the hope that it will be useful, + * FFmpeg is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public - * License along with Libav; if not, write to the Free Software + * License along with FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ @@ -107,6 +107,33 @@ static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p) mpz_powm(bn, y, q, p); return 0; } +#elif CONFIG_GCRYPT +#define bn_new(bn) \ + do { \ + if (!gcry_control(GCRYCTL_INITIALIZATION_FINISHED_P)) { \ + if (!gcry_check_version("1.5.4")) \ + return AVERROR(EINVAL); \ + gcry_control(GCRYCTL_DISABLE_SECMEM, 0); \ + gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0); \ + } \ + bn = gcry_mpi_new(1); \ + } while (0) +#define bn_free(bn) gcry_mpi_release(bn) +#define bn_set_word(bn, w) gcry_mpi_set_ui(bn, w) +#define bn_cmp(a, b) gcry_mpi_cmp(a, b) +#define bn_copy(to, from) gcry_mpi_set(to, from) +#define bn_sub_word(bn, w) gcry_mpi_sub_ui(bn, bn, w) +#define bn_cmp_1(bn) gcry_mpi_cmp_ui(bn, 1) +#define bn_num_bytes(bn) (gcry_mpi_get_nbits(bn) + 7) / 8 +#define bn_bn2bin(bn, buf, len) gcry_mpi_print(GCRYMPI_FMT_USG, buf, len, NULL, bn) +#define bn_bin2bn(bn, buf, len) gcry_mpi_scan(&bn, GCRYMPI_FMT_USG, buf, len, NULL) +#define bn_hex2bn(bn, buf, ret) ret = (gcry_mpi_scan(&bn, GCRYMPI_FMT_HEX, buf, 0, 0) == 0) +#define bn_random(bn, num_bits) gcry_mpi_randomize(bn, num_bits, GCRY_WEAK_RANDOM) +static int bn_modexp(FFBigNum bn, FFBigNum y, FFBigNum q, FFBigNum p) +{ + gcry_mpi_powm(bn, y, q, p); + return 0; +} #elif CONFIG_OPENSSL #define bn_new(bn) bn = BN_new() #define bn_free(bn) BN_free(bn) |