update to cvs head srtp

This commit is contained in:
Anthony Minessale
2013-01-17 17:59:53 -06:00
parent aad4da5b71
commit 72e2d183c1
100 changed files with 4732 additions and 1509 deletions

View File

@@ -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
@@ -49,6 +49,8 @@
#include "datatypes.h"
#include "rdbx.h" /* for xtd_seq_num_t */
#include "err.h" /* for error codes */
#include "crypto.h" /* for cipher_type_id_t */
#include "crypto_types.h" /* for values of cipher_type_id_t */
/**
@@ -86,7 +88,7 @@ typedef err_status_t (*cipher_alloc_func_t)
*/
typedef err_status_t (*cipher_init_func_t)
(void *state, const uint8_t *key, cipher_direction_t dir);
(void *state, const uint8_t *key, int key_len, cipher_direction_t dir);
/* a cipher_dealloc_func_t de-allocates a cipher_t */
@@ -108,8 +110,7 @@ typedef err_status_t (*cipher_decrypt_func_t)
(void *state, uint8_t *buffer, unsigned int *octets_to_decrypt);
/*
* a cipher_set_nonce_seq_func_t function sets both the nonce
* and the extended sequence number
* a cipher_set_iv_func_t function sets the current initialization vector
*/
typedef err_status_t (*cipher_set_iv_func_t)
@@ -147,6 +148,7 @@ typedef struct cipher_type_t {
int ref_count;
cipher_test_case_t *test_data;
debug_module_t *debug;
cipher_type_id_t id;
} cipher_type_t;
/*
@@ -169,7 +171,7 @@ typedef struct cipher_t {
#define cipher_dealloc(c) (((c)->type)->dealloc(c))
#define cipher_init(c, k, dir) (((c)->type)->init(((c)->state), (k), (dir)))
#define cipher_init(c, k, dir) (((c)->type)->init(((c)->state), (k), ((c)->key_len), (dir)))
#define cipher_encrypt(c, buf, len) \
(((c)->type)->encrypt(((c)->state), (buf), (len)))
@@ -178,7 +180,7 @@ typedef struct cipher_t {
(((c)->type)->decrypt(((c)->state), (buf), (len)))
#define cipher_set_iv(c, n) \
((c) ? (((c)->type)->set_iv(((c)->state), (n))) : \
((c) ? (((c)->type)->set_iv(((cipher_pointer_t)(c)->state), (n))) : \
err_status_no_such_op)
err_status_t
@@ -201,6 +203,16 @@ err_status_t
cipher_type_self_test(const cipher_type_t *ct);
/*
* cipher_type_test() tests a cipher against external test cases provided in
* an array of values of key/xtd_seq_num_t/plaintext/ciphertext
* that is known to be good
*/
err_status_t
cipher_type_test(const cipher_type_t *ct, const cipher_test_case_t *test_data);
/*
* cipher_bits_per_second(c, l, t) computes (and estimate of) the
* number of bits that a cipher implementation can encrypt in a second