FFmpeg
Enumerations | Functions

Enumerations

enum  AVHMACType {
  AV_HMAC_MD5, AV_HMAC_SHA1, AV_HMAC_SHA224, AV_HMAC_SHA256,
  AV_HMAC_SHA384, AV_HMAC_SHA512
}
 

Functions

AVHMACav_hmac_alloc (enum AVHMACType type)
 Allocate an AVHMAC context. More...
 
void av_hmac_free (AVHMAC *ctx)
 Free an AVHMAC context. More...
 
void av_hmac_init (AVHMAC *ctx, const uint8_t *key, unsigned int keylen)
 Initialize an AVHMAC context with an authentication key. More...
 
void av_hmac_update (AVHMAC *ctx, const uint8_t *data, unsigned int len)
 Hash data with the HMAC. More...
 
int av_hmac_final (AVHMAC *ctx, uint8_t *out, unsigned int outlen)
 Finish hashing and output the HMAC digest. More...
 
int av_hmac_calc (AVHMAC *ctx, const uint8_t *data, unsigned int len, const uint8_t *key, unsigned int keylen, uint8_t *out, unsigned int outlen)
 Hash an array of data with a key. More...
 

Detailed Description

Enumeration Type Documentation

◆ AVHMACType

enum AVHMACType
Enumerator
AV_HMAC_MD5 
AV_HMAC_SHA1 
AV_HMAC_SHA224 
AV_HMAC_SHA256 
AV_HMAC_SHA384 
AV_HMAC_SHA512 

Definition at line 32 of file hmac.h.

Function Documentation

◆ av_hmac_alloc()

AVHMAC* av_hmac_alloc ( enum AVHMACType  type)

Allocate an AVHMAC context.

Parameters
typeThe hash function used for the HMAC.

Definition at line 67 of file hmac.c.

Referenced by ff_rtmp_calc_digest(), ff_srtp_set_crypto(), and main().

◆ av_hmac_free()

void av_hmac_free ( AVHMAC ctx)

Free an AVHMAC context.

Parameters
ctxThe context to free, may be NULL

Definition at line 132 of file hmac.c.

Referenced by ff_rtmp_calc_digest(), ff_srtp_free(), and main().

◆ av_hmac_init()

void av_hmac_init ( AVHMAC ctx,
const uint8_t *  key,
unsigned int  keylen 
)

Initialize an AVHMAC context with an authentication key.

Parameters
ctxThe HMAC context
keyThe authentication key
keylenThe length of the key, in bytes

Definition at line 140 of file hmac.c.

Referenced by av_hmac_calc(), ff_rtmp_calc_digest(), ff_srtp_decrypt(), and ff_srtp_encrypt().

◆ av_hmac_update()

void av_hmac_update ( AVHMAC ctx,
const uint8_t *  data,
unsigned int  len 
)

Hash data with the HMAC.

Parameters
ctxThe HMAC context
dataThe data to hash
lenThe length of the data, in bytes

Definition at line 161 of file hmac.c.

Referenced by av_hmac_calc(), ff_rtmp_calc_digest(), ff_srtp_decrypt(), and ff_srtp_encrypt().

◆ av_hmac_final()

int av_hmac_final ( AVHMAC ctx,
uint8_t *  out,
unsigned int  outlen 
)

Finish hashing and output the HMAC digest.

Parameters
ctxThe HMAC context
outThe output buffer to write the digest into
outlenThe length of the out buffer, in bytes
Returns
The number of bytes written to out, or a negative error code.

Definition at line 166 of file hmac.c.

Referenced by av_hmac_calc(), ff_rtmp_calc_digest(), ff_srtp_decrypt(), and ff_srtp_encrypt().

◆ av_hmac_calc()

int av_hmac_calc ( AVHMAC ctx,
const uint8_t *  data,
unsigned int  len,
const uint8_t *  key,
unsigned int  keylen,
uint8_t *  out,
unsigned int  outlen 
)

Hash an array of data with a key.

Parameters
ctxThe HMAC context
dataThe data to hash
lenThe length of the data, in bytes
keyThe authentication key
keylenThe length of the key, in bytes
outThe output buffer to write the digest into
outlenThe length of the out buffer, in bytes
Returns
The number of bytes written to out, or a negative error code.

Definition at line 184 of file hmac.c.

Referenced by test().