webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
srtp_priv.h
Go to the documentation of this file.
1 /*
2  * srtp_priv.h
3  *
4  * private internal data structures and functions for libSRTP
5  *
6  * David A. McGrew
7  * Cisco Systems, Inc.
8  */
9 /*
10  *
11  * Copyright (c) 2001-2006 Cisco Systems, Inc.
12  * All rights reserved.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions
16  * are met:
17  *
18  * Redistributions of source code must retain the above copyright
19  * notice, this list of conditions and the following disclaimer.
20  *
21  * Redistributions in binary form must reproduce the above
22  * copyright notice, this list of conditions and the following
23  * disclaimer in the documentation and/or other materials provided
24  * with the distribution.
25  *
26  * Neither the name of the Cisco Systems, Inc. nor the names of its
27  * contributors may be used to endorse or promote products derived
28  * from this software without specific prior written permission.
29  *
30  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
33  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
34  * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
35  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
36  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
37  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
38  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
39  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
40  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
41  * OF THE POSSIBILITY OF SUCH DAMAGE.
42  *
43  */
44 
45 #ifndef SRTP_PRIV_H
46 #define SRTP_PRIV_H
47 
48 #include "config.h"
49 #include "srtp.h"
50 #include "rdbx.h"
51 #include "rdb.h"
52 #include "integers.h"
53 #include "cipher.h"
54 #include "auth.h"
55 #include "aes.h"
56 #include "key.h"
57 #include "crypto_kernel.h"
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 #define SRTP_VER_STRING PACKAGE_STRING
64 #define SRTP_VERSION PACKAGE_VERSION
65 
66 /*
67  * the following declarations are libSRTP internal functions
68  */
69 
70 /*
71  * srtp_get_stream(ssrc) returns a pointer to the stream corresponding
72  * to ssrc, or NULL if no stream exists for that ssrc
73  */
75 
76 
77 /*
78  * srtp_stream_init_keys(s, k) (re)initializes the srtp_stream_t s by
79  * deriving all of the needed keys using the KDF and the key k.
80  */
82 
83 /*
84  * srtp_stream_init(s, p) initializes the srtp_stream_t s to
85  * use the policy at the location p
86  */
88 
89 
90 /*
91  * libsrtp internal datatypes
92  */
93 
94 typedef enum direction_t {
98 } direction_t;
99 
100 /*
101  * an srtp_stream_t has its own SSRC, encryption key, authentication
102  * key, sequence number, and replay database
103  *
104  * note that the keys might not actually be unique, in which case the
105  * srtp_cipher_t and srtp_auth_t pointers will point to the same structures
106  */
107 
108 typedef struct srtp_stream_ctx_t_ {
123  uint8_t salt[SRTP_AEAD_SALT_LEN]; /* used with GCM mode for SRTP */
124  uint8_t c_salt[SRTP_AEAD_SALT_LEN]; /* used with GCM mode for SRTCP */
127  struct srtp_stream_ctx_t_ *next; /* linked list of streams */
129 
130 
131 /*
132  * an srtp_ctx_t holds a stream list and a service description
133  */
134 
135 typedef struct srtp_ctx_t_ {
136  struct srtp_stream_ctx_t_ *stream_list; /* linked list of streams */
137  struct srtp_stream_ctx_t_ *stream_template; /* act as template for other streams */
138  void *user_data; /* user custom data */
139 } srtp_ctx_t_;
140 
141 
142 
143 /*
144  * srtp_handle_event(srtp, srtm, evnt) calls the event handling
145  * function, if there is one.
146  *
147  * This macro is not included in the documentation as it is
148  * an internal-only function.
149  */
150 
151 #define srtp_handle_event(srtp, strm, evnt) \
152  if(srtp_event_handler) { \
153  srtp_event_data_t data; \
154  data.session = srtp; \
155  data.stream = strm; \
156  data.event = evnt; \
157  srtp_event_handler(&data); \
158 }
159 
160 #ifdef __cplusplus
161 }
162 #endif
163 
164 #endif /* SRTP_PRIV_H */
srtp_err_status_t srtp_stream_init(srtp_stream_t srtp, const srtp_policy_t *p)
srtp_cipher_t * rtp_xtn_hdr_cipher
Definition: srtp_priv.h:111
Definition: srtp_priv.h:135
DOMString p
Definition: WebCryptoAPI.idl:116
srtp_sec_serv_t rtcp_services
Definition: srtp_priv.h:118
Definition: srtp_priv.h:95
int enc_xtn_hdr_count
Definition: srtp_priv.h:126
unsigned int uint32_t
Definition: ptypes.h:105
struct srtp_stream_ctx_t_ * next
Definition: srtp_priv.h:127
struct srtp_stream_ctx_t_ * stream_list
Definition: srtp_priv.h:136
Definition: rdbx.h:85
int allow_repeat_tx
Definition: srtp_priv.h:121
direction_t direction
Definition: srtp_priv.h:120
srtp_key_limit_ctx_t * limit
Definition: srtp_priv.h:119
struct srtp_ctx_t_ srtp_ctx_t_
direction_t
Definition: srtp_priv.h:94
void * user_data
Definition: srtp_priv.h:138
srtp_cipher_t * rtp_cipher
Definition: srtp_priv.h:110
srtp_rdb_t rtcp_rdb
Definition: srtp_priv.h:117
srtp_cipher_t * rtcp_cipher
Definition: srtp_priv.h:115
Definition: ekt.h:117
Definition: rdb.h:63
srtp_ekt_stream_t ekt
Definition: srtp_priv.h:122
uint8_t salt[SRTP_AEAD_SALT_LEN]
Definition: srtp_priv.h:123
uint8_t c_salt[SRTP_AEAD_SALT_LEN]
Definition: srtp_priv.h:124
Definition: cipher.h:160
Definition: srtp_priv.h:96
unsigned char uint8_t
Definition: ptypes.h:89
srtp_sec_serv_t rtp_services
Definition: srtp_priv.h:114
struct srtp_stream_ctx_t_ * stream_template
Definition: srtp_priv.h:137
srtp_stream_t srtp_get_stream(srtp_t srtp, uint32_t ssrc)
Definition: srtp.c:2233
srtp_auth_t * rtp_auth
Definition: srtp_priv.h:112
Definition: key.h:77
srtp_err_status_t srtp_stream_init_keys(srtp_stream_t srtp, const void *key)
Definition: srtp_priv.h:108
struct srtp_stream_ctx_t_ strp_stream_ctx_t_
srtp_rdbx_t rtp_rdbx
Definition: srtp_priv.h:113
Definition: srtp_priv.h:97
srtp_sec_serv_t
srtp_sec_serv_t describes a set of security services.
Definition: srtp.h:289
srtp_auth_t * rtcp_auth
Definition: srtp_priv.h:116
represents the policy for an SRTP session.
Definition: srtp.h:395
srtp_err_status_t
Definition: srtp.h:245
#define SRTP_AEAD_SALT_LEN
Definition: srtp.h:96
CFArrayRef CFTypeRef key
Definition: AVFoundationCFSoftLinking.h:129
int * enc_xtn_hdr
Definition: srtp_priv.h:125
Definition: auth.h:130
uint32_t ssrc
Definition: srtp_priv.h:109