OLD | NEW |
1 /* | 1 /* |
2 * srtp.h | 2 * srtp.h |
3 * | 3 * |
4 * interface to libsrtp | 4 * interface to libsrtp |
5 * | 5 * |
6 * David A. McGrew | 6 * David A. McGrew |
7 * Cisco Systems, Inc. | 7 * Cisco Systems, Inc. |
8 */ | 8 */ |
9 /* | 9 /* |
10 * | 10 * |
(...skipping 28 matching lines...) Expand all Loading... |
39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
41 * OF THE POSSIBILITY OF SUCH DAMAGE. | 41 * OF THE POSSIBILITY OF SUCH DAMAGE. |
42 * | 42 * |
43 */ | 43 */ |
44 | 44 |
45 | 45 |
46 #ifndef SRTP_H | 46 #ifndef SRTP_H |
47 #define SRTP_H | 47 #define SRTP_H |
48 | 48 |
| 49 #include <stdint.h> |
| 50 |
49 #ifdef __cplusplus | 51 #ifdef __cplusplus |
50 extern "C" { | 52 extern "C" { |
51 #endif | 53 #endif |
52 | 54 |
53 #include <stdint.h> | |
54 #include "crypto.h" | |
55 #include "crypto_types.h" | |
56 #include "err.h" | |
57 | |
58 /* | |
59 * Compatibility shim for v1->v2 transition. | |
60 */ | |
61 | |
62 #define srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32 \ | |
63 crypto_policy_set_aes_cm_128_hmac_sha1_32 | |
64 #define srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80 \ | |
65 crypto_policy_set_aes_cm_128_hmac_sha1_80 | |
66 #define srtp_crypto_policy_set_aes_gcm_128_16_auth \ | |
67 crypto_policy_set_aes_gcm_128_16_auth | |
68 #define srtp_crypto_policy_set_aes_gcm_256_16_auth \ | |
69 crypto_policy_set_aes_gcm_256_16_auth | |
70 | |
71 #define srtp_ssrc_type_t ssrc_type_t | |
72 | |
73 /** | 55 /** |
74 * @defgroup SRTP Secure RTP | 56 * @defgroup SRTP Secure RTP |
75 * | 57 * |
76 * @brief libSRTP provides functions for protecting RTP and RTCP. See | 58 * @brief libSRTP provides functions for protecting RTP and RTCP. See |
77 * Section @ref Overview for an introduction to the use of the library. | 59 * Section @ref Overview for an introduction to the use of the library. |
78 * | 60 * |
79 * @{ | 61 * @{ |
80 */ | 62 */ |
81 | 63 |
82 /* | 64 /* |
(...skipping 22 matching lines...) Expand all Loading... |
105 * @brief the maximum number of octets added by srtp_protect(). | 87 * @brief the maximum number of octets added by srtp_protect(). |
106 */ | 88 */ |
107 #define SRTP_MAX_TRAILER_LEN SRTP_MAX_TAG_LEN | 89 #define SRTP_MAX_TRAILER_LEN SRTP_MAX_TAG_LEN |
108 | 90 |
109 /* | 91 /* |
110 * SRTP_AEAD_SALT_LEN is the length of the SALT values used with | 92 * SRTP_AEAD_SALT_LEN is the length of the SALT values used with |
111 * GCM mode. GCM mode requires an IV. The SALT value is used | 93 * GCM mode. GCM mode requires an IV. The SALT value is used |
112 * as part of the IV formation logic applied to each RTP packet. | 94 * as part of the IV formation logic applied to each RTP packet. |
113 */ | 95 */ |
114 #define SRTP_AEAD_SALT_LEN 12 | 96 #define SRTP_AEAD_SALT_LEN 12 |
115 #define AES_128_GCM_KEYSIZE_WSALT SRTP_AEAD_SALT_LEN + 16 | 97 #define SRTP_AES_128_GCM_KEYSIZE_WSALT SRTP_AEAD_SALT_LEN + 16 |
116 #define AES_192_GCM_KEYSIZE_WSALT SRTP_AEAD_SALT_LEN + 24 | 98 #define SRTP_AES_192_GCM_KEYSIZE_WSALT SRTP_AEAD_SALT_LEN + 24 |
117 #define AES_256_GCM_KEYSIZE_WSALT SRTP_AEAD_SALT_LEN + 32 | 99 #define SRTP_AES_256_GCM_KEYSIZE_WSALT SRTP_AEAD_SALT_LEN + 32 |
| 100 |
| 101 /* |
| 102 * an srtp_hdr_t represents the srtp header |
| 103 * |
| 104 * in this implementation, an srtp_hdr_t is assumed to be 32-bit aligned |
| 105 * |
| 106 * (note that this definition follows that of RFC 1889 Appendix A, but |
| 107 * is not identical) |
| 108 */ |
| 109 |
| 110 #ifndef WORDS_BIGENDIAN |
| 111 |
| 112 /* |
| 113 * srtp_hdr_t represents an RTP or SRTP header. The bit-fields in |
| 114 * this structure should be declared "unsigned int" instead of |
| 115 * "unsigned char", but doing so causes the MS compiler to not |
| 116 * fully pack the bit fields. |
| 117 */ |
| 118 |
| 119 typedef struct { |
| 120 unsigned char cc:4;» /* CSRC count */ |
| 121 unsigned char x:1;» /* header extension flag */ |
| 122 unsigned char p:1;» /* padding flag */ |
| 123 unsigned char version:2; /* protocol version */ |
| 124 unsigned char pt:7;» /* payload type */ |
| 125 unsigned char m:1;» /* marker bit */ |
| 126 uint16_t seq;»» /* sequence number */ |
| 127 uint32_t ts;» » /* timestamp */ |
| 128 uint32_t ssrc;» /* synchronization source */ |
| 129 } srtp_hdr_t; |
| 130 |
| 131 #else /* BIG_ENDIAN */ |
| 132 |
| 133 typedef struct { |
| 134 unsigned char version:2; /* protocol version */ |
| 135 unsigned char p:1;» /* padding flag */ |
| 136 unsigned char x:1;» /* header extension flag */ |
| 137 unsigned char cc:4;» /* CSRC count */ |
| 138 unsigned char m:1;» /* marker bit */ |
| 139 unsigned char pt:7;» /* payload type */ |
| 140 uint16_t seq;»» /* sequence number */ |
| 141 uint32_t ts;» » /* timestamp */ |
| 142 uint32_t ssrc;» /* synchronization source */ |
| 143 } srtp_hdr_t; |
| 144 |
| 145 #endif |
| 146 |
| 147 typedef struct { |
| 148 uint16_t profile_specific; /* profile-specific info */ |
| 149 uint16_t length; /* number of 32-bit words in extension */ |
| 150 } srtp_hdr_xtnd_t; |
| 151 |
| 152 |
| 153 /* |
| 154 * srtcp_hdr_t represents a secure rtcp header |
| 155 * |
| 156 * in this implementation, an srtcp header is assumed to be 32-bit |
| 157 * alinged |
| 158 */ |
| 159 |
| 160 #ifndef WORDS_BIGENDIAN |
| 161 |
| 162 typedef struct { |
| 163 unsigned char rc:5;» » /* reception report count */ |
| 164 unsigned char p:1;» » /* padding flag */ |
| 165 unsigned char version:2;» /* protocol version */ |
| 166 unsigned char pt:8;» » /* payload type */ |
| 167 uint16_t len;»» » /* length */ |
| 168 uint32_t ssrc;» »/* synchronization source */ |
| 169 } srtcp_hdr_t; |
| 170 |
| 171 typedef struct { |
| 172 unsigned int index:31; /* srtcp packet index in network order! */ |
| 173 unsigned int e:1; /* encrypted? 1=yes */ |
| 174 /* optional mikey/etc go here */ |
| 175 /* and then the variable-length auth tag */ |
| 176 } srtcp_trailer_t; |
| 177 |
| 178 |
| 179 #else /* BIG_ENDIAN */ |
| 180 |
| 181 typedef struct { |
| 182 unsigned char version:2;» /* protocol version */ |
| 183 unsigned char p:1;» » /* padding flag */ |
| 184 unsigned char rc:5;» » /* reception report count */ |
| 185 unsigned char pt:8;» » /* payload type */ |
| 186 uint16_t len;»» » /* length */ |
| 187 uint32_t ssrc;» »/* synchronization source */ |
| 188 } srtcp_hdr_t; |
| 189 |
| 190 typedef struct { |
| 191 unsigned int version:2; /* protocol version */ |
| 192 unsigned int p:1; /* padding flag */ |
| 193 unsigned int count:5; /* varies by packet type */ |
| 194 unsigned int pt:8; /* payload type */ |
| 195 uint16_t length; /* len of uint32s of packet less header */ |
| 196 } rtcp_common_t; |
| 197 |
| 198 typedef struct { |
| 199 unsigned int e:1; /* encrypted? 1=yes */ |
| 200 unsigned int index:31; /* srtcp packet index */ |
| 201 /* optional mikey/etc go here */ |
| 202 /* and then the variable-length auth tag */ |
| 203 } srtcp_trailer_t; |
| 204 |
| 205 #endif |
118 | 206 |
119 | 207 |
120 | 208 |
| 209 /** |
| 210 * @brief A srtp_cipher_type_id_t is an identifier for a particular cipher |
| 211 * type. |
| 212 * |
| 213 * A srtp_cipher_type_id_t is an integer that represents a particular |
| 214 * cipher type, e.g. the Advanced Encryption Standard (AES). A |
| 215 * SRTP_NULL_CIPHER is avaliable; this cipher leaves the data unchanged, |
| 216 * and can be selected to indicate that no encryption is to take |
| 217 * place. |
| 218 * |
| 219 * @ingroup Ciphers |
| 220 */ |
| 221 typedef uint32_t srtp_cipher_type_id_t; |
| 222 |
| 223 /** |
| 224 * @brief An srtp_auth_type_id_t is an identifier for a particular authenticati
on |
| 225 * function. |
| 226 * |
| 227 * An srtp_auth_type_id_t is an integer that represents a particular |
| 228 * authentication function type, e.g. HMAC-SHA1. A SRTP_NULL_AUTH is |
| 229 * avaliable; this authentication function performs no computation, |
| 230 * and can be selected to indicate that no authentication is to take |
| 231 * place. |
| 232 * |
| 233 * @ingroup Authentication |
| 234 */ |
| 235 typedef uint32_t srtp_auth_type_id_t; |
| 236 |
| 237 /* |
| 238 * @brief srtp_err_status_t defines error codes. |
| 239 * |
| 240 * The enumeration srtp_err_status_t defines error codes. Note that the |
| 241 * value of srtp_err_status_ok is equal to zero, which can simplify error |
| 242 * checking somewhat. |
| 243 * |
| 244 */ |
| 245 typedef enum { |
| 246 srtp_err_status_ok = 0, /**< nothing to report
*/ |
| 247 srtp_err_status_fail = 1, /**< unspecified failure
*/ |
| 248 srtp_err_status_bad_param = 2, /**< unsupported parameter
*/ |
| 249 srtp_err_status_alloc_fail = 3, /**< couldn't allocate memory
*/ |
| 250 srtp_err_status_dealloc_fail = 4, /**< couldn't deallocate properly
*/ |
| 251 srtp_err_status_init_fail = 5, /**< couldn't initialize
*/ |
| 252 srtp_err_status_terminus = 6, /**< can't process as much data as requeste
d */ |
| 253 srtp_err_status_auth_fail = 7, /**< authentication failure
*/ |
| 254 srtp_err_status_cipher_fail = 8, /**< cipher failure
*/ |
| 255 srtp_err_status_replay_fail = 9, /**< replay check failed (bad index)
*/ |
| 256 srtp_err_status_replay_old = 10, /**< replay check failed (index too old)
*/ |
| 257 srtp_err_status_algo_fail = 11, /**< algorithm failed test routine
*/ |
| 258 srtp_err_status_no_such_op = 12, /**< unsupported operation
*/ |
| 259 srtp_err_status_no_ctx = 13, /**< no appropriate context found
*/ |
| 260 srtp_err_status_cant_check = 14, /**< unable to perform desired validation
*/ |
| 261 srtp_err_status_key_expired = 15, /**< can't use key any more
*/ |
| 262 srtp_err_status_socket_err = 16, /**< error in use of socket
*/ |
| 263 srtp_err_status_signal_err = 17, /**< error in use POSIX signals
*/ |
| 264 srtp_err_status_nonce_bad = 18, /**< nonce check failed
*/ |
| 265 srtp_err_status_read_fail = 19, /**< couldn't read data
*/ |
| 266 srtp_err_status_write_fail = 20, /**< couldn't write data
*/ |
| 267 srtp_err_status_parse_err = 21, /**< error parsing data
*/ |
| 268 srtp_err_status_encode_err = 22, /**< error encoding data
*/ |
| 269 srtp_err_status_semaphore_err = 23,/**< error while using semaphores
*/ |
| 270 srtp_err_status_pfkey_err = 24 /**< error while using pfkey
*/ |
| 271 } srtp_err_status_t; |
| 272 |
| 273 typedef struct srtp_stream_ctx_t_ srtp_stream_ctx_t; |
| 274 typedef struct srtp_ctx_t_ srtp_ctx_t; |
| 275 |
121 /* | 276 /* |
122 * nota bene: since libSRTP doesn't support the use of the MKI, the | 277 * nota bene: since libSRTP doesn't support the use of the MKI, the |
123 * SRTP_MAX_TRAILER_LEN value is just the maximum tag length | 278 * SRTP_MAX_TRAILER_LEN value is just the maximum tag length |
124 */ | 279 */ |
125 | 280 |
126 /** | 281 /** |
127 * @brief sec_serv_t describes a set of security services. | 282 * @brief srtp_sec_serv_t describes a set of security services. |
128 * | 283 * |
129 * A sec_serv_t enumeration is used to describe the particular | 284 * A srtp_sec_serv_t enumeration is used to describe the particular |
130 * security services that will be applied by a particular crypto | 285 * security services that will be applied by a particular crypto |
131 * policy (or other mechanism). | 286 * policy (or other mechanism). |
132 */ | 287 */ |
133 | 288 |
134 typedef enum { | 289 typedef enum { |
135 sec_serv_none = 0, /**< no services */ | 290 sec_serv_none = 0, /**< no services */ |
136 sec_serv_conf = 1, /**< confidentiality */ | 291 sec_serv_conf = 1, /**< confidentiality */ |
137 sec_serv_auth = 2, /**< authentication */ | 292 sec_serv_auth = 2, /**< authentication */ |
138 sec_serv_conf_and_auth = 3 /**< confidentiality and authentication */ | 293 sec_serv_conf_and_auth = 3 /**< confidentiality and authentication */ |
139 } sec_serv_t; | 294 } srtp_sec_serv_t; |
140 | 295 |
141 /** | 296 /** |
142 * @brief crypto_policy_t describes a particular crypto policy that | 297 * @brief srtp_crypto_policy_t describes a particular crypto policy that |
143 * can be applied to an SRTP stream. | 298 * can be applied to an SRTP stream. |
144 * | 299 * |
145 * A crypto_policy_t describes a particular cryptographic policy that | 300 * A srtp_crypto_policy_t describes a particular cryptographic policy that |
146 * can be applied to an SRTP or SRTCP stream. An SRTP session policy | 301 * can be applied to an SRTP or SRTCP stream. An SRTP session policy |
147 * consists of a list of these policies, one for each SRTP stream | 302 * consists of a list of these policies, one for each SRTP stream |
148 * in the session. | 303 * in the session. |
149 */ | 304 */ |
150 | 305 |
151 typedef struct crypto_policy_t { | 306 typedef struct srtp_crypto_policy_t { |
152 cipher_type_id_t cipher_type; /**< An integer representing | 307 srtp_cipher_type_id_t cipher_type; /**< An integer representing |
153 » » » » * the type of cipher. */ | 308 » » » » * the type of cipher. */ |
154 int cipher_key_len; /**< The length of the cipher key | 309 int cipher_key_len; /**< The length of the cipher key |
155 * in octets. */ | 310 * in octets. */ |
156 auth_type_id_t auth_type; /**< An integer representing the | 311 srtp_auth_type_id_t auth_type; /**< An integer representing the |
157 » » » » * authentication function. */ | 312 » » » » * authentication function. */ |
158 int auth_key_len; /**< The length of the authentication | 313 int auth_key_len; /**< The length of the authentication |
159 * function key in octets. */ | 314 * function key in octets. */ |
160 int auth_tag_len; /**< The length of the authentication | 315 int auth_tag_len; /**< The length of the authentication |
161 * tag in octets. */ | 316 * tag in octets. */ |
162 sec_serv_t sec_serv; /**< The flag indicating the security | 317 srtp_sec_serv_t sec_serv; /**< The flag indicating the security |
163 * services to be applied. */ | 318 * services to be applied. */ |
164 } crypto_policy_t; | 319 } srtp_crypto_policy_t; |
165 | 320 |
166 | 321 |
167 /** | 322 /** |
168 * @brief ssrc_type_t describes the type of an SSRC. | 323 * @brief srtp_ssrc_type_t describes the type of an SSRC. |
169 * | 324 * |
170 * An ssrc_type_t enumeration is used to indicate a type of SSRC. See | 325 * An srtp_ssrc_type_t enumeration is used to indicate a type of SSRC. See |
171 * @ref srtp_policy_t for more informataion. | 326 * @ref srtp_policy_t for more informataion. |
172 */ | 327 */ |
173 | 328 |
174 typedef enum { | 329 typedef enum { |
175 ssrc_undefined = 0, /**< Indicates an undefined SSRC type. */ | 330 ssrc_undefined = 0, /**< Indicates an undefined SSRC type. */ |
176 ssrc_specific = 1, /**< Indicates a specific SSRC value */ | 331 ssrc_specific = 1, /**< Indicates a specific SSRC value */ |
177 ssrc_any_inbound = 2, /**< Indicates any inbound SSRC value | 332 ssrc_any_inbound = 2, /**< Indicates any inbound SSRC value |
178 (i.e. a value that is used in the | 333 (i.e. a value that is used in the |
179 function srtp_unprotect()) */ | 334 function srtp_unprotect()) */ |
180 ssrc_any_outbound = 3 /**< Indicates any outbound SSRC value | 335 ssrc_any_outbound = 3 /**< Indicates any outbound SSRC value |
181 (i.e. a value that is used in the | 336 (i.e. a value that is used in the |
182 function srtp_protect()) */ | 337 function srtp_protect()) */ |
183 } ssrc_type_t; | 338 } srtp_ssrc_type_t; |
184 | 339 |
185 /** | 340 /** |
186 * @brief An ssrc_t represents a particular SSRC value, or a `wildcard' SSRC. | 341 * @brief An srtp_ssrc_t represents a particular SSRC value, or a `wildcard' SSR
C. |
187 * | 342 * |
188 * An ssrc_t represents a particular SSRC value (if its type is | 343 * An srtp_ssrc_t represents a particular SSRC value (if its type is |
189 * ssrc_specific), or a wildcard SSRC value that will match all | 344 * ssrc_specific), or a wildcard SSRC value that will match all |
190 * outbound SSRCs (if its type is ssrc_any_outbound) or all inbound | 345 * outbound SSRCs (if its type is ssrc_any_outbound) or all inbound |
191 * SSRCs (if its type is ssrc_any_inbound). | 346 * SSRCs (if its type is ssrc_any_inbound). |
192 * | 347 * |
193 */ | 348 */ |
194 | 349 |
195 typedef struct { | 350 typedef struct { |
196 ssrc_type_t type; /**< The type of this particular SSRC */ | 351 srtp_ssrc_type_t type; /**< The type of this particular SSRC */ |
197 unsigned int value; /**< The value of this SSRC, if it is not a wildcard */ | 352 unsigned int value; /**< The value of this SSRC, if it is not a wildcard *
/ |
198 } ssrc_t; | 353 } srtp_ssrc_t; |
199 | 354 |
200 | 355 |
201 /** | 356 /** |
202 * @brief points to an EKT policy | 357 * @brief points to an EKT policy |
203 */ | 358 */ |
204 typedef struct ekt_policy_ctx_t *ekt_policy_t; | 359 typedef struct srtp_ekt_policy_ctx_t *srtp_ekt_policy_t; |
205 | 360 |
206 | 361 |
207 /** | 362 /** |
208 * @brief points to EKT stream data | 363 * @brief points to EKT stream data |
209 */ | 364 */ |
210 typedef struct ekt_stream_ctx_t *ekt_stream_t; | 365 typedef struct srtp_ekt_stream_ctx_t *srtp_ekt_stream_t; |
211 | 366 |
212 | 367 |
213 /** | 368 /** |
214 * @brief represents the policy for an SRTP session. | 369 * @brief represents the policy for an SRTP session. |
215 * | 370 * |
216 * A single srtp_policy_t struct represents the policy for a single | 371 * A single srtp_policy_t struct represents the policy for a single |
217 * SRTP stream, and a linked list of these elements represents the | 372 * SRTP stream, and a linked list of these elements represents the |
218 * policy for an entire SRTP session. Each element contains the SRTP | 373 * policy for an entire SRTP session. Each element contains the SRTP |
219 * and SRTCP crypto policies for that stream, a pointer to the SRTP | 374 * and SRTCP crypto policies for that stream, a pointer to the SRTP |
220 * master key for that stream, the SSRC describing that stream, or a | 375 * master key for that stream, the SSRC describing that stream, or a |
(...skipping 10 matching lines...) Expand all Loading... |
231 * is intentional, and it allows libSRTP to ensure that no security | 386 * is intentional, and it allows libSRTP to ensure that no security |
232 * lapses result from accidental re-use of SSRC values during key | 387 * lapses result from accidental re-use of SSRC values during key |
233 * sharing. | 388 * sharing. |
234 * | 389 * |
235 * | 390 * |
236 * @warning The final element of the list @b must have its `next' pointer | 391 * @warning The final element of the list @b must have its `next' pointer |
237 * set to NULL. | 392 * set to NULL. |
238 */ | 393 */ |
239 | 394 |
240 typedef struct srtp_policy_t { | 395 typedef struct srtp_policy_t { |
241 ssrc_t ssrc; /**< The SSRC value of stream, or the | 396 srtp_ssrc_t ssrc; /**< The SSRC value of stream, or the |
242 * flags SSRC_ANY_INBOUND or | 397 * flags SSRC_ANY_INBOUND or |
243 * SSRC_ANY_OUTBOUND if key sharing | 398 * SSRC_ANY_OUTBOUND if key sharing |
244 * is used for this policy element. | 399 * is used for this policy element. |
245 */ | 400 */ |
246 crypto_policy_t rtp; /**< SRTP crypto policy. */ | 401 srtp_crypto_policy_t rtp; /**< SRTP crypto policy. */ |
247 crypto_policy_t rtcp; /**< SRTCP crypto policy. */ | 402 srtp_crypto_policy_t rtcp; /**< SRTCP crypto policy. */ |
248 unsigned char *key; /**< Pointer to the SRTP master key for | 403 unsigned char *key; /**< Pointer to the SRTP master key for |
249 * this stream. */ | 404 * this stream. */ |
250 ekt_policy_t ekt; /**< Pointer to the EKT policy structure | 405 srtp_ekt_policy_t ekt; /**< Pointer to the EKT policy structure |
251 * for this stream (if any) */ | 406 * for this stream (if any) */ |
252 unsigned long window_size; /**< The window size to use for replay | 407 unsigned long window_size; /**< The window size to use for replay |
253 * protection. */ | 408 * protection. */ |
254 int allow_repeat_tx; /**< Whether retransmissions of | 409 int allow_repeat_tx; /**< Whether retransmissions of |
255 * packets with the same sequence number | 410 * packets with the same sequence number |
256 * are allowed. (Note that such repeated | 411 * are allowed. (Note that such repeated |
257 * transmissions must have the same RTP | 412 * transmissions must have the same RTP |
258 * payload, or a severe security weakness | 413 * payload, or a severe security weakness |
259 * is introduced!) */ | 414 * is introduced!) */ |
260 int *enc_xtn_hdr; /**< List of header ids to encrypt. */ | 415 int *enc_xtn_hdr; /**< List of header ids to encrypt. */ |
(...skipping 10 matching lines...) Expand all Loading... |
271 * The typedef srtp_t is a pointer to a structure that represents | 426 * The typedef srtp_t is a pointer to a structure that represents |
272 * an SRTP session. This datatype is intentially opaque in | 427 * an SRTP session. This datatype is intentially opaque in |
273 * order to separate the interface from the implementation. | 428 * order to separate the interface from the implementation. |
274 * | 429 * |
275 * An SRTP session consists of all of the traffic sent to the RTP and | 430 * An SRTP session consists of all of the traffic sent to the RTP and |
276 * RTCP destination transport addresses, using the RTP/SAVP (Secure | 431 * RTCP destination transport addresses, using the RTP/SAVP (Secure |
277 * Audio/Video Profile). A session can be viewed as a set of SRTP | 432 * Audio/Video Profile). A session can be viewed as a set of SRTP |
278 * streams, each of which originates with a different participant. | 433 * streams, each of which originates with a different participant. |
279 */ | 434 */ |
280 | 435 |
281 typedef struct srtp_ctx_t *srtp_t; | 436 typedef srtp_ctx_t *srtp_t; |
282 | 437 |
283 | 438 |
284 /** | 439 /** |
285 * @brief An srtp_stream_t points to an SRTP stream structure. | 440 * @brief An srtp_stream_t points to an SRTP stream structure. |
286 * | 441 * |
287 * The typedef srtp_stream_t is a pointer to a structure that | 442 * The typedef srtp_stream_t is a pointer to a structure that |
288 * represents an SRTP stream. This datatype is intentionally | 443 * represents an SRTP stream. This datatype is intentionally |
289 * opaque in order to separate the interface from the implementation. | 444 * opaque in order to separate the interface from the implementation. |
290 * | 445 * |
291 * An SRTP stream consists of all of the traffic sent to an SRTP | 446 * An SRTP stream consists of all of the traffic sent to an SRTP |
292 * session by a single participant. A session can be viewed as | 447 * session by a single participant. A session can be viewed as |
293 * a set of streams. | 448 * a set of streams. |
294 * | 449 * |
295 */ | 450 */ |
296 typedef struct srtp_stream_ctx_t *srtp_stream_t; | 451 typedef srtp_stream_ctx_t *srtp_stream_t; |
297 | 452 |
298 | 453 |
299 | 454 |
300 /** | 455 /** |
301 * @brief srtp_init() initializes the srtp library. | 456 * @brief srtp_init() initializes the srtp library. |
302 * | 457 * |
303 * @warning This function @b must be called before any other srtp | 458 * @warning This function @b must be called before any other srtp |
304 * functions. | 459 * functions. |
305 */ | 460 */ |
306 | 461 |
307 err_status_t | 462 srtp_err_status_t srtp_init(void); |
308 srtp_init(void); | |
309 | 463 |
310 /** | 464 /** |
311 * @brief srtp_shutdown() de-initializes the srtp library. | 465 * @brief srtp_shutdown() de-initializes the srtp library. |
312 * | 466 * |
313 * @warning No srtp functions may be called after calling this function. | 467 * @warning No srtp functions may be called after calling this function. |
314 */ | 468 */ |
315 | 469 |
316 err_status_t | 470 srtp_err_status_t srtp_shutdown(void); |
317 srtp_shutdown(void); | |
318 | 471 |
319 /** | 472 /** |
320 * @brief srtp_protect() is the Secure RTP sender-side packet processing | 473 * @brief srtp_protect() is the Secure RTP sender-side packet processing |
321 * function. | 474 * function. |
322 * | 475 * |
323 * The function call srtp_protect(ctx, rtp_hdr, len_ptr) applies SRTP | 476 * The function call srtp_protect(ctx, rtp_hdr, len_ptr) applies SRTP |
324 * protection to the RTP packet rtp_hdr (which has length *len_ptr) using | 477 * protection to the RTP packet rtp_hdr (which has length *len_ptr) using |
325 * the SRTP context ctx. If err_status_ok is returned, then rtp_hdr | 478 * the SRTP context ctx. If srtp_err_status_ok is returned, then rtp_hdr |
326 * points to the resulting SRTP packet and *len_ptr is the number of | 479 * points to the resulting SRTP packet and *len_ptr is the number of |
327 * octets in that packet; otherwise, no assumptions should be made | 480 * octets in that packet; otherwise, no assumptions should be made |
328 * about the value of either data elements. | 481 * about the value of either data elements. |
329 * | 482 * |
330 * The sequence numbers of the RTP packets presented to this function | 483 * The sequence numbers of the RTP packets presented to this function |
331 * need not be consecutive, but they @b must be out of order by less | 484 * need not be consecutive, but they @b must be out of order by less |
332 * than 2^15 = 32,768 packets. | 485 * than 2^15 = 32,768 packets. |
333 * | 486 * |
334 * @warning This function assumes that it can write the authentication | 487 * @warning This function assumes that it can write the authentication |
335 * tag into the location in memory immediately following the RTP | 488 * tag into the location in memory immediately following the RTP |
336 * packet, and assumes that the RTP packet is aligned on a 32-bit | 489 * packet, and assumes that the RTP packet is aligned on a 32-bit |
337 * boundary. | 490 * boundary. |
338 * | 491 * |
339 * @warning This function assumes that it can write SRTP_MAX_TRAILER_LEN | 492 * @warning This function assumes that it can write SRTP_MAX_TRAILER_LEN |
340 * into the location in memory immediately following the RTP packet. | 493 * into the location in memory immediately following the RTP packet. |
341 * Callers MUST ensure that this much writable memory is available in | 494 * Callers MUST ensure that this much writable memory is available in |
342 * the buffer that holds the RTP packet. | 495 * the buffer that holds the RTP packet. |
343 * | 496 * |
344 * @param ctx is the SRTP context to use in processing the packet. | 497 * @param ctx is the SRTP context to use in processing the packet. |
345 * | 498 * |
346 * @param rtp_hdr is a pointer to the RTP packet (before the call); after | 499 * @param rtp_hdr is a pointer to the RTP packet (before the call); after |
347 * the function returns, it points to the srtp packet. | 500 * the function returns, it points to the srtp packet. |
348 * | 501 * |
349 * @param len_ptr is a pointer to the length in octets of the complete | 502 * @param len_ptr is a pointer to the length in octets of the complete |
350 * RTP packet (header and body) before the function call, and of the | 503 * RTP packet (header and body) before the function call, and of the |
351 * complete SRTP packet after the call, if err_status_ok was returned. | 504 * complete SRTP packet after the call, if srtp_err_status_ok was returned. |
352 * Otherwise, the value of the data to which it points is undefined. | 505 * Otherwise, the value of the data to which it points is undefined. |
353 * | 506 * |
354 * @return | 507 * @return |
355 * - err_status_ok no problems | 508 * - srtp_err_status_ok no problems |
356 * - err_status_replay_fail rtp sequence number was non-increasing | 509 * - srtp_err_status_replay_fail rtp sequence number was non-increasing |
357 * - @e other failure in cryptographic mechanisms | 510 * - @e other failure in cryptographic mechanisms |
358 */ | 511 */ |
359 | 512 |
360 err_status_t | 513 srtp_err_status_t srtp_protect(srtp_t ctx, void *rtp_hdr, int *len_ptr); |
361 srtp_protect(srtp_t ctx, void *rtp_hdr, int *len_ptr); | |
362 | 514 |
363 /** | 515 /** |
364 * @brief srtp_unprotect() is the Secure RTP receiver-side packet | 516 * @brief srtp_unprotect() is the Secure RTP receiver-side packet |
365 * processing function. | 517 * processing function. |
366 * | 518 * |
367 * The function call srtp_unprotect(ctx, srtp_hdr, len_ptr) verifies | 519 * The function call srtp_unprotect(ctx, srtp_hdr, len_ptr) verifies |
368 * the Secure RTP protection of the SRTP packet pointed to by srtp_hdr | 520 * the Secure RTP protection of the SRTP packet pointed to by srtp_hdr |
369 * (which has length *len_ptr), using the SRTP context ctx. If | 521 * (which has length *len_ptr), using the SRTP context ctx. If |
370 * err_status_ok is returned, then srtp_hdr points to the resulting | 522 * srtp_err_status_ok is returned, then srtp_hdr points to the resulting |
371 * RTP packet and *len_ptr is the number of octets in that packet; | 523 * RTP packet and *len_ptr is the number of octets in that packet; |
372 * otherwise, no assumptions should be made about the value of either | 524 * otherwise, no assumptions should be made about the value of either |
373 * data elements. | 525 * data elements. |
374 * | 526 * |
375 * The sequence numbers of the RTP packets presented to this function | 527 * The sequence numbers of the RTP packets presented to this function |
376 * need not be consecutive, but they @b must be out of order by less | 528 * need not be consecutive, but they @b must be out of order by less |
377 * than 2^15 = 32,768 packets. | 529 * than 2^15 = 32,768 packets. |
378 * | 530 * |
379 * @warning This function assumes that the SRTP packet is aligned on a | 531 * @warning This function assumes that the SRTP packet is aligned on a |
380 * 32-bit boundary. | 532 * 32-bit boundary. |
381 * | 533 * |
382 * @param ctx is the SRTP session which applies to the particular packet. | 534 * @param ctx is the SRTP session which applies to the particular packet. |
383 * | 535 * |
384 * @param srtp_hdr is a pointer to the header of the SRTP packet | 536 * @param srtp_hdr is a pointer to the header of the SRTP packet |
385 * (before the call). after the function returns, it points to the | 537 * (before the call). after the function returns, it points to the |
386 * rtp packet if err_status_ok was returned; otherwise, the value of | 538 * rtp packet if srtp_err_status_ok was returned; otherwise, the value of |
387 * the data to which it points is undefined. | 539 * the data to which it points is undefined. |
388 * | 540 * |
389 * @param len_ptr is a pointer to the length in octets of the complete | 541 * @param len_ptr is a pointer to the length in octets of the complete |
390 * srtp packet (header and body) before the function call, and of the | 542 * srtp packet (header and body) before the function call, and of the |
391 * complete rtp packet after the call, if err_status_ok was returned. | 543 * complete rtp packet after the call, if srtp_err_status_ok was returned. |
392 * Otherwise, the value of the data to which it points is undefined. | 544 * Otherwise, the value of the data to which it points is undefined. |
393 * | 545 * |
394 * @return | 546 * @return |
395 * - err_status_ok if the RTP packet is valid. | 547 * - srtp_err_status_ok if the RTP packet is valid. |
396 * - err_status_auth_fail if the SRTP packet failed the message | 548 * - srtp_err_status_auth_fail if the SRTP packet failed the message |
397 * authentication check. | 549 * authentication check. |
398 * - err_status_replay_fail if the SRTP packet is a replay (e.g. packet has | 550 * - srtp_err_status_replay_fail if the SRTP packet is a replay (e.g. packet
has |
399 * already been processed and accepted). | 551 * already been processed and accepted). |
400 * - [other] if there has been an error in the cryptographic mechanisms. | 552 * - [other] if there has been an error in the cryptographic mechanisms. |
401 * | 553 * |
402 */ | 554 */ |
403 | 555 |
404 err_status_t | 556 srtp_err_status_t srtp_unprotect(srtp_t ctx, void *srtp_hdr, int *len_ptr); |
405 srtp_unprotect(srtp_t ctx, void *srtp_hdr, int *len_ptr); | |
406 | 557 |
407 | 558 |
408 /** | 559 /** |
409 * @brief srtp_create() allocates and initializes an SRTP session. | 560 * @brief srtp_create() allocates and initializes an SRTP session. |
410 | 561 |
411 * The function call srtp_create(session, policy, key) allocates and | 562 * The function call srtp_create(session, policy) allocates and |
412 * initializes an SRTP session context, applying the given policy and | 563 * initializes an SRTP session context, applying the given policy. |
413 * key. | |
414 * | 564 * |
415 * @param session is a pointer to the SRTP session to which the policy is | 565 * @param session is a pointer to the SRTP session to which the policy is |
416 * to be added. | 566 * to be added. |
417 * | 567 * |
418 * @param policy is the srtp_policy_t struct that describes the policy | 568 * @param policy is the srtp_policy_t struct that describes the policy |
419 * for the session. The struct may be a single element, or it may be | 569 * for the session. The struct may be a single element, or it may be |
420 * the head of a list, in which case each element of the list is | 570 * the head of a list, in which case each element of the list is |
421 * processed. It may also be NULL, in which case streams should be added | 571 * processed. It may also be NULL, in which case streams should be added |
422 * later using srtp_add_stream(). The final element of the list @b must | 572 * later using srtp_add_stream(). The final element of the list @b must |
423 * have its `next' field set to NULL. | 573 * have its `next' field set to NULL. |
424 * | 574 * |
425 * @return | 575 * @return |
426 * - err_status_ok if creation succeded. | 576 * - srtp_err_status_ok if creation succeded. |
427 * - err_status_alloc_fail if allocation failed. | 577 * - srtp_err_status_alloc_fail if allocation failed. |
428 * - err_status_init_fail if initialization failed. | 578 * - srtp_err_status_init_fail if initialization failed. |
429 */ | 579 */ |
430 | 580 |
431 err_status_t | 581 srtp_err_status_t srtp_create(srtp_t *session, const srtp_policy_t *policy); |
432 srtp_create(srtp_t *session, const srtp_policy_t *policy); | |
433 | 582 |
434 | 583 |
435 /** | 584 /** |
436 * @brief srtp_add_stream() allocates and initializes an SRTP stream | 585 * @brief srtp_add_stream() allocates and initializes an SRTP stream |
437 * within a given SRTP session. | 586 * within a given SRTP session. |
438 * | 587 * |
439 * The function call srtp_add_stream(session, policy) allocates and | 588 * The function call srtp_add_stream(session, policy) allocates and |
440 * initializes a new SRTP stream within a given, previously created | 589 * initializes a new SRTP stream within a given, previously created |
441 * session, applying the policy given as the other argument to that | 590 * session, applying the policy given as the other argument to that |
442 * stream. | 591 * stream. |
443 * | 592 * |
444 * @return values: | 593 * @return values: |
445 * - err_status_ok if stream creation succeded. | 594 * - srtp_err_status_ok if stream creation succeded. |
446 * - err_status_alloc_fail if stream allocation failed | 595 * - srtp_err_status_alloc_fail if stream allocation failed |
447 * - err_status_init_fail if stream initialization failed. | 596 * - srtp_err_status_init_fail if stream initialization failed. |
448 */ | 597 */ |
449 | 598 |
450 err_status_t | 599 srtp_err_status_t srtp_add_stream(srtp_t session, const srtp_policy_t *policy); |
451 srtp_add_stream(srtp_t session, | |
452 » » const srtp_policy_t *policy); | |
453 | 600 |
454 | 601 |
455 /** | 602 /** |
456 * @brief srtp_remove_stream() deallocates an SRTP stream. | 603 * @brief srtp_remove_stream() deallocates an SRTP stream. |
457 * | 604 * |
458 * The function call srtp_remove_stream(session, ssrc) removes | 605 * The function call srtp_remove_stream(session, ssrc) removes |
459 * the SRTP stream with the SSRC value ssrc from the SRTP session | 606 * the SRTP stream with the SSRC value ssrc from the SRTP session |
460 * context given by the argument session. | 607 * context given by the argument session. |
461 * | 608 * |
462 * @param session is the SRTP session from which the stream | 609 * @param session is the SRTP session from which the stream |
463 * will be removed. | 610 * will be removed. |
464 * | 611 * |
465 * @param ssrc is the SSRC value of the stream to be removed. | 612 * @param ssrc is the SSRC value of the stream to be removed |
| 613 * in network byte order. |
466 * | 614 * |
467 * @warning Wildcard SSRC values cannot be removed from a | 615 * @warning Wildcard SSRC values cannot be removed from a |
468 * session. | 616 * session. |
469 * | 617 * |
470 * @return | 618 * @return |
471 * - err_status_ok if the stream deallocation succeded. | 619 * - srtp_err_status_ok if the stream deallocation succeded. |
472 * - [other] otherwise. | 620 * - [other] otherwise. |
473 * | 621 * |
474 */ | 622 */ |
475 | 623 |
476 err_status_t | 624 srtp_err_status_t srtp_remove_stream(srtp_t session, unsigned int ssrc); |
477 srtp_remove_stream(srtp_t session, unsigned int ssrc); | |
478 | 625 |
479 /** | 626 /** |
480 * @brief crypto_policy_set_rtp_default() sets a crypto policy | 627 * @brief srtp_update() udpates all streams in the session. |
| 628 * |
| 629 * The function call srtp_update(session, policy) updates |
| 630 * all the streams in the session applying the given policy |
| 631 * and key. The exsisting ROC value of all streams will be |
| 632 * preserved. |
| 633 * |
| 634 * @param session is the SRTP session that contains the streams |
| 635 * to be updated. |
| 636 * |
| 637 * @param policy is the srtp_policy_t struct that describes the policy |
| 638 * for the session. The struct may be a single element, or it may be |
| 639 * the head of a list, in which case each element of the list is |
| 640 * processed. The final element of the list @b must |
| 641 * have its `next' field set to NULL. |
| 642 * |
| 643 * @return |
| 644 * - srtp_err_status_ok if stream creation succeded. |
| 645 * - srtp_err_status_alloc_fail if stream allocation failed |
| 646 * - srtp_err_status_init_fail if stream initialization failed. |
| 647 * - [other] otherwise. |
| 648 * |
| 649 */ |
| 650 |
| 651 srtp_err_status_t srtp_update(srtp_t session, const srtp_policy_t *policy); |
| 652 |
| 653 /** |
| 654 * @brief srtp_update_stream() udpates a SRTP stream. |
| 655 * |
| 656 * The function call srtp_update_stream(session, policy) updates |
| 657 * the stream(s) in the session that match applying the given |
| 658 * policy and key. The exsisting ROC value of all stream(s) will |
| 659 * be preserved. |
| 660 * |
| 661 * @param session is the SRTP session that contains the streams |
| 662 * to be updated. |
| 663 * |
| 664 * @param policy is the srtp_policy_t struct that describes the policy |
| 665 * for the session. |
| 666 * |
| 667 * @return |
| 668 * - srtp_err_status_ok if stream creation succeded. |
| 669 * - srtp_err_status_alloc_fail if stream allocation failed |
| 670 * - srtp_err_status_init_fail if stream initialization failed. |
| 671 * - [other] otherwise. |
| 672 * |
| 673 */ |
| 674 |
| 675 srtp_err_status_t srtp_update_stream(srtp_t session, const srtp_policy_t *policy
); |
| 676 |
| 677 /** |
| 678 * @brief srtp_crypto_policy_set_rtp_default() sets a crypto policy |
481 * structure to the SRTP default policy for RTP protection. | 679 * structure to the SRTP default policy for RTP protection. |
482 * | 680 * |
483 * @param p is a pointer to the policy structure to be set | 681 * @param p is a pointer to the policy structure to be set |
484 * | 682 * |
485 * The function call crypto_policy_set_rtp_default(&p) sets the | 683 * The function call crypto_policy_set_rtp_default(&p) sets the |
486 * crypto_policy_t at location p to the SRTP default policy for RTP | 684 * crypto_policy_t at location p to the SRTP default policy for RTP |
487 * protection, as defined in the specification. This function is a | 685 * protection, as defined in the specification. This function is a |
488 * convenience that helps to avoid dealing directly with the policy | 686 * convenience that helps to avoid dealing directly with the policy |
489 * data structure. You are encouraged to initialize policy elements | 687 * data structure. You are encouraged to initialize policy elements |
490 * with this function call. Doing so may allow your code to be | 688 * with this function call. Doing so may allow your code to be |
491 * forward compatible with later versions of libSRTP that include more | 689 * forward compatible with later versions of libSRTP that include more |
492 * elements in the crypto_policy_t datatype. | 690 * elements in the crypto_policy_t datatype. |
493 * | 691 * |
494 * @return void. | 692 * @return void. |
495 * | 693 * |
496 */ | 694 */ |
497 | 695 |
498 void | 696 void srtp_crypto_policy_set_rtp_default(srtp_crypto_policy_t *p); |
499 crypto_policy_set_rtp_default(crypto_policy_t *p); | |
500 | 697 |
501 /** | 698 /** |
502 * @brief crypto_policy_set_rtcp_default() sets a crypto policy | 699 * @brief srtp_crypto_policy_set_rtcp_default() sets a crypto policy |
503 * structure to the SRTP default policy for RTCP protection. | 700 * structure to the SRTP default policy for RTCP protection. |
504 * | 701 * |
505 * @param p is a pointer to the policy structure to be set | 702 * @param p is a pointer to the policy structure to be set |
506 * | 703 * |
507 * The function call crypto_policy_set_rtcp_default(&p) sets the | 704 * The function call srtp_crypto_policy_set_rtcp_default(&p) sets the |
508 * crypto_policy_t at location p to the SRTP default policy for RTCP | 705 * srtp_crypto_policy_t at location p to the SRTP default policy for RTCP |
509 * protection, as defined in the specification. This function is a | 706 * protection, as defined in the specification. This function is a |
510 * convenience that helps to avoid dealing directly with the policy | 707 * convenience that helps to avoid dealing directly with the policy |
511 * data structure. You are encouraged to initialize policy elements | 708 * data structure. You are encouraged to initialize policy elements |
512 * with this function call. Doing so may allow your code to be | 709 * with this function call. Doing so may allow your code to be |
513 * forward compatible with later versions of libSRTP that include more | 710 * forward compatible with later versions of libSRTP that include more |
514 * elements in the crypto_policy_t datatype. | 711 * elements in the srtp_crypto_policy_t datatype. |
515 * | 712 * |
516 * @return void. | 713 * @return void. |
517 * | 714 * |
518 */ | 715 */ |
519 | 716 |
520 void | 717 void srtp_crypto_policy_set_rtcp_default(srtp_crypto_policy_t *p); |
521 crypto_policy_set_rtcp_default(crypto_policy_t *p); | |
522 | 718 |
523 /** | 719 /** |
524 * @brief crypto_policy_set_aes_cm_128_hmac_sha1_80() sets a crypto | 720 * @brief srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80() sets a crypto |
525 * policy structure to the SRTP default policy for RTP protection. | 721 * policy structure to the SRTP default policy for RTP protection. |
526 * | 722 * |
527 * @param p is a pointer to the policy structure to be set | 723 * @param p is a pointer to the policy structure to be set |
528 * | 724 * |
529 * The function crypto_policy_set_aes_cm_128_hmac_sha1_80() is a | 725 * The function srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80() is a |
530 * synonym for crypto_policy_set_rtp_default(). It conforms to the | 726 * synonym for srtp_crypto_policy_set_rtp_default(). It conforms to the |
531 * naming convention used in RFC 4568 (SDP Security Descriptions for | 727 * naming convention used in RFC 4568 (SDP Security Descriptions for |
532 * Media Streams). | 728 * Media Streams). |
533 * | 729 * |
534 * @return void. | 730 * @return void. |
535 * | 731 * |
536 */ | 732 */ |
537 | 733 |
538 #define crypto_policy_set_aes_cm_128_hmac_sha1_80(p) crypto_policy_set_rtp_defau
lt(p) | 734 #define srtp_crypto_policy_set_aes_cm_128_hmac_sha1_80(p) srtp_crypto_policy_set
_rtp_default(p) |
539 | 735 |
540 | 736 |
541 /** | 737 /** |
542 * @brief crypto_policy_set_aes_cm_128_hmac_sha1_32() sets a crypto | 738 * @brief srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32() sets a crypto |
543 * policy structure to a short-authentication tag policy | 739 * policy structure to a short-authentication tag policy |
544 * | 740 * |
545 * @param p is a pointer to the policy structure to be set | 741 * @param p is a pointer to the policy structure to be set |
546 * | 742 * |
547 * The function call crypto_policy_set_aes_cm_128_hmac_sha1_32(&p) | 743 * The function call srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32(&p) |
548 * sets the crypto_policy_t at location p to use policy | 744 * sets the srtp_crypto_policy_t at location p to use policy |
549 * AES_CM_128_HMAC_SHA1_32 as defined in RFC 4568. | 745 * AES_CM_128_HMAC_SHA1_32 as defined in RFC 4568. |
550 * This policy uses AES-128 | 746 * This policy uses AES-128 |
551 * Counter Mode encryption and HMAC-SHA1 authentication, with an | 747 * Counter Mode encryption and HMAC-SHA1 authentication, with an |
552 * authentication tag that is only 32 bits long. This length is | 748 * authentication tag that is only 32 bits long. This length is |
553 * considered adequate only for protecting audio and video media that | 749 * considered adequate only for protecting audio and video media that |
554 * use a stateless playback function. See Section 7.5 of RFC 3711 | 750 * use a stateless playback function. See Section 7.5 of RFC 3711 |
555 * (http://www.ietf.org/rfc/rfc3711.txt). | 751 * (http://www.ietf.org/rfc/rfc3711.txt). |
556 * | 752 * |
557 * This function is a convenience that helps to avoid dealing directly | 753 * This function is a convenience that helps to avoid dealing directly |
558 * with the policy data structure. You are encouraged to initialize | 754 * with the policy data structure. You are encouraged to initialize |
559 * policy elements with this function call. Doing so may allow your | 755 * policy elements with this function call. Doing so may allow your |
560 * code to be forward compatible with later versions of libSRTP that | 756 * code to be forward compatible with later versions of libSRTP that |
561 * include more elements in the crypto_policy_t datatype. | 757 * include more elements in the srtp_crypto_policy_t datatype. |
562 * | 758 * |
563 * @warning This crypto policy is intended for use in SRTP, but not in | 759 * @warning This crypto policy is intended for use in SRTP, but not in |
564 * SRTCP. It is recommended that a policy that uses longer | 760 * SRTCP. It is recommended that a policy that uses longer |
565 * authentication tags be used for SRTCP. See Section 7.5 of RFC 3711 | 761 * authentication tags be used for SRTCP. See Section 7.5 of RFC 3711 |
566 * (http://www.ietf.org/rfc/rfc3711.txt). | 762 * (http://www.ietf.org/rfc/rfc3711.txt). |
567 * | 763 * |
568 * @return void. | 764 * @return void. |
569 * | 765 * |
570 */ | 766 */ |
571 | 767 |
572 void | 768 void srtp_crypto_policy_set_aes_cm_128_hmac_sha1_32(srtp_crypto_policy_t *p); |
573 crypto_policy_set_aes_cm_128_hmac_sha1_32(crypto_policy_t *p); | |
574 | 769 |
575 | 770 |
576 | 771 |
577 /** | 772 /** |
578 * @brief crypto_policy_set_aes_cm_128_null_auth() sets a crypto | 773 * @brief srtp_crypto_policy_set_aes_cm_128_null_auth() sets a crypto |
579 * policy structure to an encryption-only policy | 774 * policy structure to an encryption-only policy |
580 * | 775 * |
581 * @param p is a pointer to the policy structure to be set | 776 * @param p is a pointer to the policy structure to be set |
582 * | 777 * |
583 * The function call crypto_policy_set_aes_cm_128_null_auth(&p) sets | 778 * The function call srtp_crypto_policy_set_aes_cm_128_null_auth(&p) sets |
584 * the crypto_policy_t at location p to use the SRTP default cipher | 779 * the srtp_crypto_policy_t at location p to use the SRTP default cipher |
585 * (AES-128 Counter Mode), but to use no authentication method. This | 780 * (AES-128 Counter Mode), but to use no authentication method. This |
586 * policy is NOT RECOMMENDED unless it is unavoidable; see Section 7.5 | 781 * policy is NOT RECOMMENDED unless it is unavoidable; see Section 7.5 |
587 * of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). | 782 * of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). |
588 * | 783 * |
589 * This function is a convenience that helps to avoid dealing directly | 784 * This function is a convenience that helps to avoid dealing directly |
590 * with the policy data structure. You are encouraged to initialize | 785 * with the policy data structure. You are encouraged to initialize |
591 * policy elements with this function call. Doing so may allow your | 786 * policy elements with this function call. Doing so may allow your |
592 * code to be forward compatible with later versions of libSRTP that | 787 * code to be forward compatible with later versions of libSRTP that |
593 * include more elements in the crypto_policy_t datatype. | 788 * include more elements in the srtp_crypto_policy_t datatype. |
594 * | 789 * |
595 * @warning This policy is NOT RECOMMENDED for SRTP unless it is | 790 * @warning This policy is NOT RECOMMENDED for SRTP unless it is |
596 * unavoidable, and it is NOT RECOMMENDED at all for SRTCP; see | 791 * unavoidable, and it is NOT RECOMMENDED at all for SRTCP; see |
597 * Section 7.5 of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). | 792 * Section 7.5 of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). |
598 * | 793 * |
599 * @return void. | 794 * @return void. |
600 * | 795 * |
601 */ | 796 */ |
602 | 797 |
603 void | 798 void srtp_crypto_policy_set_aes_cm_128_null_auth(srtp_crypto_policy_t *p); |
604 crypto_policy_set_aes_cm_128_null_auth(crypto_policy_t *p); | |
605 | 799 |
606 | 800 |
607 /** | 801 /** |
608 * @brief crypto_policy_set_null_cipher_hmac_sha1_80() sets a crypto | 802 * @brief srtp_crypto_policy_set_null_cipher_hmac_sha1_80() sets a crypto |
609 * policy structure to an authentication-only policy | 803 * policy structure to an authentication-only policy |
610 * | 804 * |
611 * @param p is a pointer to the policy structure to be set | 805 * @param p is a pointer to the policy structure to be set |
612 * | 806 * |
613 * The function call crypto_policy_set_null_cipher_hmac_sha1_80(&p) | 807 * The function call srtp_crypto_policy_set_null_cipher_hmac_sha1_80(&p) |
614 * sets the crypto_policy_t at location p to use HMAC-SHA1 with an 80 | 808 * sets the srtp_crypto_policy_t at location p to use HMAC-SHA1 with an 80 |
615 * bit authentication tag to provide message authentication, but to | 809 * bit authentication tag to provide message authentication, but to |
616 * use no encryption. This policy is NOT RECOMMENDED for SRTP unless | 810 * use no encryption. This policy is NOT RECOMMENDED for SRTP unless |
617 * there is a requirement to forego encryption. | 811 * there is a requirement to forego encryption. |
618 * | 812 * |
619 * This function is a convenience that helps to avoid dealing directly | 813 * This function is a convenience that helps to avoid dealing directly |
620 * with the policy data structure. You are encouraged to initialize | 814 * with the policy data structure. You are encouraged to initialize |
621 * policy elements with this function call. Doing so may allow your | 815 * policy elements with this function call. Doing so may allow your |
622 * code to be forward compatible with later versions of libSRTP that | 816 * code to be forward compatible with later versions of libSRTP that |
623 * include more elements in the crypto_policy_t datatype. | 817 * include more elements in the srtp_crypto_policy_t datatype. |
624 * | 818 * |
625 * @warning This policy is NOT RECOMMENDED for SRTP unless there is a | 819 * @warning This policy is NOT RECOMMENDED for SRTP unless there is a |
626 * requirement to forego encryption. | 820 * requirement to forego encryption. |
627 * | 821 * |
628 * @return void. | 822 * @return void. |
629 * | 823 * |
630 */ | 824 */ |
| 825 void srtp_crypto_policy_set_null_cipher_hmac_sha1_80(srtp_crypto_policy_t *p); |
631 | 826 |
632 void | 827 /** |
633 crypto_policy_set_null_cipher_hmac_sha1_80(crypto_policy_t *p); | 828 * @brief srtp_crypto_policy_set_null_cipher_hmac_null() sets a crypto |
| 829 * policy structure to use no encryption or authentication. |
| 830 * |
| 831 * @param p is a pointer to the policy structure to be set |
| 832 * |
| 833 * The function call srtp_crypto_policy_set_null_cipher_hmac_null(&p) |
| 834 * sets the srtp_crypto_policy_t at location p to use no encryption and |
| 835 * no authentication. This policy should only be used for testing and |
| 836 * troubleshootingl. |
| 837 * |
| 838 * This function is a convenience that helps to avoid dealing directly |
| 839 * with the policy data structure. You are encouraged to initialize |
| 840 * policy elements with this function call. Doing so may allow your |
| 841 * code to be forward compatible with later versions of libSRTP that |
| 842 * include more elements in the srtp_crypto_policy_t datatype. |
| 843 * |
| 844 * @warning This policy is NOT RECOMMENDED for SRTP unless there is a |
| 845 * requirement to forego encryption and authentication. |
| 846 * |
| 847 * @return void. |
| 848 * |
| 849 */ |
| 850 void srtp_crypto_policy_set_null_cipher_hmac_null(srtp_crypto_policy_t *p); |
634 | 851 |
635 | 852 |
636 /** | 853 /** |
637 * @brief crypto_policy_set_aes_cm_256_hmac_sha1_80() sets a crypto | 854 * @brief srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80() sets a crypto |
638 * policy structure to a encryption and authentication policy using AES-256 | 855 * policy structure to a encryption and authentication policy using AES-256 |
639 * for RTP protection. | 856 * for RTP protection. |
640 * | 857 * |
641 * @param p is a pointer to the policy structure to be set | 858 * @param p is a pointer to the policy structure to be set |
642 * | 859 * |
643 * The function call crypto_policy_set_aes_cm_256_hmac_sha1_80(&p) | 860 * The function call srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80(&p) |
644 * sets the crypto_policy_t at location p to use policy | 861 * sets the srtp_crypto_policy_t at location p to use policy |
645 * AES_CM_256_HMAC_SHA1_80 as defined in | 862 * AES_CM_256_HMAC_SHA1_80 as defined in |
646 * draft-ietf-avt-srtp-big-aes-03.txt. This policy uses AES-256 | 863 * draft-ietf-avt-srtp-big-aes-03.txt. This policy uses AES-256 |
647 * Counter Mode encryption and HMAC-SHA1 authentication, with an 80 bit | 864 * Counter Mode encryption and HMAC-SHA1 authentication, with an 80 bit |
648 * authentication tag. | 865 * authentication tag. |
649 * | 866 * |
650 * This function is a convenience that helps to avoid dealing directly | 867 * This function is a convenience that helps to avoid dealing directly |
651 * with the policy data structure. You are encouraged to initialize | 868 * with the policy data structure. You are encouraged to initialize |
652 * policy elements with this function call. Doing so may allow your | 869 * policy elements with this function call. Doing so may allow your |
653 * code to be forward compatible with later versions of libSRTP that | 870 * code to be forward compatible with later versions of libSRTP that |
654 * include more elements in the crypto_policy_t datatype. | 871 * include more elements in the srtp_crypto_policy_t datatype. |
655 * | 872 * |
656 * @return void. | 873 * @return void. |
657 * | 874 * |
658 */ | 875 */ |
659 | 876 |
660 void crypto_policy_set_aes_cm_256_hmac_sha1_80(crypto_policy_t *p); | 877 void srtp_crypto_policy_set_aes_cm_256_hmac_sha1_80(srtp_crypto_policy_t *p); |
661 | 878 |
662 | 879 |
663 /** | 880 /** |
664 * @brief crypto_policy_set_aes_cm_256_hmac_sha1_32() sets a crypto | 881 * @brief srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32() sets a crypto |
665 * policy structure to a short-authentication tag policy using AES-256 | 882 * policy structure to a short-authentication tag policy using AES-256 |
666 * encryption. | 883 * encryption. |
667 * | 884 * |
668 * @param p is a pointer to the policy structure to be set | 885 * @param p is a pointer to the policy structure to be set |
669 * | 886 * |
670 * The function call crypto_policy_set_aes_cm_256_hmac_sha1_32(&p) | 887 * The function call srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32(&p) |
671 * sets the crypto_policy_t at location p to use policy | 888 * sets the srtp_crypto_policy_t at location p to use policy |
672 * AES_CM_256_HMAC_SHA1_32 as defined in | 889 * AES_CM_256_HMAC_SHA1_32 as defined in |
673 * draft-ietf-avt-srtp-big-aes-03.txt. This policy uses AES-256 | 890 * draft-ietf-avt-srtp-big-aes-03.txt. This policy uses AES-256 |
674 * Counter Mode encryption and HMAC-SHA1 authentication, with an | 891 * Counter Mode encryption and HMAC-SHA1 authentication, with an |
675 * authentication tag that is only 32 bits long. This length is | 892 * authentication tag that is only 32 bits long. This length is |
676 * considered adequate only for protecting audio and video media that | 893 * considered adequate only for protecting audio and video media that |
677 * use a stateless playback function. See Section 7.5 of RFC 3711 | 894 * use a stateless playback function. See Section 7.5 of RFC 3711 |
678 * (http://www.ietf.org/rfc/rfc3711.txt). | 895 * (http://www.ietf.org/rfc/rfc3711.txt). |
679 * | 896 * |
680 * This function is a convenience that helps to avoid dealing directly | 897 * This function is a convenience that helps to avoid dealing directly |
681 * with the policy data structure. You are encouraged to initialize | 898 * with the policy data structure. You are encouraged to initialize |
682 * policy elements with this function call. Doing so may allow your | 899 * policy elements with this function call. Doing so may allow your |
683 * code to be forward compatible with later versions of libSRTP that | 900 * code to be forward compatible with later versions of libSRTP that |
684 * include more elements in the crypto_policy_t datatype. | 901 * include more elements in the srtp_crypto_policy_t datatype. |
685 * | 902 * |
686 * @warning This crypto policy is intended for use in SRTP, but not in | 903 * @warning This crypto policy is intended for use in SRTP, but not in |
687 * SRTCP. It is recommended that a policy that uses longer | 904 * SRTCP. It is recommended that a policy that uses longer |
688 * authentication tags be used for SRTCP. See Section 7.5 of RFC 3711 | 905 * authentication tags be used for SRTCP. See Section 7.5 of RFC 3711 |
689 * (http://www.ietf.org/rfc/rfc3711.txt). | 906 * (http://www.ietf.org/rfc/rfc3711.txt). |
690 * | 907 * |
691 * @return void. | 908 * @return void. |
692 * | 909 * |
693 */ | 910 */ |
694 | 911 |
695 void | 912 void srtp_crypto_policy_set_aes_cm_256_hmac_sha1_32(srtp_crypto_policy_t *p); |
696 crypto_policy_set_aes_cm_256_hmac_sha1_32(crypto_policy_t *p); | |
697 | 913 |
698 /** | 914 /** |
699 * @brief crypto_policy_set_aes_cm_256_null_auth() sets a crypto | 915 * @brief srtp_crypto_policy_set_aes_cm_256_null_auth() sets a crypto |
700 * policy structure to an encryption-only policy | 916 * policy structure to an encryption-only policy |
701 * | 917 * |
702 * @param p is a pointer to the policy structure to be set | 918 * @param p is a pointer to the policy structure to be set |
703 * | 919 * |
704 * The function call crypto_policy_set_aes_cm_256_null_auth(&p) sets | 920 * The function call srtp_crypto_policy_set_aes_cm_256_null_auth(&p) sets |
705 * the crypto_policy_t at location p to use the SRTP default cipher | 921 * the srtp_crypto_policy_t at location p to use the SRTP default cipher |
706 * (AES-256 Counter Mode), but to use no authentication method. This | 922 * (AES-256 Counter Mode), but to use no authentication method. This |
707 * policy is NOT RECOMMENDED unless it is unavoidable; see Section 7.5 | 923 * policy is NOT RECOMMENDED unless it is unavoidable; see Section 7.5 |
708 * of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). | 924 * of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). |
709 * | 925 * |
710 * This function is a convenience that helps to avoid dealing directly | 926 * This function is a convenience that helps to avoid dealing directly |
711 * with the policy data structure. You are encouraged to initialize | 927 * with the policy data structure. You are encouraged to initialize |
712 * policy elements with this function call. Doing so may allow your | 928 * policy elements with this function call. Doing so may allow your |
713 * code to be forward compatible with later versions of libSRTP that | 929 * code to be forward compatible with later versions of libSRTP that |
714 * include more elements in the crypto_policy_t datatype. | 930 * include more elements in the srtp_crypto_policy_t datatype. |
715 * | 931 * |
716 * @warning This policy is NOT RECOMMENDED for SRTP unless it is | 932 * @warning This policy is NOT RECOMMENDED for SRTP unless it is |
717 * unavoidable, and it is NOT RECOMMENDED at all for SRTCP; see | 933 * unavoidable, and it is NOT RECOMMENDED at all for SRTCP; see |
718 * Section 7.5 of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). | 934 * Section 7.5 of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). |
719 * | 935 * |
720 * @return void. | 936 * @return void. |
721 * | 937 * |
722 */ | 938 */ |
723 void | 939 void srtp_crypto_policy_set_aes_cm_256_null_auth(srtp_crypto_policy_t *p); |
724 crypto_policy_set_aes_cm_256_null_auth(crypto_policy_t *p); | |
725 | 940 |
726 /** | 941 /** |
727 * @brief crypto_policy_set_aes_gcm_128_8_auth() sets a crypto | 942 * @brief srtp_crypto_policy_set_aes_gcm_128_8_auth() sets a crypto |
728 * policy structure to an AEAD encryption policy. | 943 * policy structure to an AEAD encryption policy. |
729 * | 944 * |
730 * @param p is a pointer to the policy structure to be set | 945 * @param p is a pointer to the policy structure to be set |
731 * | 946 * |
732 * The function call crypto_policy_set_aes_gcm_128_8_auth(&p) sets | 947 * The function call srtp_crypto_policy_set_aes_gcm_128_8_auth(&p) sets |
733 * the crypto_policy_t at location p to use the SRTP default cipher | 948 * the srtp_crypto_policy_t at location p to use the SRTP default cipher |
734 * (AES-128 Galois Counter Mode) with 8 octet auth tag. This | 949 * (AES-128 Galois Counter Mode) with 8 octet auth tag. This |
735 * policy applies confidentiality and authentication to both the | 950 * policy applies confidentiality and authentication to both the |
736 * RTP and RTCP packets. | 951 * RTP and RTCP packets. |
737 * | 952 * |
738 * This function is a convenience that helps to avoid dealing directly | 953 * This function is a convenience that helps to avoid dealing directly |
739 * with the policy data structure. You are encouraged to initialize | 954 * with the policy data structure. You are encouraged to initialize |
740 * policy elements with this function call. Doing so may allow your | 955 * policy elements with this function call. Doing so may allow your |
741 * code to be forward compatible with later versions of libSRTP that | 956 * code to be forward compatible with later versions of libSRTP that |
742 * include more elements in the crypto_policy_t datatype. | 957 * include more elements in the srtp_crypto_policy_t datatype. |
743 * | 958 * |
744 * @return void. | 959 * @return void. |
745 * | 960 * |
746 */ | 961 */ |
747 void | 962 void srtp_crypto_policy_set_aes_gcm_128_8_auth(srtp_crypto_policy_t *p); |
748 crypto_policy_set_aes_gcm_128_8_auth(crypto_policy_t *p); | |
749 | 963 |
750 /** | 964 /** |
751 * @brief crypto_policy_set_aes_gcm_256_8_auth() sets a crypto | 965 * @brief srtp_crypto_policy_set_aes_gcm_256_8_auth() sets a crypto |
752 * policy structure to an AEAD encryption policy | 966 * policy structure to an AEAD encryption policy |
753 * | 967 * |
754 * @param p is a pointer to the policy structure to be set | 968 * @param p is a pointer to the policy structure to be set |
755 * | 969 * |
756 * The function call crypto_policy_set_aes_gcm_256_8_auth(&p) sets | 970 * The function call srtp_crypto_policy_set_aes_gcm_256_8_auth(&p) sets |
757 * the crypto_policy_t at location p to use the SRTP default cipher | 971 * the srtp_crypto_policy_t at location p to use the SRTP default cipher |
758 * (AES-256 Galois Counter Mode) with 8 octet auth tag. This | 972 * (AES-256 Galois Counter Mode) with 8 octet auth tag. This |
759 * policy applies confidentiality and authentication to both the | 973 * policy applies confidentiality and authentication to both the |
760 * RTP and RTCP packets. | 974 * RTP and RTCP packets. |
761 * | 975 * |
762 * This function is a convenience that helps to avoid dealing directly | 976 * This function is a convenience that helps to avoid dealing directly |
763 * with the policy data structure. You are encouraged to initialize | 977 * with the policy data structure. You are encouraged to initialize |
764 * policy elements with this function call. Doing so may allow your | 978 * policy elements with this function call. Doing so may allow your |
765 * code to be forward compatible with later versions of libSRTP that | 979 * code to be forward compatible with later versions of libSRTP that |
766 * include more elements in the crypto_policy_t datatype. | 980 * include more elements in the srtp_crypto_policy_t datatype. |
767 * | 981 * |
768 * @return void. | 982 * @return void. |
769 * | 983 * |
770 */ | 984 */ |
771 void | 985 void srtp_crypto_policy_set_aes_gcm_256_8_auth(srtp_crypto_policy_t *p); |
772 crypto_policy_set_aes_gcm_256_8_auth(crypto_policy_t *p); | |
773 | 986 |
774 /** | 987 /** |
775 * @brief crypto_policy_set_aes_gcm_128_8_only_auth() sets a crypto | 988 * @brief srtp_crypto_policy_set_aes_gcm_128_8_only_auth() sets a crypto |
776 * policy structure to an AEAD authentication-only policy | 989 * policy structure to an AEAD authentication-only policy |
777 * | 990 * |
778 * @param p is a pointer to the policy structure to be set | 991 * @param p is a pointer to the policy structure to be set |
779 * | 992 * |
780 * The function call crypto_policy_set_aes_gcm_128_8_only_auth(&p) sets | 993 * The function call srtp_crypto_policy_set_aes_gcm_128_8_only_auth(&p) sets |
781 * the crypto_policy_t at location p to use the SRTP default cipher | 994 * the srtp_crypto_policy_t at location p to use the SRTP default cipher |
782 * (AES-128 Galois Counter Mode) with 8 octet auth tag. This policy | 995 * (AES-128 Galois Counter Mode) with 8 octet auth tag. This policy |
783 * applies confidentiality and authentication to the RTP packets, | 996 * applies confidentiality and authentication to the RTP packets, |
784 * but only authentication to the RTCP packets. | 997 * but only authentication to the RTCP packets. |
785 * | 998 * |
786 * This function is a convenience that helps to avoid dealing directly | 999 * This function is a convenience that helps to avoid dealing directly |
787 * with the policy data structure. You are encouraged to initialize | 1000 * with the policy data structure. You are encouraged to initialize |
788 * policy elements with this function call. Doing so may allow your | 1001 * policy elements with this function call. Doing so may allow your |
789 * code to be forward compatible with later versions of libSRTP that | 1002 * code to be forward compatible with later versions of libSRTP that |
790 * include more elements in the crypto_policy_t datatype. | 1003 * include more elements in the srtp_crypto_policy_t datatype. |
791 * | 1004 * |
792 * @return void. | 1005 * @return void. |
793 * | 1006 * |
794 */ | 1007 */ |
795 void | 1008 void srtp_crypto_policy_set_aes_gcm_128_8_only_auth(srtp_crypto_policy_t *p); |
796 crypto_policy_set_aes_gcm_128_8_only_auth(crypto_policy_t *p); | |
797 | 1009 |
798 /** | 1010 /** |
799 * @brief crypto_policy_set_aes_gcm_256_8_only_auth() sets a crypto | 1011 * @brief srtp_crypto_policy_set_aes_gcm_256_8_only_auth() sets a crypto |
800 * policy structure to an AEAD authentication-only policy | 1012 * policy structure to an AEAD authentication-only policy |
801 * | 1013 * |
802 * @param p is a pointer to the policy structure to be set | 1014 * @param p is a pointer to the policy structure to be set |
803 * | 1015 * |
804 * The function call crypto_policy_set_aes_gcm_256_8_only_auth(&p) sets | 1016 * The function call srtp_crypto_policy_set_aes_gcm_256_8_only_auth(&p) sets |
805 * the crypto_policy_t at location p to use the SRTP default cipher | 1017 * the srtp_crypto_policy_t at location p to use the SRTP default cipher |
806 * (AES-256 Galois Counter Mode) with 8 octet auth tag. This policy | 1018 * (AES-256 Galois Counter Mode) with 8 octet auth tag. This policy |
807 * applies confidentiality and authentication to the RTP packets, | 1019 * applies confidentiality and authentication to the RTP packets, |
808 * but only authentication to the RTCP packets. | 1020 * but only authentication to the RTCP packets. |
809 * | 1021 * |
810 * This function is a convenience that helps to avoid dealing directly | 1022 * This function is a convenience that helps to avoid dealing directly |
811 * with the policy data structure. You are encouraged to initialize | 1023 * with the policy data structure. You are encouraged to initialize |
812 * policy elements with this function call. Doing so may allow your | 1024 * policy elements with this function call. Doing so may allow your |
813 * code to be forward compatible with later versions of libSRTP that | 1025 * code to be forward compatible with later versions of libSRTP that |
814 * include more elements in the crypto_policy_t datatype. | 1026 * include more elements in the srtp_crypto_policy_t datatype. |
815 * | 1027 * |
816 * @return void. | 1028 * @return void. |
817 * | 1029 * |
818 */ | 1030 */ |
819 void | 1031 void srtp_crypto_policy_set_aes_gcm_256_8_only_auth(srtp_crypto_policy_t *p); |
820 crypto_policy_set_aes_gcm_256_8_only_auth(crypto_policy_t *p); | |
821 | 1032 |
822 /** | 1033 /** |
823 * @brief crypto_policy_set_aes_gcm_128_16_auth() sets a crypto | 1034 * @brief srtp_crypto_policy_set_aes_gcm_128_16_auth() sets a crypto |
824 * policy structure to an AEAD encryption policy. | 1035 * policy structure to an AEAD encryption policy. |
825 * | 1036 * |
826 * @param p is a pointer to the policy structure to be set | 1037 * @param p is a pointer to the policy structure to be set |
827 * | 1038 * |
828 * The function call crypto_policy_set_aes_gcm_128_16_auth(&p) sets | 1039 * The function call srtp_crypto_policy_set_aes_gcm_128_16_auth(&p) sets |
829 * the crypto_policy_t at location p to use the SRTP default cipher | 1040 * the srtp_crypto_policy_t at location p to use the SRTP default cipher |
830 * (AES-128 Galois Counter Mode) with 16 octet auth tag. This | 1041 * (AES-128 Galois Counter Mode) with 16 octet auth tag. This |
831 * policy applies confidentiality and authentication to both the | 1042 * policy applies confidentiality and authentication to both the |
832 * RTP and RTCP packets. | 1043 * RTP and RTCP packets. |
833 * | 1044 * |
834 * This function is a convenience that helps to avoid dealing directly | 1045 * This function is a convenience that helps to avoid dealing directly |
835 * with the policy data structure. You are encouraged to initialize | 1046 * with the policy data structure. You are encouraged to initialize |
836 * policy elements with this function call. Doing so may allow your | 1047 * policy elements with this function call. Doing so may allow your |
837 * code to be forward compatible with later versions of libSRTP that | 1048 * code to be forward compatible with later versions of libSRTP that |
838 * include more elements in the crypto_policy_t datatype. | 1049 * include more elements in the srtp_crypto_policy_t datatype. |
839 * | 1050 * |
840 * @return void. | 1051 * @return void. |
841 * | 1052 * |
842 */ | 1053 */ |
843 void | 1054 void srtp_crypto_policy_set_aes_gcm_128_16_auth(srtp_crypto_policy_t *p); |
844 crypto_policy_set_aes_gcm_128_16_auth(crypto_policy_t *p); | |
845 | 1055 |
846 /** | 1056 /** |
847 * @brief crypto_policy_set_aes_gcm_256_16_auth() sets a crypto | 1057 * @brief srtp_crypto_policy_set_aes_gcm_256_16_auth() sets a crypto |
848 * policy structure to an AEAD encryption policy | 1058 * policy structure to an AEAD encryption policy |
849 * | 1059 * |
850 * @param p is a pointer to the policy structure to be set | 1060 * @param p is a pointer to the policy structure to be set |
851 * | 1061 * |
852 * The function call crypto_policy_set_aes_gcm_256_16_auth(&p) sets | 1062 * The function call srtp_crypto_policy_set_aes_gcm_256_16_auth(&p) sets |
853 * the crypto_policy_t at location p to use the SRTP default cipher | 1063 * the srtp_crypto_policy_t at location p to use the SRTP default cipher |
854 * (AES-256 Galois Counter Mode) with 16 octet auth tag. This | 1064 * (AES-256 Galois Counter Mode) with 16 octet auth tag. This |
855 * policy applies confidentiality and authentication to both the | 1065 * policy applies confidentiality and authentication to both the |
856 * RTP and RTCP packets. | 1066 * RTP and RTCP packets. |
857 * | 1067 * |
858 * This function is a convenience that helps to avoid dealing directly | 1068 * This function is a convenience that helps to avoid dealing directly |
859 * with the policy data structure. You are encouraged to initialize | 1069 * with the policy data structure. You are encouraged to initialize |
860 * policy elements with this function call. Doing so may allow your | 1070 * policy elements with this function call. Doing so may allow your |
861 * code to be forward compatible with later versions of libSRTP that | 1071 * code to be forward compatible with later versions of libSRTP that |
862 * include more elements in the crypto_policy_t datatype. | 1072 * include more elements in the srtp_crypto_policy_t datatype. |
863 * | 1073 * |
864 * @return void. | 1074 * @return void. |
865 * | 1075 * |
866 */ | 1076 */ |
867 void | 1077 void srtp_crypto_policy_set_aes_gcm_256_16_auth(srtp_crypto_policy_t *p); |
868 crypto_policy_set_aes_gcm_256_16_auth(crypto_policy_t *p); | |
869 | 1078 |
870 | 1079 |
871 /** | 1080 /** |
872 * @brief srtp_dealloc() deallocates storage for an SRTP session | 1081 * @brief srtp_dealloc() deallocates storage for an SRTP session |
873 * context. | 1082 * context. |
874 * | 1083 * |
875 * The function call srtp_dealloc(s) deallocates storage for the | 1084 * The function call srtp_dealloc(s) deallocates storage for the |
876 * SRTP session context s. This function should be called no more | 1085 * SRTP session context s. This function should be called no more |
877 * than one time for each of the contexts allocated by the function | 1086 * than one time for each of the contexts allocated by the function |
878 * srtp_create(). | 1087 * srtp_create(). |
879 * | 1088 * |
880 * @param s is the srtp_t for the session to be deallocated. | 1089 * @param s is the srtp_t for the session to be deallocated. |
881 * | 1090 * |
882 * @return | 1091 * @return |
883 * - err_status_ok if there no problems. | 1092 * - srtp_err_status_ok if there no problems. |
884 * - err_status_dealloc_fail a memory deallocation failure occured. | 1093 * - srtp_err_status_dealloc_fail a memory deallocation failure occured. |
885 */ | 1094 */ |
886 | 1095 |
887 err_status_t | 1096 srtp_err_status_t srtp_dealloc(srtp_t s); |
888 srtp_dealloc(srtp_t s); | |
889 | 1097 |
890 | 1098 |
891 /* | 1099 /* |
892 * @brief identifies a particular SRTP profile | 1100 * @brief identifies a particular SRTP profile |
893 * | 1101 * |
894 * An srtp_profile_t enumeration is used to identify a particular SRTP | 1102 * An srtp_profile_t enumeration is used to identify a particular SRTP |
895 * profile (that is, a set of algorithms and parameters). These | 1103 * profile (that is, a set of algorithms and parameters). These |
896 * profiles are defined in the DTLS-SRTP draft. | 1104 * profiles are defined in the DTLS-SRTP draft. |
897 */ | 1105 */ |
898 | 1106 |
899 typedef enum { | 1107 typedef enum { |
900 srtp_profile_reserved = 0, | 1108 srtp_profile_reserved = 0, |
901 srtp_profile_aes128_cm_sha1_80 = 1, | 1109 srtp_profile_aes128_cm_sha1_80 = 1, |
902 srtp_profile_aes128_cm_sha1_32 = 2, | 1110 srtp_profile_aes128_cm_sha1_32 = 2, |
903 srtp_profile_aes256_cm_sha1_80 = 3, | 1111 srtp_profile_aes256_cm_sha1_80 = 3, |
904 srtp_profile_aes256_cm_sha1_32 = 4, | 1112 srtp_profile_aes256_cm_sha1_32 = 4, |
905 srtp_profile_null_sha1_80 = 5, | 1113 srtp_profile_null_sha1_80 = 5, |
906 srtp_profile_null_sha1_32 = 6, | 1114 srtp_profile_null_sha1_32 = 6, |
907 } srtp_profile_t; | 1115 } srtp_profile_t; |
908 | 1116 |
909 | 1117 |
910 /** | 1118 /** |
911 * @brief crypto_policy_set_from_profile_for_rtp() sets a crypto policy | 1119 * @brief srtp_crypto_policy_set_from_profile_for_rtp() sets a crypto policy |
912 * structure to the appropriate value for RTP based on an srtp_profile_t | 1120 * structure to the appropriate value for RTP based on an srtp_profile_t |
913 * | 1121 * |
914 * @param p is a pointer to the policy structure to be set | 1122 * @param p is a pointer to the policy structure to be set |
915 * | 1123 * |
916 * The function call crypto_policy_set_rtp_default(&policy, profile) | 1124 * The function call srtp_crypto_policy_set_rtp_default(&policy, profile) |
917 * sets the crypto_policy_t at location policy to the policy for RTP | 1125 * sets the srtp_crypto_policy_t at location policy to the policy for RTP |
918 * protection, as defined by the srtp_profile_t profile. | 1126 * protection, as defined by the srtp_profile_t profile. |
919 * | 1127 * |
920 * This function is a convenience that helps to avoid dealing directly | 1128 * This function is a convenience that helps to avoid dealing directly |
921 * with the policy data structure. You are encouraged to initialize | 1129 * with the policy data structure. You are encouraged to initialize |
922 * policy elements with this function call. Doing so may allow your | 1130 * policy elements with this function call. Doing so may allow your |
923 * code to be forward compatible with later versions of libSRTP that | 1131 * code to be forward compatible with later versions of libSRTP that |
924 * include more elements in the crypto_policy_t datatype. | 1132 * include more elements in the srtp_crypto_policy_t datatype. |
925 * | 1133 * |
926 * @return values | 1134 * @return values |
927 * - err_status_ok no problems were encountered | 1135 * - srtp_err_status_ok no problems were encountered |
928 * - err_status_bad_param the profile is not supported | 1136 * - srtp_err_status_bad_param the profile is not supported |
929 * | 1137 * |
930 */ | 1138 */ |
931 err_status_t | 1139 srtp_err_status_t srtp_crypto_policy_set_from_profile_for_rtp(srtp_crypto_policy
_t *policy, srtp_profile_t profile); |
932 crypto_policy_set_from_profile_for_rtp(crypto_policy_t *policy, | |
933 » » » » srtp_profile_t profile); | |
934 | 1140 |
935 | 1141 |
936 | 1142 |
937 | 1143 |
938 /** | 1144 /** |
939 * @brief crypto_policy_set_from_profile_for_rtcp() sets a crypto policy | 1145 * @brief srtp_crypto_policy_set_from_profile_for_rtcp() sets a crypto policy |
940 * structure to the appropriate value for RTCP based on an srtp_profile_t | 1146 * structure to the appropriate value for RTCP based on an srtp_profile_t |
941 * | 1147 * |
942 * @param p is a pointer to the policy structure to be set | 1148 * @param p is a pointer to the policy structure to be set |
943 * | 1149 * |
944 * The function call crypto_policy_set_rtcp_default(&policy, profile) | 1150 * The function call srtp_crypto_policy_set_rtcp_default(&policy, profile) |
945 * sets the crypto_policy_t at location policy to the policy for RTCP | 1151 * sets the srtp_crypto_policy_t at location policy to the policy for RTCP |
946 * protection, as defined by the srtp_profile_t profile. | 1152 * protection, as defined by the srtp_profile_t profile. |
947 * | 1153 * |
948 * This function is a convenience that helps to avoid dealing directly | 1154 * This function is a convenience that helps to avoid dealing directly |
949 * with the policy data structure. You are encouraged to initialize | 1155 * with the policy data structure. You are encouraged to initialize |
950 * policy elements with this function call. Doing so may allow your | 1156 * policy elements with this function call. Doing so may allow your |
951 * code to be forward compatible with later versions of libSRTP that | 1157 * code to be forward compatible with later versions of libSRTP that |
952 * include more elements in the crypto_policy_t datatype. | 1158 * include more elements in the srtp_crypto_policy_t datatype. |
953 * | 1159 * |
954 * @return values | 1160 * @return values |
955 * - err_status_ok no problems were encountered | 1161 * - srtp_err_status_ok no problems were encountered |
956 * - err_status_bad_param the profile is not supported | 1162 * - srtp_err_status_bad_param the profile is not supported |
957 * | 1163 * |
958 */ | 1164 */ |
959 err_status_t | 1165 srtp_err_status_t srtp_crypto_policy_set_from_profile_for_rtcp(srtp_crypto_polic
y_t *policy, srtp_profile_t profile); |
960 crypto_policy_set_from_profile_for_rtcp(crypto_policy_t *policy, | |
961 » » » » srtp_profile_t profile); | |
962 | 1166 |
963 /** | 1167 /** |
964 * @brief returns the master key length for a given SRTP profile | 1168 * @brief returns the master key length for a given SRTP profile |
965 */ | 1169 */ |
966 unsigned int | 1170 unsigned int |
967 srtp_profile_get_master_key_length(srtp_profile_t profile); | 1171 srtp_profile_get_master_key_length(srtp_profile_t profile); |
968 | 1172 |
969 | 1173 |
970 /** | 1174 /** |
971 * @brief returns the master salt length for a given SRTP profile | 1175 * @brief returns the master salt length for a given SRTP profile |
972 */ | 1176 */ |
973 unsigned int | 1177 unsigned int |
974 srtp_profile_get_master_salt_length(srtp_profile_t profile); | 1178 srtp_profile_get_master_salt_length(srtp_profile_t profile); |
975 | 1179 |
976 /** | 1180 /** |
977 * @brief appends the salt to the key | 1181 * @brief appends the salt to the key |
978 * | 1182 * |
979 * The function call append_salt_to_key(k, klen, s, slen) | 1183 * The function call srtp_append_salt_to_key(k, klen, s, slen) |
980 * copies the string s to the location at klen bytes following | 1184 * copies the string s to the location at klen bytes following |
981 * the location k. | 1185 * the location k. |
982 * | 1186 * |
983 * @warning There must be at least bytes_in_salt + bytes_in_key bytes | 1187 * @warning There must be at least bytes_in_salt + bytes_in_key bytes |
984 * available at the location pointed to by key. | 1188 * available at the location pointed to by key. |
985 * | 1189 * |
986 */ | 1190 */ |
987 | 1191 |
988 void | 1192 void |
989 append_salt_to_key(unsigned char *key, unsigned int bytes_in_key, | 1193 srtp_append_salt_to_key(unsigned char *key, unsigned int bytes_in_key, |
990 » » unsigned char *salt, unsigned int bytes_in_salt); | 1194 » » unsigned char *salt, unsigned int bytes_in_salt); |
991 | 1195 |
992 | 1196 |
993 | 1197 |
994 /** | 1198 /** |
995 * @} | 1199 * @} |
996 */ | 1200 */ |
997 | 1201 |
998 | 1202 |
999 | 1203 |
1000 /** | 1204 /** |
(...skipping 14 matching lines...) Expand all Loading... |
1015 * | 1219 * |
1016 * @{ | 1220 * @{ |
1017 */ | 1221 */ |
1018 | 1222 |
1019 /** | 1223 /** |
1020 * @brief srtp_protect_rtcp() is the Secure RTCP sender-side packet | 1224 * @brief srtp_protect_rtcp() is the Secure RTCP sender-side packet |
1021 * processing function. | 1225 * processing function. |
1022 * | 1226 * |
1023 * The function call srtp_protect_rtcp(ctx, rtp_hdr, len_ptr) applies | 1227 * The function call srtp_protect_rtcp(ctx, rtp_hdr, len_ptr) applies |
1024 * SRTCP protection to the RTCP packet rtcp_hdr (which has length | 1228 * SRTCP protection to the RTCP packet rtcp_hdr (which has length |
1025 * *len_ptr) using the SRTP session context ctx. If err_status_ok is | 1229 * *len_ptr) using the SRTP session context ctx. If srtp_err_status_ok is |
1026 * returned, then rtp_hdr points to the resulting SRTCP packet and | 1230 * returned, then rtp_hdr points to the resulting SRTCP packet and |
1027 * *len_ptr is the number of octets in that packet; otherwise, no | 1231 * *len_ptr is the number of octets in that packet; otherwise, no |
1028 * assumptions should be made about the value of either data elements. | 1232 * assumptions should be made about the value of either data elements. |
1029 * | 1233 * |
1030 * @warning This function assumes that it can write the authentication | 1234 * @warning This function assumes that it can write the authentication |
1031 * tag into the location in memory immediately following the RTCP | 1235 * tag into the location in memory immediately following the RTCP |
1032 * packet, and assumes that the RTCP packet is aligned on a 32-bit | 1236 * packet, and assumes that the RTCP packet is aligned on a 32-bit |
1033 * boundary. | 1237 * boundary. |
1034 * | 1238 * |
1035 * @warning This function assumes that it can write SRTP_MAX_TRAILER_LEN+4 | 1239 * @warning This function assumes that it can write SRTP_MAX_TRAILER_LEN+4 |
1036 * into the location in memory immediately following the RTCP packet. | 1240 * into the location in memory immediately following the RTCP packet. |
1037 * Callers MUST ensure that this much writable memory is available in | 1241 * Callers MUST ensure that this much writable memory is available in |
1038 * the buffer that holds the RTCP packet. | 1242 * the buffer that holds the RTCP packet. |
1039 * | 1243 * |
1040 * @param ctx is the SRTP context to use in processing the packet. | 1244 * @param ctx is the SRTP context to use in processing the packet. |
1041 * | 1245 * |
1042 * @param rtcp_hdr is a pointer to the RTCP packet (before the call); after | 1246 * @param rtcp_hdr is a pointer to the RTCP packet (before the call); after |
1043 * the function returns, it points to the srtp packet. | 1247 * the function returns, it points to the srtp packet. |
1044 * | 1248 * |
1045 * @param pkt_octet_len is a pointer to the length in octets of the | 1249 * @param pkt_octet_len is a pointer to the length in octets of the |
1046 * complete RTCP packet (header and body) before the function call, | 1250 * complete RTCP packet (header and body) before the function call, |
1047 * and of the complete SRTCP packet after the call, if err_status_ok | 1251 * and of the complete SRTCP packet after the call, if srtp_err_status_ok |
1048 * was returned. Otherwise, the value of the data to which it points | 1252 * was returned. Otherwise, the value of the data to which it points |
1049 * is undefined. | 1253 * is undefined. |
1050 * | 1254 * |
1051 * @return | 1255 * @return |
1052 * - err_status_ok if there were no problems. | 1256 * - srtp_err_status_ok if there were no problems. |
1053 * - [other] if there was a failure in | 1257 * - [other] if there was a failure in |
1054 * the cryptographic mechanisms. | 1258 * the cryptographic mechanisms. |
1055 */ | 1259 */ |
1056 | 1260 |
1057 | 1261 |
1058 err_status_t | 1262 srtp_err_status_t srtp_protect_rtcp(srtp_t ctx, void *rtcp_hdr, int *pkt_octet_l
en); |
1059 srtp_protect_rtcp(srtp_t ctx, void *rtcp_hdr, int *pkt_octet_len); | |
1060 | 1263 |
1061 /** | 1264 /** |
1062 * @brief srtp_unprotect_rtcp() is the Secure RTCP receiver-side packet | 1265 * @brief srtp_unprotect_rtcp() is the Secure RTCP receiver-side packet |
1063 * processing function. | 1266 * processing function. |
1064 * | 1267 * |
1065 * The function call srtp_unprotect_rtcp(ctx, srtp_hdr, len_ptr) | 1268 * The function call srtp_unprotect_rtcp(ctx, srtp_hdr, len_ptr) |
1066 * verifies the Secure RTCP protection of the SRTCP packet pointed to | 1269 * verifies the Secure RTCP protection of the SRTCP packet pointed to |
1067 * by srtcp_hdr (which has length *len_ptr), using the SRTP session | 1270 * by srtcp_hdr (which has length *len_ptr), using the SRTP session |
1068 * context ctx. If err_status_ok is returned, then srtcp_hdr points | 1271 * context ctx. If srtp_err_status_ok is returned, then srtcp_hdr points |
1069 * to the resulting RTCP packet and *len_ptr is the number of octets | 1272 * to the resulting RTCP packet and *len_ptr is the number of octets |
1070 * in that packet; otherwise, no assumptions should be made about the | 1273 * in that packet; otherwise, no assumptions should be made about the |
1071 * value of either data elements. | 1274 * value of either data elements. |
1072 * | 1275 * |
1073 * @warning This function assumes that the SRTCP packet is aligned on a | 1276 * @warning This function assumes that the SRTCP packet is aligned on a |
1074 * 32-bit boundary. | 1277 * 32-bit boundary. |
1075 * | 1278 * |
1076 * @param ctx is a pointer to the srtp_t which applies to the | 1279 * @param ctx is a pointer to the srtp_t which applies to the |
1077 * particular packet. | 1280 * particular packet. |
1078 * | 1281 * |
1079 * @param srtcp_hdr is a pointer to the header of the SRTCP packet | 1282 * @param srtcp_hdr is a pointer to the header of the SRTCP packet |
1080 * (before the call). After the function returns, it points to the | 1283 * (before the call). After the function returns, it points to the |
1081 * rtp packet if err_status_ok was returned; otherwise, the value of | 1284 * rtp packet if srtp_err_status_ok was returned; otherwise, the value of |
1082 * the data to which it points is undefined. | 1285 * the data to which it points is undefined. |
1083 * | 1286 * |
1084 * @param pkt_octet_len is a pointer to the length in octets of the | 1287 * @param pkt_octet_len is a pointer to the length in octets of the |
1085 * complete SRTCP packet (header and body) before the function call, | 1288 * complete SRTCP packet (header and body) before the function call, |
1086 * and of the complete rtp packet after the call, if err_status_ok was | 1289 * and of the complete rtp packet after the call, if srtp_err_status_ok was |
1087 * returned. Otherwise, the value of the data to which it points is | 1290 * returned. Otherwise, the value of the data to which it points is |
1088 * undefined. | 1291 * undefined. |
1089 * | 1292 * |
1090 * @return | 1293 * @return |
1091 * - err_status_ok if the RTCP packet is valid. | 1294 * - srtp_err_status_ok if the RTCP packet is valid. |
1092 * - err_status_auth_fail if the SRTCP packet failed the message | 1295 * - srtp_err_status_auth_fail if the SRTCP packet failed the message |
1093 * authentication check. | 1296 * authentication check. |
1094 * - err_status_replay_fail if the SRTCP packet is a replay (e.g. has | 1297 * - srtp_err_status_replay_fail if the SRTCP packet is a replay (e.g. has |
1095 * already been processed and accepted). | 1298 * already been processed and accepted). |
1096 * - [other] if there has been an error in the cryptographic mechanisms. | 1299 * - [other] if there has been an error in the cryptographic mechanisms. |
1097 * | 1300 * |
1098 */ | 1301 */ |
1099 | 1302 |
1100 err_status_t | 1303 srtp_err_status_t srtp_unprotect_rtcp(srtp_t ctx, void *srtcp_hdr, int *pkt_octe
t_len); |
1101 srtp_unprotect_rtcp(srtp_t ctx, void *srtcp_hdr, int *pkt_octet_len); | |
1102 | 1304 |
1103 /** | 1305 /** |
1104 * @} | 1306 * @} |
1105 */ | 1307 */ |
1106 | 1308 |
1107 | 1309 |
1108 /** | 1310 /** |
1109 * @defgroup User data associated to a SRTP session. | 1311 * @defgroup User data associated to a SRTP session. |
1110 * @ingroup SRTP | 1312 * @ingroup SRTP |
1111 * | 1313 * |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 * @brief srtp_event_t defines events that need to be handled | 1385 * @brief srtp_event_t defines events that need to be handled |
1184 * | 1386 * |
1185 * The enum srtp_event_t defines events that need to be handled | 1387 * The enum srtp_event_t defines events that need to be handled |
1186 * outside the `data plane', such as SSRC collisions and | 1388 * outside the `data plane', such as SSRC collisions and |
1187 * key expirations. | 1389 * key expirations. |
1188 * | 1390 * |
1189 * When a key expires or the maximum number of packets has been | 1391 * When a key expires or the maximum number of packets has been |
1190 * reached, an SRTP stream will enter an `expired' state in which no | 1392 * reached, an SRTP stream will enter an `expired' state in which no |
1191 * more packets can be protected or unprotected. When this happens, | 1393 * more packets can be protected or unprotected. When this happens, |
1192 * it is likely that you will want to either deallocate the stream | 1394 * it is likely that you will want to either deallocate the stream |
1193 * (using srtp_stream_dealloc()), and possibly allocate a new one. | 1395 * (using srtp_remove_stream()), and possibly allocate a new one. |
1194 * | 1396 * |
1195 * When an SRTP stream expires, the other streams in the same session | 1397 * When an SRTP stream expires, the other streams in the same session |
1196 * are unaffected, unless key sharing is used by that stream. In the | 1398 * are unaffected, unless key sharing is used by that stream. In the |
1197 * latter case, all of the streams in the session will expire. | 1399 * latter case, all of the streams in the session will expire. |
1198 */ | 1400 */ |
1199 | 1401 |
1200 typedef enum { | 1402 typedef enum { |
1201 event_ssrc_collision, /**< | 1403 event_ssrc_collision, /**< |
1202 * An SSRC collision occured. | 1404 * An SSRC collision occured. |
1203 */ | 1405 */ |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1245 * The function call srtp_install_event_handler(func) sets the event | 1447 * The function call srtp_install_event_handler(func) sets the event |
1246 * handler function to the value func. The value NULL is acceptable | 1448 * handler function to the value func. The value NULL is acceptable |
1247 * as an argument; in this case, events will be ignored rather than | 1449 * as an argument; in this case, events will be ignored rather than |
1248 * handled. | 1450 * handled. |
1249 * | 1451 * |
1250 * @param func is a pointer to a fuction that takes an srtp_event_data_t | 1452 * @param func is a pointer to a fuction that takes an srtp_event_data_t |
1251 * pointer as an argument and returns void. This function | 1453 * pointer as an argument and returns void. This function |
1252 * will be used by libSRTP to handle events. | 1454 * will be used by libSRTP to handle events. |
1253 */ | 1455 */ |
1254 | 1456 |
1255 err_status_t | 1457 srtp_err_status_t srtp_install_event_handler(srtp_event_handler_func_t func); |
1256 srtp_install_event_handler(srtp_event_handler_func_t func); | |
1257 | 1458 |
1258 /** | 1459 /** |
1259 * @brief Returns the version string of the library. | 1460 * @brief Returns the version string of the library. |
1260 * | 1461 * |
1261 */ | 1462 */ |
1262 const char *srtp_get_version_string(void); | 1463 const char *srtp_get_version_string(void); |
1263 | 1464 |
1264 /** | 1465 /** |
1265 * @brief Returns the numeric representation of the library version. | 1466 * @brief Returns the numeric representation of the library version. |
1266 * | 1467 * |
1267 */ | 1468 */ |
1268 unsigned int srtp_get_version(void); | 1469 unsigned int srtp_get_version(void); |
1269 | 1470 |
1270 /** | 1471 /** |
| 1472 * @brief srtp_set_debug_module(mod_name, v) |
| 1473 * |
| 1474 * sets dynamic debugging to the value v (0 for off, 1 for on) for the |
| 1475 * debug module with the name mod_name |
| 1476 * |
| 1477 * returns err_status_ok on success, err_status_fail otherwise |
| 1478 */ |
| 1479 srtp_err_status_t srtp_set_debug_module(char *mod_name, int v); |
| 1480 |
| 1481 /** |
| 1482 * @brief srtp_list_debug_modules() outputs a list of debugging modules |
| 1483 * |
| 1484 */ |
| 1485 srtp_err_status_t srtp_list_debug_modules(void); |
| 1486 |
| 1487 |
| 1488 /** |
1271 * @} | 1489 * @} |
1272 */ | 1490 */ |
1273 /* in host order, so outside the #if */ | 1491 /* in host order, so outside the #if */ |
1274 #define SRTCP_E_BIT 0x80000000 | 1492 #define SRTCP_E_BIT 0x80000000 |
1275 /* for byte-access */ | 1493 /* for byte-access */ |
1276 #define SRTCP_E_BYTE_BIT 0x80 | 1494 #define SRTCP_E_BYTE_BIT 0x80 |
1277 #define SRTCP_INDEX_MASK 0x7fffffff | 1495 #define SRTCP_INDEX_MASK 0x7fffffff |
1278 | 1496 |
1279 #ifdef __cplusplus | 1497 #ifdef __cplusplus |
1280 } | 1498 } |
1281 #endif | 1499 #endif |
1282 | 1500 |
1283 #endif /* SRTP_H */ | 1501 #endif /* SRTP_H */ |
OLD | NEW |