mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-16 14:28:34 +00:00
update to cvs head srtp
This commit is contained in:
1 parent
aad4da5b71
commit
72e2d183c1
100 files changed
+4732
-1509
No files matched your search
+11
-11
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* Copyright(c) 2001-2005 Cisco Systems, Inc.
|
||||
* Copyright(c) 2001-2006 Cisco Systems, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -47,11 +47,11 @@
|
||||
|
||||
/* single, global prng structure */
|
||||
|
||||
static x917_prng_t x917_prng;
|
||||
x917_prng_t x917_prng;
|
||||
|
||||
err_status_t
|
||||
x917_prng_init(rand_source_func_t random_source) {
|
||||
v128_t tmp_key;
|
||||
uint8_t tmp_key[16];
|
||||
err_status_t status;
|
||||
|
||||
/* initialize output count to zero */
|
||||
@@ -61,12 +61,12 @@ x917_prng_init(rand_source_func_t random_source) {
|
||||
x917_prng.rand = random_source;
|
||||
|
||||
/* initialize secret key from random source */
|
||||
status = random_source((uint8_t *)&tmp_key, 16);
|
||||
status = random_source(tmp_key, 16);
|
||||
if (status)
|
||||
return status;
|
||||
|
||||
/* expand aes key */
|
||||
aes_expand_encryption_key(&tmp_key, x917_prng.key);
|
||||
aes_expand_encryption_key(tmp_key, 16, &x917_prng.key);
|
||||
|
||||
/* initialize prng state from random source */
|
||||
status = x917_prng.rand((uint8_t *)&x917_prng.state, 16);
|
||||
@@ -80,7 +80,7 @@ err_status_t
|
||||
x917_prng_get_octet_string(uint8_t *dest, uint32_t len) {
|
||||
uint32_t t;
|
||||
v128_t buffer;
|
||||
int i, tail_len;
|
||||
uint32_t i, tail_len;
|
||||
err_status_t status;
|
||||
|
||||
/*
|
||||
@@ -99,7 +99,7 @@ x917_prng_get_octet_string(uint8_t *dest, uint32_t len) {
|
||||
t = (uint32_t)time(NULL);
|
||||
|
||||
/* loop until we have output enough data */
|
||||
for (i=0; (uint32_t)i < len/16; i++) {
|
||||
for (i=0; i < len/16; i++) {
|
||||
|
||||
/* exor time into state */
|
||||
x917_prng.state.v32[0] ^= t;
|
||||
@@ -108,7 +108,7 @@ x917_prng_get_octet_string(uint8_t *dest, uint32_t len) {
|
||||
v128_copy(&buffer, &x917_prng.state);
|
||||
|
||||
/* apply aes to buffer */
|
||||
aes_encrypt(&buffer, x917_prng.key);
|
||||
aes_encrypt(&buffer, &x917_prng.key);
|
||||
|
||||
/* write data to output */
|
||||
*dest++ = buffer.v8[0];
|
||||
@@ -132,7 +132,7 @@ x917_prng_get_octet_string(uint8_t *dest, uint32_t len) {
|
||||
buffer.v32[0] ^= t;
|
||||
|
||||
/* encrypt buffer */
|
||||
aes_encrypt(&buffer, x917_prng.key);
|
||||
aes_encrypt(&buffer, &x917_prng.key);
|
||||
|
||||
/* copy buffer into state */
|
||||
v128_copy(&x917_prng.state, &buffer);
|
||||
@@ -150,7 +150,7 @@ x917_prng_get_octet_string(uint8_t *dest, uint32_t len) {
|
||||
v128_copy(&buffer, &x917_prng.state);
|
||||
|
||||
/* apply aes to buffer */
|
||||
aes_encrypt(&buffer, x917_prng.key);
|
||||
aes_encrypt(&buffer, &x917_prng.key);
|
||||
|
||||
/* write data to output */
|
||||
for (i=0; i < tail_len; i++) {
|
||||
@@ -163,7 +163,7 @@ x917_prng_get_octet_string(uint8_t *dest, uint32_t len) {
|
||||
buffer.v32[0] ^= t;
|
||||
|
||||
/* encrypt buffer */
|
||||
aes_encrypt(&buffer, x917_prng.key);
|
||||
aes_encrypt(&buffer, &x917_prng.key);
|
||||
|
||||
/* copy buffer into state */
|
||||
v128_copy(&x917_prng.state, &buffer);
|
||||
|
||||
Reference in new issue
Block a user