FFmpeg
Data Structures | Functions
rtmpdh.h File Reference
#include <stdint.h>
#include "config.h"

Go to the source code of this file.

Data Structures

struct  FF_DH
 

Functions

FF_DHff_dh_init (int key_len)
 Initialize a Diffie-Hellmann context. More...
 
void ff_dh_free (FF_DH *dh)
 Free 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...
 

Function Documentation

◆ ff_dh_init()

FF_DH* ff_dh_init ( int  key_len)

Initialize a Diffie-Hellmann context.

Parameters
key_lenlength of the key
Returns
a new Diffie-Hellmann context on success, NULL otherwise

Definition at line 324 of file rtmpdh.c.

Referenced by ff_rtmpe_gen_pub_key(), test_random_shared_secret(), and test_ref_data().

◆ ff_dh_free()

void ff_dh_free ( FF_DH dh)

Free a Diffie-Hellmann context.

Parameters
dha 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().

◆ ff_dh_generate_public_key()

int ff_dh_generate_public_key ( FF_DH dh)

Generate a public key.

Parameters
dha Diffie-Hellmann context
Returns
zero on success, negative value otherwise

Definition at line 351 of file rtmpdh.c.

Referenced by ff_rtmpe_gen_pub_key(), and test_random_shared_secret().

◆ ff_dh_write_public_key()

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.

Parameters
dha Diffie-Hellmann context, containing the public key to write
pub_keythe buffer where the public key is written
pub_key_lenthe length of the buffer
Returns
zero on success, negative value otherwise

Definition at line 377 of file rtmpdh.c.

Referenced by ff_rtmpe_gen_pub_key(), test_random_shared_secret(), and test_ref_data().

◆ ff_dh_compute_shared_secret_key()

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.

Parameters
dha Diffie-Hellmann context, containing the private key
pub_keythe buffer containing the public key
pub_key_lenthe length of the public key buffer
secret_keythe buffer where the secret key is written
secret_key_lenthe length of the secret key buffer
Returns
length of the shared secret key on success, negative value otherwise

Definition at line 393 of file rtmpdh.c.

Referenced by ff_rtmpe_compute_secret_key(), test_random_shared_secret(), and test_ref_data().