Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: include/srtp_priv.h

Issue 2344973002: Update libsrtp to version 2.0 (Closed)
Patch Set: Add '.' back to include_dirs Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/srtp.h ('k') | include/ut_sim.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 */
74 srtp_stream_t srtp_get_stream(srtp_t srtp, uint32_t ssrc);
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 */
81 srtp_err_status_t srtp_stream_init_keys(srtp_stream_t srtp, const void *key);
82
83 /*
84 * srtp_stream_init(s, p) initializes the srtp_stream_t s to
85 * use the policy at the location p
86 */
87 srtp_err_status_t srtp_stream_init(srtp_stream_t srtp, const srtp_policy_t *p);
88
89
90 /*
91 * libsrtp internal datatypes
92 */
93
94 typedef enum direction_t {
95 dir_unknown = 0,
96 dir_srtp_sender = 1,
97 dir_srtp_receiver = 2
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_ {
109 uint32_t ssrc;
110 srtp_cipher_t *rtp_cipher;
111 srtp_cipher_t *rtp_xtn_hdr_cipher;
112 srtp_auth_t *rtp_auth;
113 srtp_rdbx_t rtp_rdbx;
114 srtp_sec_serv_t rtp_services;
115 srtp_cipher_t *rtcp_cipher;
116 srtp_auth_t *rtcp_auth;
117 srtp_rdb_t rtcp_rdb;
118 srtp_sec_serv_t rtcp_services;
119 srtp_key_limit_ctx_t *limit;
120 direction_t direction;
121 int allow_repeat_tx;
122 srtp_ekt_stream_t ekt;
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 */
125 int *enc_xtn_hdr;
126 int enc_xtn_hdr_count;
127 struct srtp_stream_ctx_t_ *next; /* linked list of streams */
128 } strp_stream_ctx_t_;
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 strea ms */
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 */
OLDNEW
« no previous file with comments | « include/srtp.h ('k') | include/ut_sim.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698