mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 01:26:58 +00:00
add srtp
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1086 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
54
libs/srtp/crypto/include/prng.h
Normal file
54
libs/srtp/crypto/include/prng.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* prng.h
|
||||
*
|
||||
* pseudorandom source
|
||||
*
|
||||
* David A. McGrew
|
||||
* Cisco Systems, Inc.
|
||||
*/
|
||||
|
||||
#ifndef PRNG_H
|
||||
#define PRNG_H
|
||||
|
||||
#include "rand_source.h" /* for rand_source_func_t definition */
|
||||
#include "aes.h" /* for aes */
|
||||
#include "aes_icm.h" /* for aes ctr */
|
||||
|
||||
#define MAX_PRNG_OUT_LEN 0xffffffffU
|
||||
|
||||
/*
|
||||
* x917_prng is an ANSI X9.17-like AES-based PRNG
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
v128_t state; /* state data */
|
||||
aes_expanded_key_t key; /* secret key */
|
||||
uint32_t octet_count; /* number of octets output since last init */
|
||||
rand_source_func_t rand; /* random source for re-initialization */
|
||||
} x917_prng_t;
|
||||
|
||||
err_status_t
|
||||
x917_prng_init(rand_source_func_t random_source);
|
||||
|
||||
err_status_t
|
||||
x917_prng_get_octet_string(uint8_t *dest, uint32_t len);
|
||||
|
||||
|
||||
/*
|
||||
* ctr_prng is an AES-CTR based PRNG
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
uint32_t octet_count; /* number of octets output since last init */
|
||||
aes_icm_ctx_t state; /* state data */
|
||||
rand_source_func_t rand; /* random source for re-initialization */
|
||||
} ctr_prng_t;
|
||||
|
||||
err_status_t
|
||||
ctr_prng_init(rand_source_func_t random_source);
|
||||
|
||||
err_status_t
|
||||
ctr_prng_get_octet_string(void *dest, uint32_t len);
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user