netwerk/srtp/src/include/srtp.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /*
michael@0 2 * srtp.h
michael@0 3 *
michael@0 4 * interface to libsrtp
michael@0 5 *
michael@0 6 * David A. McGrew
michael@0 7 * Cisco Systems, Inc.
michael@0 8 */
michael@0 9 /*
michael@0 10 *
michael@0 11 * Copyright (c) 2001-2006, Cisco Systems, Inc.
michael@0 12 * All rights reserved.
michael@0 13 *
michael@0 14 * Redistribution and use in source and binary forms, with or without
michael@0 15 * modification, are permitted provided that the following conditions
michael@0 16 * are met:
michael@0 17 *
michael@0 18 * Redistributions of source code must retain the above copyright
michael@0 19 * notice, this list of conditions and the following disclaimer.
michael@0 20 *
michael@0 21 * Redistributions in binary form must reproduce the above
michael@0 22 * copyright notice, this list of conditions and the following
michael@0 23 * disclaimer in the documentation and/or other materials provided
michael@0 24 * with the distribution.
michael@0 25 *
michael@0 26 * Neither the name of the Cisco Systems, Inc. nor the names of its
michael@0 27 * contributors may be used to endorse or promote products derived
michael@0 28 * from this software without specific prior written permission.
michael@0 29 *
michael@0 30 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
michael@0 31 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
michael@0 32 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
michael@0 33 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
michael@0 34 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
michael@0 35 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
michael@0 36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
michael@0 37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
michael@0 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
michael@0 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
michael@0 40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
michael@0 41 * OF THE POSSIBILITY OF SUCH DAMAGE.
michael@0 42 *
michael@0 43 */
michael@0 44
michael@0 45
michael@0 46 #ifndef SRTP_H
michael@0 47 #define SRTP_H
michael@0 48
michael@0 49 #ifdef __cplusplus
michael@0 50 extern "C" {
michael@0 51 #endif
michael@0 52
michael@0 53 #include "crypto_kernel.h"
michael@0 54
michael@0 55 /**
michael@0 56 * @defgroup SRTP Secure RTP
michael@0 57 *
michael@0 58 * @brief libSRTP provides functions for protecting RTP and RTCP. See
michael@0 59 * Section @ref Overview for an introduction to the use of the library.
michael@0 60 *
michael@0 61 * @{
michael@0 62 */
michael@0 63
michael@0 64 /*
michael@0 65 * SRTP_MASTER_KEY_LEN is the nominal master key length supported by libSRTP
michael@0 66 */
michael@0 67
michael@0 68 #define SRTP_MASTER_KEY_LEN 30
michael@0 69
michael@0 70 /*
michael@0 71 * SRTP_MAX_KEY_LEN is the maximum key length supported by libSRTP
michael@0 72 */
michael@0 73 #define SRTP_MAX_KEY_LEN 64
michael@0 74
michael@0 75 /*
michael@0 76 * SRTP_MAX_TAG_LEN is the maximum tag length supported by libSRTP
michael@0 77 */
michael@0 78
michael@0 79 #define SRTP_MAX_TAG_LEN 12
michael@0 80
michael@0 81 /**
michael@0 82 * SRTP_MAX_TRAILER_LEN is the maximum length of the SRTP trailer
michael@0 83 * (authentication tag and MKI) supported by libSRTP. This value is
michael@0 84 * the maximum number of octets that will be added to an RTP packet by
michael@0 85 * srtp_protect().
michael@0 86 *
michael@0 87 * @brief the maximum number of octets added by srtp_protect().
michael@0 88 */
michael@0 89 #define SRTP_MAX_TRAILER_LEN SRTP_MAX_TAG_LEN
michael@0 90
michael@0 91 /*
michael@0 92 * nota bene: since libSRTP doesn't support the use of the MKI, the
michael@0 93 * SRTP_MAX_TRAILER_LEN value is just the maximum tag length
michael@0 94 */
michael@0 95
michael@0 96 /**
michael@0 97 * @brief sec_serv_t describes a set of security services.
michael@0 98 *
michael@0 99 * A sec_serv_t enumeration is used to describe the particular
michael@0 100 * security services that will be applied by a particular crypto
michael@0 101 * policy (or other mechanism).
michael@0 102 */
michael@0 103
michael@0 104 typedef enum {
michael@0 105 sec_serv_none = 0, /**< no services */
michael@0 106 sec_serv_conf = 1, /**< confidentiality */
michael@0 107 sec_serv_auth = 2, /**< authentication */
michael@0 108 sec_serv_conf_and_auth = 3 /**< confidentiality and authentication */
michael@0 109 } sec_serv_t;
michael@0 110
michael@0 111 /**
michael@0 112 * @brief crypto_policy_t describes a particular crypto policy that
michael@0 113 * can be applied to an SRTP stream.
michael@0 114 *
michael@0 115 * A crypto_policy_t describes a particular cryptographic policy that
michael@0 116 * can be applied to an SRTP or SRTCP stream. An SRTP session policy
michael@0 117 * consists of a list of these policies, one for each SRTP stream
michael@0 118 * in the session.
michael@0 119 */
michael@0 120
michael@0 121 typedef struct crypto_policy_t {
michael@0 122 cipher_type_id_t cipher_type; /**< An integer representing
michael@0 123 * the type of cipher. */
michael@0 124 int cipher_key_len; /**< The length of the cipher key
michael@0 125 * in octets. */
michael@0 126 auth_type_id_t auth_type; /**< An integer representing the
michael@0 127 * authentication function. */
michael@0 128 int auth_key_len; /**< The length of the authentication
michael@0 129 * function key in octets. */
michael@0 130 int auth_tag_len; /**< The length of the authentication
michael@0 131 * tag in octets. */
michael@0 132 sec_serv_t sec_serv; /**< The flag indicating the security
michael@0 133 * services to be applied. */
michael@0 134 } crypto_policy_t;
michael@0 135
michael@0 136
michael@0 137 /**
michael@0 138 * @brief ssrc_type_t describes the type of an SSRC.
michael@0 139 *
michael@0 140 * An ssrc_type_t enumeration is used to indicate a type of SSRC. See
michael@0 141 * @ref srtp_policy_t for more informataion.
michael@0 142 */
michael@0 143
michael@0 144 typedef enum {
michael@0 145 ssrc_undefined = 0, /**< Indicates an undefined SSRC type. */
michael@0 146 ssrc_specific = 1, /**< Indicates a specific SSRC value */
michael@0 147 ssrc_any_inbound = 2, /**< Indicates any inbound SSRC value
michael@0 148 (i.e. a value that is used in the
michael@0 149 function srtp_unprotect()) */
michael@0 150 ssrc_any_outbound = 3 /**< Indicates any outbound SSRC value
michael@0 151 (i.e. a value that is used in the
michael@0 152 function srtp_protect()) */
michael@0 153 } ssrc_type_t;
michael@0 154
michael@0 155 /**
michael@0 156 * @brief An ssrc_t represents a particular SSRC value, or a `wildcard' SSRC.
michael@0 157 *
michael@0 158 * An ssrc_t represents a particular SSRC value (if its type is
michael@0 159 * ssrc_specific), or a wildcard SSRC value that will match all
michael@0 160 * outbound SSRCs (if its type is ssrc_any_outbound) or all inbound
michael@0 161 * SSRCs (if its type is ssrc_any_inbound).
michael@0 162 *
michael@0 163 */
michael@0 164
michael@0 165 typedef struct {
michael@0 166 ssrc_type_t type; /**< The type of this particular SSRC */
michael@0 167 unsigned int value; /**< The value of this SSRC, if it is not a wildcard */
michael@0 168 } ssrc_t;
michael@0 169
michael@0 170
michael@0 171 /**
michael@0 172 * @brief points to an EKT policy
michael@0 173 */
michael@0 174 typedef struct ekt_policy_ctx_t *ekt_policy_t;
michael@0 175
michael@0 176
michael@0 177 /**
michael@0 178 * @brief points to EKT stream data
michael@0 179 */
michael@0 180 typedef struct ekt_stream_ctx_t *ekt_stream_t;
michael@0 181
michael@0 182
michael@0 183 /**
michael@0 184 * @brief represents the policy for an SRTP session.
michael@0 185 *
michael@0 186 * A single srtp_policy_t struct represents the policy for a single
michael@0 187 * SRTP stream, and a linked list of these elements represents the
michael@0 188 * policy for an entire SRTP session. Each element contains the SRTP
michael@0 189 * and SRTCP crypto policies for that stream, a pointer to the SRTP
michael@0 190 * master key for that stream, the SSRC describing that stream, or a
michael@0 191 * flag indicating a `wildcard' SSRC value, and a `next' field that
michael@0 192 * holds a pointer to the next element in the list of policy elements,
michael@0 193 * or NULL if it is the last element.
michael@0 194 *
michael@0 195 * The wildcard value SSRC_ANY_INBOUND matches any SSRC from an
michael@0 196 * inbound stream that for which there is no explicit SSRC entry in
michael@0 197 * another policy element. Similarly, the value SSRC_ANY_OUTBOUND
michael@0 198 * will matches any SSRC from an outbound stream that does not appear
michael@0 199 * in another policy element. Note that wildcard SSRCs &b cannot be
michael@0 200 * used to match both inbound and outbound traffic. This restriction
michael@0 201 * is intentional, and it allows libSRTP to ensure that no security
michael@0 202 * lapses result from accidental re-use of SSRC values during key
michael@0 203 * sharing.
michael@0 204 *
michael@0 205 *
michael@0 206 * @warning The final element of the list @b must have its `next' pointer
michael@0 207 * set to NULL.
michael@0 208 */
michael@0 209
michael@0 210 typedef struct srtp_policy_t {
michael@0 211 ssrc_t ssrc; /**< The SSRC value of stream, or the
michael@0 212 * flags SSRC_ANY_INBOUND or
michael@0 213 * SSRC_ANY_OUTBOUND if key sharing
michael@0 214 * is used for this policy element.
michael@0 215 */
michael@0 216 crypto_policy_t rtp; /**< SRTP crypto policy. */
michael@0 217 crypto_policy_t rtcp; /**< SRTCP crypto policy. */
michael@0 218 unsigned char *key; /**< Pointer to the SRTP master key for
michael@0 219 * this stream. */
michael@0 220 ekt_policy_t ekt; /**< Pointer to the EKT policy structure
michael@0 221 * for this stream (if any) */
michael@0 222 unsigned long window_size; /**< The window size to use for replay
michael@0 223 * protection. */
michael@0 224 int allow_repeat_tx; /**< Whether retransmissions of
michael@0 225 * packets with the same sequence number
michael@0 226 * are allowed. (Note that such repeated
michael@0 227 * transmissions must have the same RTP
michael@0 228 * payload, or a severe security weakness
michael@0 229 * is introduced!) */
michael@0 230 struct srtp_policy_t *next; /**< Pointer to next stream policy. */
michael@0 231 } srtp_policy_t;
michael@0 232
michael@0 233
michael@0 234
michael@0 235
michael@0 236 /**
michael@0 237 * @brief An srtp_t points to an SRTP session structure.
michael@0 238 *
michael@0 239 * The typedef srtp_t is a pointer to a structure that represents
michael@0 240 * an SRTP session. This datatype is intentially opaque in
michael@0 241 * order to separate the interface from the implementation.
michael@0 242 *
michael@0 243 * An SRTP session consists of all of the traffic sent to the RTP and
michael@0 244 * RTCP destination transport addresses, using the RTP/SAVP (Secure
michael@0 245 * Audio/Video Profile). A session can be viewed as a set of SRTP
michael@0 246 * streams, each of which originates with a different participant.
michael@0 247 */
michael@0 248
michael@0 249 typedef struct srtp_ctx_t *srtp_t;
michael@0 250
michael@0 251
michael@0 252 /**
michael@0 253 * @brief An srtp_stream_t points to an SRTP stream structure.
michael@0 254 *
michael@0 255 * The typedef srtp_stream_t is a pointer to a structure that
michael@0 256 * represents an SRTP stream. This datatype is intentionally
michael@0 257 * opaque in order to separate the interface from the implementation.
michael@0 258 *
michael@0 259 * An SRTP stream consists of all of the traffic sent to an SRTP
michael@0 260 * session by a single participant. A session can be viewed as
michael@0 261 * a set of streams.
michael@0 262 *
michael@0 263 */
michael@0 264 typedef struct srtp_stream_ctx_t *srtp_stream_t;
michael@0 265
michael@0 266
michael@0 267
michael@0 268 /**
michael@0 269 * @brief srtp_init() initializes the srtp library.
michael@0 270 *
michael@0 271 * @warning This function @b must be called before any other srtp
michael@0 272 * functions.
michael@0 273 */
michael@0 274
michael@0 275 err_status_t
michael@0 276 srtp_init(void);
michael@0 277
michael@0 278 /**
michael@0 279 * @brief srtp_shutdown() de-initializes the srtp library.
michael@0 280 *
michael@0 281 * @warning No srtp functions may be called after calling this function.
michael@0 282 */
michael@0 283
michael@0 284 err_status_t
michael@0 285 srtp_shutdown(void);
michael@0 286
michael@0 287 /**
michael@0 288 * @brief srtp_protect() is the Secure RTP sender-side packet processing
michael@0 289 * function.
michael@0 290 *
michael@0 291 * The function call srtp_protect(ctx, rtp_hdr, len_ptr) applies SRTP
michael@0 292 * protection to the RTP packet rtp_hdr (which has length *len_ptr) using
michael@0 293 * the SRTP context ctx. If err_status_ok is returned, then rtp_hdr
michael@0 294 * points to the resulting SRTP packet and *len_ptr is the number of
michael@0 295 * octets in that packet; otherwise, no assumptions should be made
michael@0 296 * about the value of either data elements.
michael@0 297 *
michael@0 298 * The sequence numbers of the RTP packets presented to this function
michael@0 299 * need not be consecutive, but they @b must be out of order by less
michael@0 300 * than 2^15 = 32,768 packets.
michael@0 301 *
michael@0 302 * @warning This function assumes that it can write the authentication
michael@0 303 * tag into the location in memory immediately following the RTP
michael@0 304 * packet, and assumes that the RTP packet is aligned on a 32-bit
michael@0 305 * boundary.
michael@0 306 *
michael@0 307 * @param ctx is the SRTP context to use in processing the packet.
michael@0 308 *
michael@0 309 * @param rtp_hdr is a pointer to the RTP packet (before the call); after
michael@0 310 * the function returns, it points to the srtp packet.
michael@0 311 *
michael@0 312 * @param len_ptr is a pointer to the length in octets of the complete
michael@0 313 * RTP packet (header and body) before the function call, and of the
michael@0 314 * complete SRTP packet after the call, if err_status_ok was returned.
michael@0 315 * Otherwise, the value of the data to which it points is undefined.
michael@0 316 *
michael@0 317 * @return
michael@0 318 * - err_status_ok no problems
michael@0 319 * - err_status_replay_fail rtp sequence number was non-increasing
michael@0 320 * - @e other failure in cryptographic mechanisms
michael@0 321 */
michael@0 322
michael@0 323 err_status_t
michael@0 324 srtp_protect(srtp_t ctx, void *rtp_hdr, int *len_ptr);
michael@0 325
michael@0 326 /**
michael@0 327 * @brief srtp_unprotect() is the Secure RTP receiver-side packet
michael@0 328 * processing function.
michael@0 329 *
michael@0 330 * The function call srtp_unprotect(ctx, srtp_hdr, len_ptr) verifies
michael@0 331 * the Secure RTP protection of the SRTP packet pointed to by srtp_hdr
michael@0 332 * (which has length *len_ptr), using the SRTP context ctx. If
michael@0 333 * err_status_ok is returned, then srtp_hdr points to the resulting
michael@0 334 * RTP packet and *len_ptr is the number of octets in that packet;
michael@0 335 * otherwise, no assumptions should be made about the value of either
michael@0 336 * data elements.
michael@0 337 *
michael@0 338 * The sequence numbers of the RTP packets presented to this function
michael@0 339 * need not be consecutive, but they @b must be out of order by less
michael@0 340 * than 2^15 = 32,768 packets.
michael@0 341 *
michael@0 342 * @warning This function assumes that the SRTP packet is aligned on a
michael@0 343 * 32-bit boundary.
michael@0 344 *
michael@0 345 * @param ctx is a pointer to the srtp_t which applies to the
michael@0 346 * particular packet.
michael@0 347 *
michael@0 348 * @param srtp_hdr is a pointer to the header of the SRTP packet
michael@0 349 * (before the call). after the function returns, it points to the
michael@0 350 * rtp packet if err_status_ok was returned; otherwise, the value of
michael@0 351 * the data to which it points is undefined.
michael@0 352 *
michael@0 353 * @param len_ptr is a pointer to the length in octets of the complete
michael@0 354 * srtp packet (header and body) before the function call, and of the
michael@0 355 * complete rtp packet after the call, if err_status_ok was returned.
michael@0 356 * Otherwise, the value of the data to which it points is undefined.
michael@0 357 *
michael@0 358 * @return
michael@0 359 * - err_status_ok if the RTP packet is valid.
michael@0 360 * - err_status_auth_fail if the SRTP packet failed the message
michael@0 361 * authentication check.
michael@0 362 * - err_status_replay_fail if the SRTP packet is a replay (e.g. packet has
michael@0 363 * already been processed and accepted).
michael@0 364 * - [other] if there has been an error in the cryptographic mechanisms.
michael@0 365 *
michael@0 366 */
michael@0 367
michael@0 368 err_status_t
michael@0 369 srtp_unprotect(srtp_t ctx, void *srtp_hdr, int *len_ptr);
michael@0 370
michael@0 371
michael@0 372 /**
michael@0 373 * @brief srtp_create() allocates and initializes an SRTP session.
michael@0 374
michael@0 375 * The function call srtp_create(session, policy, key) allocates and
michael@0 376 * initializes an SRTP session context, applying the given policy and
michael@0 377 * key.
michael@0 378 *
michael@0 379 * @param session is the SRTP session to which the policy is to be added.
michael@0 380 *
michael@0 381 * @param policy is the srtp_policy_t struct that describes the policy
michael@0 382 * for the session. The struct may be a single element, or it may be
michael@0 383 * the head of a list, in which case each element of the list is
michael@0 384 * processed. It may also be NULL, in which case streams should be added
michael@0 385 * later using srtp_add_stream(). The final element of the list @b must
michael@0 386 * have its `next' field set to NULL.
michael@0 387 *
michael@0 388 * @return
michael@0 389 * - err_status_ok if creation succeded.
michael@0 390 * - err_status_alloc_fail if allocation failed.
michael@0 391 * - err_status_init_fail if initialization failed.
michael@0 392 */
michael@0 393
michael@0 394 err_status_t
michael@0 395 srtp_create(srtp_t *session, const srtp_policy_t *policy);
michael@0 396
michael@0 397
michael@0 398 /**
michael@0 399 * @brief srtp_add_stream() allocates and initializes an SRTP stream
michael@0 400 * within a given SRTP session.
michael@0 401 *
michael@0 402 * The function call srtp_add_stream(session, policy) allocates and
michael@0 403 * initializes a new SRTP stream within a given, previously created
michael@0 404 * session, applying the policy given as the other argument to that
michael@0 405 * stream.
michael@0 406 *
michael@0 407 * @return values:
michael@0 408 * - err_status_ok if stream creation succeded.
michael@0 409 * - err_status_alloc_fail if stream allocation failed
michael@0 410 * - err_status_init_fail if stream initialization failed.
michael@0 411 */
michael@0 412
michael@0 413 err_status_t
michael@0 414 srtp_add_stream(srtp_t session,
michael@0 415 const srtp_policy_t *policy);
michael@0 416
michael@0 417
michael@0 418 /**
michael@0 419 * @brief srtp_remove_stream() deallocates an SRTP stream.
michael@0 420 *
michael@0 421 * The function call srtp_remove_stream(session, ssrc) removes
michael@0 422 * the SRTP stream with the SSRC value ssrc from the SRTP session
michael@0 423 * context given by the argument session.
michael@0 424 *
michael@0 425 * @param session is the SRTP session from which the stream
michael@0 426 * will be removed.
michael@0 427 *
michael@0 428 * @param ssrc is the SSRC value of the stream to be removed.
michael@0 429 *
michael@0 430 * @warning Wildcard SSRC values cannot be removed from a
michael@0 431 * session.
michael@0 432 *
michael@0 433 * @return
michael@0 434 * - err_status_ok if the stream deallocation succeded.
michael@0 435 * - [other] otherwise.
michael@0 436 *
michael@0 437 */
michael@0 438
michael@0 439 err_status_t
michael@0 440 srtp_remove_stream(srtp_t session, unsigned int ssrc);
michael@0 441
michael@0 442 /**
michael@0 443 * @brief crypto_policy_set_rtp_default() sets a crypto policy
michael@0 444 * structure to the SRTP default policy for RTP protection.
michael@0 445 *
michael@0 446 * @param p is a pointer to the policy structure to be set
michael@0 447 *
michael@0 448 * The function call crypto_policy_set_rtp_default(&p) sets the
michael@0 449 * crypto_policy_t at location p to the SRTP default policy for RTP
michael@0 450 * protection, as defined in the specification. This function is a
michael@0 451 * convenience that helps to avoid dealing directly with the policy
michael@0 452 * data structure. You are encouraged to initialize policy elements
michael@0 453 * with this function call. Doing so may allow your code to be
michael@0 454 * forward compatible with later versions of libSRTP that include more
michael@0 455 * elements in the crypto_policy_t datatype.
michael@0 456 *
michael@0 457 * @return void.
michael@0 458 *
michael@0 459 */
michael@0 460
michael@0 461 void
michael@0 462 crypto_policy_set_rtp_default(crypto_policy_t *p);
michael@0 463
michael@0 464 /**
michael@0 465 * @brief crypto_policy_set_rtcp_default() sets a crypto policy
michael@0 466 * structure to the SRTP default policy for RTCP protection.
michael@0 467 *
michael@0 468 * @param p is a pointer to the policy structure to be set
michael@0 469 *
michael@0 470 * The function call crypto_policy_set_rtcp_default(&p) sets the
michael@0 471 * crypto_policy_t at location p to the SRTP default policy for RTCP
michael@0 472 * protection, as defined in the specification. This function is a
michael@0 473 * convenience that helps to avoid dealing directly with the policy
michael@0 474 * data structure. You are encouraged to initialize policy elements
michael@0 475 * with this function call. Doing so may allow your code to be
michael@0 476 * forward compatible with later versions of libSRTP that include more
michael@0 477 * elements in the crypto_policy_t datatype.
michael@0 478 *
michael@0 479 * @return void.
michael@0 480 *
michael@0 481 */
michael@0 482
michael@0 483 void
michael@0 484 crypto_policy_set_rtcp_default(crypto_policy_t *p);
michael@0 485
michael@0 486 /**
michael@0 487 * @brief crypto_policy_set_aes_cm_128_hmac_sha1_80() sets a crypto
michael@0 488 * policy structure to the SRTP default policy for RTP protection.
michael@0 489 *
michael@0 490 * @param p is a pointer to the policy structure to be set
michael@0 491 *
michael@0 492 * The function crypto_policy_set_aes_cm_128_hmac_sha1_80() is a
michael@0 493 * synonym for crypto_policy_set_rtp_default(). It conforms to the
michael@0 494 * naming convention used in RFC 4568 (SDP Security Descriptions for
michael@0 495 * Media Streams).
michael@0 496 *
michael@0 497 * @return void.
michael@0 498 *
michael@0 499 */
michael@0 500
michael@0 501 #define crypto_policy_set_aes_cm_128_hmac_sha1_80(p) crypto_policy_set_rtp_default(p)
michael@0 502
michael@0 503
michael@0 504 /**
michael@0 505 * @brief crypto_policy_set_aes_cm_128_hmac_sha1_32() sets a crypto
michael@0 506 * policy structure to a short-authentication tag policy
michael@0 507 *
michael@0 508 * @param p is a pointer to the policy structure to be set
michael@0 509 *
michael@0 510 * The function call crypto_policy_set_aes_cm_128_hmac_sha1_32(&p)
michael@0 511 * sets the crypto_policy_t at location p to use policy
michael@0 512 * AES_CM_128_HMAC_SHA1_32 as defined in RFC 4568.
michael@0 513 * This policy uses AES-128
michael@0 514 * Counter Mode encryption and HMAC-SHA1 authentication, with an
michael@0 515 * authentication tag that is only 32 bits long. This length is
michael@0 516 * considered adequate only for protecting audio and video media that
michael@0 517 * use a stateless playback function. See Section 7.5 of RFC 3711
michael@0 518 * (http://www.ietf.org/rfc/rfc3711.txt).
michael@0 519 *
michael@0 520 * This function is a convenience that helps to avoid dealing directly
michael@0 521 * with the policy data structure. You are encouraged to initialize
michael@0 522 * policy elements with this function call. Doing so may allow your
michael@0 523 * code to be forward compatible with later versions of libSRTP that
michael@0 524 * include more elements in the crypto_policy_t datatype.
michael@0 525 *
michael@0 526 * @warning This crypto policy is intended for use in SRTP, but not in
michael@0 527 * SRTCP. It is recommended that a policy that uses longer
michael@0 528 * authentication tags be used for SRTCP. See Section 7.5 of RFC 3711
michael@0 529 * (http://www.ietf.org/rfc/rfc3711.txt).
michael@0 530 *
michael@0 531 * @return void.
michael@0 532 *
michael@0 533 */
michael@0 534
michael@0 535 void
michael@0 536 crypto_policy_set_aes_cm_128_hmac_sha1_32(crypto_policy_t *p);
michael@0 537
michael@0 538
michael@0 539
michael@0 540 /**
michael@0 541 * @brief crypto_policy_set_aes_cm_128_null_auth() sets a crypto
michael@0 542 * policy structure to an encryption-only policy
michael@0 543 *
michael@0 544 * @param p is a pointer to the policy structure to be set
michael@0 545 *
michael@0 546 * The function call crypto_policy_set_aes_cm_128_null_auth(&p) sets
michael@0 547 * the crypto_policy_t at location p to use the SRTP default cipher
michael@0 548 * (AES-128 Counter Mode), but to use no authentication method. This
michael@0 549 * policy is NOT RECOMMENDED unless it is unavoidable; see Section 7.5
michael@0 550 * of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt).
michael@0 551 *
michael@0 552 * This function is a convenience that helps to avoid dealing directly
michael@0 553 * with the policy data structure. You are encouraged to initialize
michael@0 554 * policy elements with this function call. Doing so may allow your
michael@0 555 * code to be forward compatible with later versions of libSRTP that
michael@0 556 * include more elements in the crypto_policy_t datatype.
michael@0 557 *
michael@0 558 * @warning This policy is NOT RECOMMENDED for SRTP unless it is
michael@0 559 * unavoidable, and it is NOT RECOMMENDED at all for SRTCP; see
michael@0 560 * Section 7.5 of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt).
michael@0 561 *
michael@0 562 * @return void.
michael@0 563 *
michael@0 564 */
michael@0 565
michael@0 566 void
michael@0 567 crypto_policy_set_aes_cm_128_null_auth(crypto_policy_t *p);
michael@0 568
michael@0 569
michael@0 570 /**
michael@0 571 * @brief crypto_policy_set_null_cipher_hmac_sha1_80() sets a crypto
michael@0 572 * policy structure to an authentication-only policy
michael@0 573 *
michael@0 574 * @param p is a pointer to the policy structure to be set
michael@0 575 *
michael@0 576 * The function call crypto_policy_set_null_cipher_hmac_sha1_80(&p)
michael@0 577 * sets the crypto_policy_t at location p to use HMAC-SHA1 with an 80
michael@0 578 * bit authentication tag to provide message authentication, but to
michael@0 579 * use no encryption. This policy is NOT RECOMMENDED for SRTP unless
michael@0 580 * there is a requirement to forego encryption.
michael@0 581 *
michael@0 582 * This function is a convenience that helps to avoid dealing directly
michael@0 583 * with the policy data structure. You are encouraged to initialize
michael@0 584 * policy elements with this function call. Doing so may allow your
michael@0 585 * code to be forward compatible with later versions of libSRTP that
michael@0 586 * include more elements in the crypto_policy_t datatype.
michael@0 587 *
michael@0 588 * @warning This policy is NOT RECOMMENDED for SRTP unless there is a
michael@0 589 * requirement to forego encryption.
michael@0 590 *
michael@0 591 * @return void.
michael@0 592 *
michael@0 593 */
michael@0 594
michael@0 595 void
michael@0 596 crypto_policy_set_null_cipher_hmac_sha1_80(crypto_policy_t *p);
michael@0 597
michael@0 598
michael@0 599 /**
michael@0 600 * @brief crypto_policy_set_aes_cm_256_hmac_sha1_80() sets a crypto
michael@0 601 * policy structure to a encryption and authentication policy using AES-256
michael@0 602 * for RTP protection.
michael@0 603 *
michael@0 604 * @param p is a pointer to the policy structure to be set
michael@0 605 *
michael@0 606 * The function call crypto_policy_set_aes_cm_256_hmac_sha1_80(&p)
michael@0 607 * sets the crypto_policy_t at location p to use policy
michael@0 608 * AES_CM_256_HMAC_SHA1_80 as defined in
michael@0 609 * draft-ietf-avt-srtp-big-aes-03.txt. This policy uses AES-256
michael@0 610 * Counter Mode encryption and HMAC-SHA1 authentication, with an 80 bit
michael@0 611 * authentication tag.
michael@0 612 *
michael@0 613 * This function is a convenience that helps to avoid dealing directly
michael@0 614 * with the policy data structure. You are encouraged to initialize
michael@0 615 * policy elements with this function call. Doing so may allow your
michael@0 616 * code to be forward compatible with later versions of libSRTP that
michael@0 617 * include more elements in the crypto_policy_t datatype.
michael@0 618 *
michael@0 619 * @return void.
michael@0 620 *
michael@0 621 */
michael@0 622
michael@0 623 void crypto_policy_set_aes_cm_256_hmac_sha1_80(crypto_policy_t *p);
michael@0 624
michael@0 625
michael@0 626 /**
michael@0 627 * @brief crypto_policy_set_aes_cm_256_hmac_sha1_32() sets a crypto
michael@0 628 * policy structure to a short-authentication tag policy using AES-256
michael@0 629 * encryption.
michael@0 630 *
michael@0 631 * @param p is a pointer to the policy structure to be set
michael@0 632 *
michael@0 633 * The function call crypto_policy_set_aes_cm_256_hmac_sha1_32(&p)
michael@0 634 * sets the crypto_policy_t at location p to use policy
michael@0 635 * AES_CM_256_HMAC_SHA1_32 as defined in
michael@0 636 * draft-ietf-avt-srtp-big-aes-03.txt. This policy uses AES-256
michael@0 637 * Counter Mode encryption and HMAC-SHA1 authentication, with an
michael@0 638 * authentication tag that is only 32 bits long. This length is
michael@0 639 * considered adequate only for protecting audio and video media that
michael@0 640 * use a stateless playback function. See Section 7.5 of RFC 3711
michael@0 641 * (http://www.ietf.org/rfc/rfc3711.txt).
michael@0 642 *
michael@0 643 * This function is a convenience that helps to avoid dealing directly
michael@0 644 * with the policy data structure. You are encouraged to initialize
michael@0 645 * policy elements with this function call. Doing so may allow your
michael@0 646 * code to be forward compatible with later versions of libSRTP that
michael@0 647 * include more elements in the crypto_policy_t datatype.
michael@0 648 *
michael@0 649 * @warning This crypto policy is intended for use in SRTP, but not in
michael@0 650 * SRTCP. It is recommended that a policy that uses longer
michael@0 651 * authentication tags be used for SRTCP. See Section 7.5 of RFC 3711
michael@0 652 * (http://www.ietf.org/rfc/rfc3711.txt).
michael@0 653 *
michael@0 654 * @return void.
michael@0 655 *
michael@0 656 */
michael@0 657
michael@0 658 void
michael@0 659 crypto_policy_set_aes_cm_256_hmac_sha1_32(crypto_policy_t *p);
michael@0 660
michael@0 661
michael@0 662 /**
michael@0 663 * @brief srtp_dealloc() deallocates storage for an SRTP session
michael@0 664 * context.
michael@0 665 *
michael@0 666 * The function call srtp_dealloc(s) deallocates storage for the
michael@0 667 * SRTP session context s. This function should be called no more
michael@0 668 * than one time for each of the contexts allocated by the function
michael@0 669 * srtp_create().
michael@0 670 *
michael@0 671 * @param s is the srtp_t for the session to be deallocated.
michael@0 672 *
michael@0 673 * @return
michael@0 674 * - err_status_ok if there no problems.
michael@0 675 * - err_status_dealloc_fail a memory deallocation failure occured.
michael@0 676 */
michael@0 677
michael@0 678 err_status_t
michael@0 679 srtp_dealloc(srtp_t s);
michael@0 680
michael@0 681
michael@0 682 /*
michael@0 683 * @brief identifies a particular SRTP profile
michael@0 684 *
michael@0 685 * An srtp_profile_t enumeration is used to identify a particular SRTP
michael@0 686 * profile (that is, a set of algorithms and parameters). These
michael@0 687 * profiles are defined in the DTLS-SRTP draft.
michael@0 688 */
michael@0 689
michael@0 690 typedef enum {
michael@0 691 srtp_profile_reserved = 0,
michael@0 692 srtp_profile_aes128_cm_sha1_80 = 1,
michael@0 693 srtp_profile_aes128_cm_sha1_32 = 2,
michael@0 694 srtp_profile_aes256_cm_sha1_80 = 3,
michael@0 695 srtp_profile_aes256_cm_sha1_32 = 4,
michael@0 696 srtp_profile_null_sha1_80 = 5,
michael@0 697 srtp_profile_null_sha1_32 = 6,
michael@0 698 } srtp_profile_t;
michael@0 699
michael@0 700
michael@0 701 /**
michael@0 702 * @brief crypto_policy_set_from_profile_for_rtp() sets a crypto policy
michael@0 703 * structure to the appropriate value for RTP based on an srtp_profile_t
michael@0 704 *
michael@0 705 * @param p is a pointer to the policy structure to be set
michael@0 706 *
michael@0 707 * The function call crypto_policy_set_rtp_default(&policy, profile)
michael@0 708 * sets the crypto_policy_t at location policy to the policy for RTP
michael@0 709 * protection, as defined by the srtp_profile_t profile.
michael@0 710 *
michael@0 711 * This function is a convenience that helps to avoid dealing directly
michael@0 712 * with the policy data structure. You are encouraged to initialize
michael@0 713 * policy elements with this function call. Doing so may allow your
michael@0 714 * code to be forward compatible with later versions of libSRTP that
michael@0 715 * include more elements in the crypto_policy_t datatype.
michael@0 716 *
michael@0 717 * @return values
michael@0 718 * - err_status_ok no problems were encountered
michael@0 719 * - err_status_bad_param the profile is not supported
michael@0 720 *
michael@0 721 */
michael@0 722 err_status_t
michael@0 723 crypto_policy_set_from_profile_for_rtp(crypto_policy_t *policy,
michael@0 724 srtp_profile_t profile);
michael@0 725
michael@0 726
michael@0 727
michael@0 728
michael@0 729 /**
michael@0 730 * @brief crypto_policy_set_from_profile_for_rtcp() sets a crypto policy
michael@0 731 * structure to the appropriate value for RTCP based on an srtp_profile_t
michael@0 732 *
michael@0 733 * @param p is a pointer to the policy structure to be set
michael@0 734 *
michael@0 735 * The function call crypto_policy_set_rtcp_default(&policy, profile)
michael@0 736 * sets the crypto_policy_t at location policy to the policy for RTCP
michael@0 737 * protection, as defined by the srtp_profile_t profile.
michael@0 738 *
michael@0 739 * This function is a convenience that helps to avoid dealing directly
michael@0 740 * with the policy data structure. You are encouraged to initialize
michael@0 741 * policy elements with this function call. Doing so may allow your
michael@0 742 * code to be forward compatible with later versions of libSRTP that
michael@0 743 * include more elements in the crypto_policy_t datatype.
michael@0 744 *
michael@0 745 * @return values
michael@0 746 * - err_status_ok no problems were encountered
michael@0 747 * - err_status_bad_param the profile is not supported
michael@0 748 *
michael@0 749 */
michael@0 750 err_status_t
michael@0 751 crypto_policy_set_from_profile_for_rtcp(crypto_policy_t *policy,
michael@0 752 srtp_profile_t profile);
michael@0 753
michael@0 754 /**
michael@0 755 * @brief returns the master key length for a given SRTP profile
michael@0 756 */
michael@0 757 unsigned int
michael@0 758 srtp_profile_get_master_key_length(srtp_profile_t profile);
michael@0 759
michael@0 760
michael@0 761 /**
michael@0 762 * @brief returns the master salt length for a given SRTP profile
michael@0 763 */
michael@0 764 unsigned int
michael@0 765 srtp_profile_get_master_salt_length(srtp_profile_t profile);
michael@0 766
michael@0 767 /**
michael@0 768 * @brief appends the salt to the key
michael@0 769 *
michael@0 770 * The function call append_salt_to_key(k, klen, s, slen)
michael@0 771 * copies the string s to the location at klen bytes following
michael@0 772 * the location k.
michael@0 773 *
michael@0 774 * @warning There must be at least bytes_in_salt + bytes_in_key bytes
michael@0 775 * available at the location pointed to by key.
michael@0 776 *
michael@0 777 */
michael@0 778
michael@0 779 void
michael@0 780 append_salt_to_key(unsigned char *key, unsigned int bytes_in_key,
michael@0 781 unsigned char *salt, unsigned int bytes_in_salt);
michael@0 782
michael@0 783
michael@0 784
michael@0 785 /**
michael@0 786 * @}
michael@0 787 */
michael@0 788
michael@0 789
michael@0 790
michael@0 791 /**
michael@0 792 * @defgroup SRTCP Secure RTCP
michael@0 793 * @ingroup SRTP
michael@0 794 *
michael@0 795 * @brief Secure RTCP functions are used to protect RTCP traffic.
michael@0 796 *
michael@0 797 * RTCP is the control protocol for RTP. libSRTP protects RTCP
michael@0 798 * traffic in much the same way as it does RTP traffic. The function
michael@0 799 * srtp_protect_rtcp() applies cryptographic protections to outbound
michael@0 800 * RTCP packets, and srtp_unprotect_rtcp() verifies the protections on
michael@0 801 * inbound RTCP packets.
michael@0 802 *
michael@0 803 * A note on the naming convention: srtp_protect_rtcp() has an srtp_t
michael@0 804 * as its first argument, and thus has `srtp_' as its prefix. The
michael@0 805 * trailing `_rtcp' indicates the protocol on which it acts.
michael@0 806 *
michael@0 807 * @{
michael@0 808 */
michael@0 809
michael@0 810 /**
michael@0 811 * @brief srtp_protect_rtcp() is the Secure RTCP sender-side packet
michael@0 812 * processing function.
michael@0 813 *
michael@0 814 * The function call srtp_protect_rtcp(ctx, rtp_hdr, len_ptr) applies
michael@0 815 * SRTCP protection to the RTCP packet rtcp_hdr (which has length
michael@0 816 * *len_ptr) using the SRTP session context ctx. If err_status_ok is
michael@0 817 * returned, then rtp_hdr points to the resulting SRTCP packet and
michael@0 818 * *len_ptr is the number of octets in that packet; otherwise, no
michael@0 819 * assumptions should be made about the value of either data elements.
michael@0 820 *
michael@0 821 * @warning This function assumes that it can write the authentication
michael@0 822 * tag into the location in memory immediately following the RTCP
michael@0 823 * packet, and assumes that the RTCP packet is aligned on a 32-bit
michael@0 824 * boundary.
michael@0 825 *
michael@0 826 * @param ctx is the SRTP context to use in processing the packet.
michael@0 827 *
michael@0 828 * @param rtcp_hdr is a pointer to the RTCP packet (before the call); after
michael@0 829 * the function returns, it points to the srtp packet.
michael@0 830 *
michael@0 831 * @param pkt_octet_len is a pointer to the length in octets of the
michael@0 832 * complete RTCP packet (header and body) before the function call,
michael@0 833 * and of the complete SRTCP packet after the call, if err_status_ok
michael@0 834 * was returned. Otherwise, the value of the data to which it points
michael@0 835 * is undefined.
michael@0 836 *
michael@0 837 * @return
michael@0 838 * - err_status_ok if there were no problems.
michael@0 839 * - [other] if there was a failure in
michael@0 840 * the cryptographic mechanisms.
michael@0 841 */
michael@0 842
michael@0 843
michael@0 844 err_status_t
michael@0 845 srtp_protect_rtcp(srtp_t ctx, void *rtcp_hdr, int *pkt_octet_len);
michael@0 846
michael@0 847 /**
michael@0 848 * @brief srtp_unprotect_rtcp() is the Secure RTCP receiver-side packet
michael@0 849 * processing function.
michael@0 850 *
michael@0 851 * The function call srtp_unprotect_rtcp(ctx, srtp_hdr, len_ptr)
michael@0 852 * verifies the Secure RTCP protection of the SRTCP packet pointed to
michael@0 853 * by srtcp_hdr (which has length *len_ptr), using the SRTP session
michael@0 854 * context ctx. If err_status_ok is returned, then srtcp_hdr points
michael@0 855 * to the resulting RTCP packet and *len_ptr is the number of octets
michael@0 856 * in that packet; otherwise, no assumptions should be made about the
michael@0 857 * value of either data elements.
michael@0 858 *
michael@0 859 * @warning This function assumes that the SRTCP packet is aligned on a
michael@0 860 * 32-bit boundary.
michael@0 861 *
michael@0 862 * @param ctx is a pointer to the srtp_t which applies to the
michael@0 863 * particular packet.
michael@0 864 *
michael@0 865 * @param srtcp_hdr is a pointer to the header of the SRTCP packet
michael@0 866 * (before the call). After the function returns, it points to the
michael@0 867 * rtp packet if err_status_ok was returned; otherwise, the value of
michael@0 868 * the data to which it points is undefined.
michael@0 869 *
michael@0 870 * @param pkt_octet_len is a pointer to the length in octets of the
michael@0 871 * complete SRTCP packet (header and body) before the function call,
michael@0 872 * and of the complete rtp packet after the call, if err_status_ok was
michael@0 873 * returned. Otherwise, the value of the data to which it points is
michael@0 874 * undefined.
michael@0 875 *
michael@0 876 * @return
michael@0 877 * - err_status_ok if the RTCP packet is valid.
michael@0 878 * - err_status_auth_fail if the SRTCP packet failed the message
michael@0 879 * authentication check.
michael@0 880 * - err_status_replay_fail if the SRTCP packet is a replay (e.g. has
michael@0 881 * already been processed and accepted).
michael@0 882 * - [other] if there has been an error in the cryptographic mechanisms.
michael@0 883 *
michael@0 884 */
michael@0 885
michael@0 886 err_status_t
michael@0 887 srtp_unprotect_rtcp(srtp_t ctx, void *srtcp_hdr, int *pkt_octet_len);
michael@0 888
michael@0 889 /**
michael@0 890 * @}
michael@0 891 */
michael@0 892
michael@0 893 /**
michael@0 894 * @defgroup SRTPevents SRTP events and callbacks
michael@0 895 * @ingroup SRTP
michael@0 896 *
michael@0 897 * @brief libSRTP can use a user-provided callback function to
michael@0 898 * handle events.
michael@0 899 *
michael@0 900 *
michael@0 901 * libSRTP allows a user to provide a callback function to handle
michael@0 902 * events that need to be dealt with outside of the data plane (see
michael@0 903 * the enum srtp_event_t for a description of these events). Dealing
michael@0 904 * with these events is not a strict necessity; they are not
michael@0 905 * security-critical, but the application may suffer if they are not
michael@0 906 * handled. The function srtp_set_event_handler() is used to provide
michael@0 907 * the callback function.
michael@0 908 *
michael@0 909 * A default event handler that merely reports on the events as they
michael@0 910 * happen is included. It is also possible to set the event handler
michael@0 911 * function to NULL, in which case all events will just be silently
michael@0 912 * ignored.
michael@0 913 *
michael@0 914 * @{
michael@0 915 */
michael@0 916
michael@0 917 /**
michael@0 918 * @brief srtp_event_t defines events that need to be handled
michael@0 919 *
michael@0 920 * The enum srtp_event_t defines events that need to be handled
michael@0 921 * outside the `data plane', such as SSRC collisions and
michael@0 922 * key expirations.
michael@0 923 *
michael@0 924 * When a key expires or the maximum number of packets has been
michael@0 925 * reached, an SRTP stream will enter an `expired' state in which no
michael@0 926 * more packets can be protected or unprotected. When this happens,
michael@0 927 * it is likely that you will want to either deallocate the stream
michael@0 928 * (using srtp_stream_dealloc()), and possibly allocate a new one.
michael@0 929 *
michael@0 930 * When an SRTP stream expires, the other streams in the same session
michael@0 931 * are unaffected, unless key sharing is used by that stream. In the
michael@0 932 * latter case, all of the streams in the session will expire.
michael@0 933 */
michael@0 934
michael@0 935 typedef enum {
michael@0 936 event_ssrc_collision, /**<
michael@0 937 * An SSRC collision occured.
michael@0 938 */
michael@0 939 event_key_soft_limit, /**< An SRTP stream reached the soft key
michael@0 940 * usage limit and will expire soon.
michael@0 941 */
michael@0 942 event_key_hard_limit, /**< An SRTP stream reached the hard
michael@0 943 * key usage limit and has expired.
michael@0 944 */
michael@0 945 event_packet_index_limit /**< An SRTP stream reached the hard
michael@0 946 * packet limit (2^48 packets).
michael@0 947 */
michael@0 948 } srtp_event_t;
michael@0 949
michael@0 950 /**
michael@0 951 * @brief srtp_event_data_t is the structure passed as a callback to
michael@0 952 * the event handler function
michael@0 953 *
michael@0 954 * The struct srtp_event_data_t holds the data passed to the event
michael@0 955 * handler function.
michael@0 956 */
michael@0 957
michael@0 958 typedef struct srtp_event_data_t {
michael@0 959 srtp_t session; /**< The session in which the event happend. */
michael@0 960 srtp_stream_t stream; /**< The stream in which the event happend. */
michael@0 961 srtp_event_t event; /**< An enum indicating the type of event. */
michael@0 962 } srtp_event_data_t;
michael@0 963
michael@0 964 /**
michael@0 965 * @brief srtp_event_handler_func_t is the function prototype for
michael@0 966 * the event handler.
michael@0 967 *
michael@0 968 * The typedef srtp_event_handler_func_t is the prototype for the
michael@0 969 * event handler function. It has as its only argument an
michael@0 970 * srtp_event_data_t which describes the event that needs to be handled.
michael@0 971 * There can only be a single, global handler for all events in
michael@0 972 * libSRTP.
michael@0 973 */
michael@0 974
michael@0 975 typedef void (srtp_event_handler_func_t)(srtp_event_data_t *data);
michael@0 976
michael@0 977 /**
michael@0 978 * @brief sets the event handler to the function supplied by the caller.
michael@0 979 *
michael@0 980 * The function call srtp_install_event_handler(func) sets the event
michael@0 981 * handler function to the value func. The value NULL is acceptable
michael@0 982 * as an argument; in this case, events will be ignored rather than
michael@0 983 * handled.
michael@0 984 *
michael@0 985 * @param func is a pointer to a fuction that takes an srtp_event_data_t
michael@0 986 * pointer as an argument and returns void. This function
michael@0 987 * will be used by libSRTP to handle events.
michael@0 988 */
michael@0 989
michael@0 990 err_status_t
michael@0 991 srtp_install_event_handler(srtp_event_handler_func_t func);
michael@0 992
michael@0 993 /**
michael@0 994 * @}
michael@0 995 */
michael@0 996 /* in host order, so outside the #if */
michael@0 997 #define SRTCP_E_BIT 0x80000000
michael@0 998 /* for byte-access */
michael@0 999 #define SRTCP_E_BYTE_BIT 0x80
michael@0 1000 #define SRTCP_INDEX_MASK 0x7fffffff
michael@0 1001
michael@0 1002 #ifdef __cplusplus
michael@0 1003 }
michael@0 1004 #endif
michael@0 1005
michael@0 1006 #endif /* SRTP_H */

mercurial