00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef AVFORMAT_RTMPDH_H
00023 #define AVFORMAT_RTMPDH_H
00024
00025 #include "avformat.h"
00026 #include "config.h"
00027
00028 #if CONFIG_NETTLE || CONFIG_GCRYPT
00029 #if CONFIG_NETTLE
00030 #include <gmp.h>
00031 #include <nettle/bignum.h>
00032
00033 typedef mpz_ptr FFBigNum;
00034 #elif CONFIG_GCRYPT
00035 #include <gcrypt.h>
00036
00037 typedef gcry_mpi_t FFBigNum;
00038 #endif
00039
00040 typedef struct FF_DH {
00041 FFBigNum p;
00042 FFBigNum g;
00043 FFBigNum pub_key;
00044 FFBigNum priv_key;
00045 long length;
00046 } FF_DH;
00047
00048 #elif CONFIG_OPENSSL
00049 #include <openssl/bn.h>
00050 #include <openssl/dh.h>
00051
00052 typedef BIGNUM *FFBigNum;
00053 typedef DH FF_DH;
00054 #endif
00055
00062 FF_DH *ff_dh_init(int key_len);
00063
00069 void ff_dh_free(FF_DH *dh);
00070
00077 int ff_dh_generate_public_key(FF_DH *dh);
00078
00087 int ff_dh_write_public_key(FF_DH *dh, uint8_t *pub_key, int pub_key_len);
00088
00099 int ff_dh_compute_shared_secret_key(FF_DH *dh, const uint8_t *pub_key,
00100 int pub_key_len, uint8_t *secret_key);
00101
00102 #endif