FFmpeg
|
#include <stdint.h>
#include <string.h>
#include "config.h"
#include "libavutil/attributes.h"
#include "libavutil/error.h"
#include "libavutil/mem.h"
#include "libavutil/random_seed.h"
#include "rtmpdh.h"
Go to the source code of this file.
Macros | |
#define | P1024 |
#define | Q1024 |
#define | MAX_BYTES 18000 |
#define | dh_new() av_mallocz(sizeof(FF_DH)) |
Functions | |
static FFBigNum | dh_generate_key (FF_DH *dh) |
static int | dh_compute_key (FF_DH *dh, FFBigNum pub_key_bn, uint32_t secret_key_len, uint8_t *secret_key) |
void | ff_dh_free (FF_DH *dh) |
Free a Diffie-Hellmann context. More... | |
static int | dh_is_valid_public_key (FFBigNum y, FFBigNum p, FFBigNum q) |
av_cold FF_DH * | ff_dh_init (int key_len) |
Initialize a Diffie-Hellmann context. More... | |
int | ff_dh_generate_public_key (FF_DH *dh) |
Generate a public key. More... | |
int | ff_dh_write_public_key (FF_DH *dh, uint8_t *pub_key, int pub_key_len) |
Write the public key into the given buffer. More... | |
int | ff_dh_compute_shared_secret_key (FF_DH *dh, const uint8_t *pub_key, int pub_key_len, uint8_t *secret_key, int secret_key_len) |
Compute the shared secret key from the private FF_DH value and the other party's public value. More... | |
RTMP Diffie-Hellmann utilities
Definition in file rtmpdh.c.
#define P1024 |
#define Q1024 |
#define dh_new | ( | ) | av_mallocz(sizeof(FF_DH)) |
|
static |
Definition at line 226 of file rtmpdh.c.
Referenced by ff_dh_generate_public_key().
|
static |
Definition at line 251 of file rtmpdh.c.
Referenced by ff_dh_compute_shared_secret_key().
void ff_dh_free | ( | FF_DH * | dh | ) |
Free a Diffie-Hellmann context.
dh | a Diffie-Hellmann context to free |
Definition at line 272 of file rtmpdh.c.
Referenced by ff_dh_init(), rtmpe_close(), test_random_shared_secret(), and test_ref_data().
|
static |
Definition at line 283 of file rtmpdh.c.
Referenced by ff_dh_compute_shared_secret_key(), and ff_dh_generate_public_key().
Initialize a Diffie-Hellmann context.
key_len | length of the key |
Definition at line 324 of file rtmpdh.c.
Referenced by ff_rtmpe_gen_pub_key(), test_random_shared_secret(), and test_ref_data().
Generate a public key.
dh | a Diffie-Hellmann context |
Definition at line 351 of file rtmpdh.c.
Referenced by ff_rtmpe_gen_pub_key(), and test_random_shared_secret().
Write the public key into the given buffer.
dh | a Diffie-Hellmann context, containing the public key to write |
pub_key | the buffer where the public key is written |
pub_key_len | the length of the buffer |
Definition at line 377 of file rtmpdh.c.
Referenced by ff_rtmpe_gen_pub_key(), test_random_shared_secret(), and test_ref_data().
int ff_dh_compute_shared_secret_key | ( | FF_DH * | dh, |
const uint8_t * | pub_key, | ||
int | pub_key_len, | ||
uint8_t * | secret_key, | ||
int | secret_key_len | ||
) |
Compute the shared secret key from the private FF_DH value and the other party's public value.
dh | a Diffie-Hellmann context, containing the private key |
pub_key | the buffer containing the public key |
pub_key_len | the length of the public key buffer |
secret_key | the buffer where the secret key is written |
secret_key_len | the length of the secret key buffer |
Definition at line 393 of file rtmpdh.c.
Referenced by ff_rtmpe_compute_secret_key(), test_random_shared_secret(), and test_ref_data().