webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
Classes | Macros | Enumerations | Functions | Variables
srtp.c File Reference
#include "srtp.h"
#include "srtp_priv.h"
#include "crypto_types.h"
#include "err.h"
#include "ekt.h"
#include "alloc.h"
#include <limits.h>

Classes

struct  srtp_kdf_t
 

Macros

#define octets_in_rtp_header   12
 
#define uint32s_in_rtp_header   3
 
#define octets_in_rtcp_header   8
 
#define uint32s_in_rtcp_header   2
 
#define octets_in_rtp_extn_hdr   4
 
#define MAX_SRTP_KEY_LEN   256
 

Enumerations

enum  srtp_prf_label {
  label_rtp_encryption = 0x00, label_rtp_msg_auth = 0x01, label_rtp_salt = 0x02, label_rtcp_encryption = 0x03,
  label_rtcp_msg_auth = 0x04, label_rtcp_salt = 0x05, label_rtp_header_encryption = 0x06, label_rtp_header_salt = 0x07
}
 

Functions

const char * srtp_get_version_string ()
 Returns the version string of the library. More...
 
unsigned int srtp_get_version ()
 Returns the numeric representation of the library version. More...
 
srtp_err_status_t srtp_stream_alloc (srtp_stream_ctx_t **str_ptr, const srtp_policy_t *p)
 
srtp_err_status_t srtp_stream_dealloc (srtp_stream_ctx_t *stream, srtp_stream_ctx_t *stream_template)
 
srtp_err_status_t srtp_stream_clone (const srtp_stream_ctx_t *stream_template, uint32_t ssrc, srtp_stream_ctx_t **str_ptr)
 
srtp_err_status_t srtp_stream_init_keys (srtp_stream_ctx_t *srtp, const void *key)
 
srtp_err_status_t srtp_stream_init (srtp_stream_ctx_t *srtp, const srtp_policy_t *p)
 
void srtp_event_reporter (srtp_event_data_t *data)
 
srtp_err_status_t srtp_install_event_handler (srtp_event_handler_func_t func)
 sets the event handler to the function supplied by the caller. More...
 
srtp_err_status_t srtp_protect (srtp_ctx_t *ctx, void *rtp_hdr, int *pkt_octet_len)
 
srtp_err_status_t srtp_unprotect (srtp_ctx_t *ctx, void *srtp_hdr, int *pkt_octet_len)
 
srtp_err_status_t srtp_init ()
 srtp_init() initializes the srtp library. More...
 
srtp_err_status_t srtp_shutdown ()
 srtp_shutdown() de-initializes the srtp library. More...
 
srtp_stream_ctx_tsrtp_get_stream (srtp_t srtp, uint32_t ssrc)
 
srtp_err_status_t srtp_dealloc (srtp_t session)
 srtp_dealloc() deallocates storage for an SRTP session context. More...
 
srtp_err_status_t srtp_add_stream (srtp_t session, const srtp_policy_t *policy)
 srtp_add_stream() allocates and initializes an SRTP stream within a given SRTP session. More...
 
srtp_err_status_t srtp_create (srtp_t *session, const srtp_policy_t *policy)
 srtp_create() allocates and initializes an SRTP session. More...
 
srtp_err_status_t srtp_remove_stream (srtp_t session, uint32_t ssrc)
 
srtp_err_status_t srtp_update (srtp_t session, const srtp_policy_t *policy)
 srtp_update() udpates all streams in the session. More...
 
srtp_err_status_t srtp_update_stream (srtp_t session, const srtp_policy_t *policy)
 srtp_update_stream() udpates a SRTP stream. More...
 
void srtp_crypto_policy_set_rtp_default (srtp_crypto_policy_t *p)
 srtp_crypto_policy_set_rtp_default() sets a crypto policy structure to the SRTP default policy for RTP protection. More...
 
void srtp_crypto_policy_set_rtcp_default (srtp_crypto_policy_t *p)
 srtp_crypto_policy_set_rtcp_default() sets a crypto policy structure to the SRTP default policy for RTCP protection. More...
 
void srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32 (srtp_crypto_policy_t *p)
 srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32() sets a crypto policy structure to a short-authentication tag policy More...
 
void srtp_crypto_policy_set_aes_cm_128_null_auth (srtp_crypto_policy_t *p)
 srtp_crypto_policy_set_aes_cm_128_null_auth() sets a crypto policy structure to an encryption-only policy More...
 
void srtp_crypto_policy_set_null_cipher_hmac_sha1_80 (srtp_crypto_policy_t *p)
 srtp_crypto_policy_set_null_cipher_hmac_sha1_80() sets a crypto policy structure to an authentication-only policy More...
 
void srtp_crypto_policy_set_null_cipher_hmac_null (srtp_crypto_policy_t *p)
 srtp_crypto_policy_set_null_cipher_hmac_null() sets a crypto policy structure to use no encryption or authentication. More...
 
void srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80 (srtp_crypto_policy_t *p)
 srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80() sets a crypto policy structure to a encryption and authentication policy using AES-256 for RTP protection. More...
 
void srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32 (srtp_crypto_policy_t *p)
 srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32() sets a crypto policy structure to a short-authentication tag policy using AES-256 encryption. More...
 
void srtp_crypto_policy_set_aes_cm_256_null_auth (srtp_crypto_policy_t *p)
 srtp_crypto_policy_set_aes_cm_256_null_auth() sets a crypto policy structure to an encryption-only policy More...
 
srtp_err_status_t srtp_protect_rtcp (srtp_t ctx, void *rtcp_hdr, int *pkt_octet_len)
 srtp_protect_rtcp() is the Secure RTCP sender-side packet processing function. More...
 
srtp_err_status_t srtp_unprotect_rtcp (srtp_t ctx, void *srtcp_hdr, int *pkt_octet_len)
 srtp_unprotect_rtcp() is the Secure RTCP receiver-side packet processing function. More...
 
void srtp_set_user_data (srtp_t ctx, void *data)
 srtp_set_user_data() stores the given pointer into the SRTP session for later retrieval. More...
 
voidsrtp_get_user_data (srtp_t ctx)
 srtp_get_user_data() retrieves the pointer to the custom data previously stored with srtp_set_user_data(). More...
 
srtp_err_status_t srtp_crypto_policy_set_from_profile_for_rtp (srtp_crypto_policy_t *policy, srtp_profile_t profile)
 srtp_crypto_policy_set_from_profile_for_rtp() sets a crypto policy structure to the appropriate value for RTP based on an srtp_profile_t More...
 
srtp_err_status_t srtp_crypto_policy_set_from_profile_for_rtcp (srtp_crypto_policy_t *policy, srtp_profile_t profile)
 srtp_crypto_policy_set_from_profile_for_rtcp() sets a crypto policy structure to the appropriate value for RTCP based on an srtp_profile_t More...
 
void srtp_append_salt_to_key (uint8_t *key, unsigned int bytes_in_key, uint8_t *salt, unsigned int bytes_in_salt)
 appends the salt to the key More...
 
unsigned int srtp_profile_get_master_key_length (srtp_profile_t profile)
 returns the master key length for a given SRTP profile More...
 
unsigned int srtp_profile_get_master_salt_length (srtp_profile_t profile)
 returns the master salt length for a given SRTP profile More...
 
srtp_err_status_t srtp_set_debug_module (char *mod_name, int v)
 srtp_set_debug_module(mod_name, v) More...
 
srtp_err_status_t srtp_list_debug_modules (void)
 srtp_list_debug_modules() outputs a list of debugging modules More...
 

Variables

srtp_debug_module_t mod_srtp
 

Macro Definition Documentation

◆ MAX_SRTP_KEY_LEN

#define MAX_SRTP_KEY_LEN   256

◆ octets_in_rtcp_header

#define octets_in_rtcp_header   8

◆ octets_in_rtp_extn_hdr

#define octets_in_rtp_extn_hdr   4

◆ octets_in_rtp_header

#define octets_in_rtp_header   12

◆ uint32s_in_rtcp_header

#define uint32s_in_rtcp_header   2

◆ uint32s_in_rtp_header

#define uint32s_in_rtp_header   3

Enumeration Type Documentation

◆ srtp_prf_label

Enumerator
label_rtp_encryption 
label_rtp_msg_auth 
label_rtp_salt 
label_rtcp_encryption 
label_rtcp_msg_auth 
label_rtcp_salt 
label_rtp_header_encryption 
label_rtp_header_salt 

Function Documentation

◆ srtp_event_reporter()

void srtp_event_reporter ( srtp_event_data_t data)

◆ srtp_get_stream()

srtp_stream_ctx_t* srtp_get_stream ( srtp_t  srtp,
uint32_t  ssrc 
)

◆ srtp_protect()

srtp_err_status_t srtp_protect ( srtp_ctx_t ctx,
void rtp_hdr,
int *  pkt_octet_len 
)

◆ srtp_remove_stream()

srtp_err_status_t srtp_remove_stream ( srtp_t  session,
uint32_t  ssrc 
)

◆ srtp_stream_alloc()

srtp_err_status_t srtp_stream_alloc ( srtp_stream_ctx_t **  str_ptr,
const srtp_policy_t p 
)

◆ srtp_stream_clone()

srtp_err_status_t srtp_stream_clone ( const srtp_stream_ctx_t stream_template,
uint32_t  ssrc,
srtp_stream_ctx_t **  str_ptr 
)

◆ srtp_stream_dealloc()

srtp_err_status_t srtp_stream_dealloc ( srtp_stream_ctx_t stream,
srtp_stream_ctx_t stream_template 
)

◆ srtp_stream_init()

srtp_err_status_t srtp_stream_init ( srtp_stream_ctx_t srtp,
const srtp_policy_t p 
)

◆ srtp_stream_init_keys()

srtp_err_status_t srtp_stream_init_keys ( srtp_stream_ctx_t srtp,
const void key 
)

◆ srtp_unprotect()

srtp_err_status_t srtp_unprotect ( srtp_ctx_t ctx,
void srtp_hdr,
int *  pkt_octet_len 
)

Variable Documentation

◆ mod_srtp

Initial value:
= {
0,
"srtp"
}