diff options
Diffstat (limited to 'thirdparties/win32/include/srtp/srtp.h')
-rwxr-xr-x | thirdparties/win32/include/srtp/srtp.h | 427 |
1 files changed, 214 insertions, 213 deletions
diff --git a/thirdparties/win32/include/srtp/srtp.h b/thirdparties/win32/include/srtp/srtp.h index 48416d3..137baee 100755 --- a/thirdparties/win32/include/srtp/srtp.h +++ b/thirdparties/win32/include/srtp/srtp.h @@ -7,26 +7,26 @@ * Cisco Systems, Inc. */ /* - * + * * Copyright (c) 2001-2006, Cisco Systems, Inc. * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: - * + * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. - * + * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. - * + * * Neither the name of the Cisco Systems, Inc. nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS @@ -51,7 +51,7 @@ extern "C" { #endif #include <stdint.h> -#include "crypto.h" +#include "crypto.h" #include "crypto_types.h" #include "err.h" @@ -79,7 +79,7 @@ extern "C" { * SRTP_MAX_TAG_LEN is the maximum tag length supported by libSRTP */ -#define SRTP_MAX_TAG_LEN 12 +#define SRTP_MAX_TAG_LEN 12 /** * SRTP_MAX_TRAILER_LEN is the maximum length of the SRTP trailer @@ -89,10 +89,10 @@ extern "C" { * * @brief the maximum number of octets added by srtp_protect(). */ -#define SRTP_MAX_TRAILER_LEN SRTP_MAX_TAG_LEN +#define SRTP_MAX_TRAILER_LEN SRTP_MAX_TAG_LEN /* - * SRTP_AEAD_SALT_LEN is the length of the SALT values used with + * SRTP_AEAD_SALT_LEN is the length of the SALT values used with * GCM mode. GCM mode requires an IV. The SALT value is used * as part of the IV formation logic applied to each RTP packet. */ @@ -103,83 +103,84 @@ extern "C" { -/* +/* * nota bene: since libSRTP doesn't support the use of the MKI, the * SRTP_MAX_TRAILER_LEN value is just the maximum tag length */ /** - * @brief sec_serv_t describes a set of security services. + * @brief sec_serv_t describes a set of security services. * * A sec_serv_t enumeration is used to describe the particular * security services that will be applied by a particular crypto - * policy (or other mechanism). + * policy (or other mechanism). */ typedef enum { - sec_serv_none = 0, /**< no services */ - sec_serv_conf = 1, /**< confidentiality */ - sec_serv_auth = 2, /**< authentication */ - sec_serv_conf_and_auth = 3 /**< confidentiality and authentication */ -} sec_serv_t; + sec_serv_none = 0, /**< no services */ + sec_serv_conf = 1, /**< confidentiality */ + sec_serv_auth = 2, /**< authentication */ + sec_serv_conf_and_auth = 3 /**< confidentiality and authentication */ +} +sec_serv_t; -/** +/** * @brief crypto_policy_t describes a particular crypto policy that * can be applied to an SRTP stream. * * A crypto_policy_t describes a particular cryptographic policy that * can be applied to an SRTP or SRTCP stream. An SRTP session policy - * consists of a list of these policies, one for each SRTP stream + * consists of a list of these policies, one for each SRTP stream * in the session. */ typedef struct crypto_policy_t { - cipher_type_id_t cipher_type; /**< An integer representing + cipher_type_id_t cipher_type; /**< An integer representing * the type of cipher. */ - int cipher_key_len; /**< The length of the cipher key + int cipher_key_len; /**< The length of the cipher key * in octets. */ - auth_type_id_t auth_type; /**< An integer representing the + auth_type_id_t auth_type; /**< An integer representing the * authentication function. */ - int auth_key_len; /**< The length of the authentication + int auth_key_len; /**< The length of the authentication * function key in octets. */ - int auth_tag_len; /**< The length of the authentication + int auth_tag_len; /**< The length of the authentication * tag in octets. */ - sec_serv_t sec_serv; /**< The flag indicating the security + sec_serv_t sec_serv; /**< The flag indicating the security * services to be applied. */ } crypto_policy_t; -/** +/** * @brief ssrc_type_t describes the type of an SSRC. - * + * * An ssrc_type_t enumeration is used to indicate a type of SSRC. See * @ref srtp_policy_t for more informataion. */ -typedef enum { - ssrc_undefined = 0, /**< Indicates an undefined SSRC type. */ - ssrc_specific = 1, /**< Indicates a specific SSRC value */ - ssrc_any_inbound = 2, /**< Indicates any inbound SSRC value +typedef enum { + ssrc_undefined = 0, /**< Indicates an undefined SSRC type. */ + ssrc_specific = 1, /**< Indicates a specific SSRC value */ + ssrc_any_inbound = 2, /**< Indicates any inbound SSRC value (i.e. a value that is used in the function srtp_unprotect()) */ - ssrc_any_outbound = 3 /**< Indicates any outbound SSRC value - (i.e. a value that is used in the + ssrc_any_outbound = 3 /**< Indicates any outbound SSRC value + (i.e. a value that is used in the function srtp_protect()) */ } ssrc_type_t; /** * @brief An ssrc_t represents a particular SSRC value, or a `wildcard' SSRC. - * + * * An ssrc_t represents a particular SSRC value (if its type is * ssrc_specific), or a wildcard SSRC value that will match all * outbound SSRCs (if its type is ssrc_any_outbound) or all inbound - * SSRCs (if its type is ssrc_any_inbound). + * SSRCs (if its type is ssrc_any_inbound). * */ -typedef struct { - ssrc_type_t type; /**< The type of this particular SSRC */ - unsigned int value; /**< The value of this SSRC, if it is not a wildcard */ +typedef struct { + ssrc_type_t type; /**< The type of this particular SSRC */ + unsigned int value; /**< The value of this SSRC, if it is not a wildcard */ } ssrc_t; @@ -195,8 +196,8 @@ typedef struct ekt_policy_ctx_t *ekt_policy_t; typedef struct ekt_stream_ctx_t *ekt_stream_t; -/** - * @brief represents the policy for an SRTP session. +/** + * @brief represents the policy for an SRTP session. * * A single srtp_policy_t struct represents the policy for a single * SRTP stream, and a linked list of these elements represents the @@ -205,7 +206,7 @@ typedef struct ekt_stream_ctx_t *ekt_stream_t; * master key for that stream, the SSRC describing that stream, or a * flag indicating a `wildcard' SSRC value, and a `next' field that * holds a pointer to the next element in the list of policy elements, - * or NULL if it is the last element. + * or NULL if it is the last element. * * The wildcard value SSRC_ANY_INBOUND matches any SSRC from an * inbound stream that for which there is no explicit SSRC entry in @@ -216,33 +217,33 @@ typedef struct ekt_stream_ctx_t *ekt_stream_t; * is intentional, and it allows libSRTP to ensure that no security * lapses result from accidental re-use of SSRC values during key * sharing. - * - * + * + * * @warning The final element of the list @b must have its `next' pointer * set to NULL. */ typedef struct srtp_policy_t { - ssrc_t ssrc; /**< The SSRC value of stream, or the - * flags SSRC_ANY_INBOUND or + ssrc_t ssrc; /**< The SSRC value of stream, or the + * flags SSRC_ANY_INBOUND or * SSRC_ANY_OUTBOUND if key sharing * is used for this policy element. */ - crypto_policy_t rtp; /**< SRTP crypto policy. */ - crypto_policy_t rtcp; /**< SRTCP crypto policy. */ - unsigned char *key; /**< Pointer to the SRTP master key for + crypto_policy_t rtp; /**< SRTP crypto policy. */ + crypto_policy_t rtcp; /**< SRTCP crypto policy. */ + unsigned char *key; /**< Pointer to the SRTP master key for * this stream. */ - ekt_policy_t ekt; /**< Pointer to the EKT policy structure - * for this stream (if any) */ - unsigned long window_size; /**< The window size to use for replay + ekt_policy_t ekt; /**< Pointer to the EKT policy structure + * for this stream (if any) */ + unsigned long window_size; /**< The window size to use for replay * protection. */ - int allow_repeat_tx; /**< Whether retransmissions of + int allow_repeat_tx; /**< Whether retransmissions of * packets with the same sequence number * are allowed. (Note that such repeated * transmissions must have the same RTP * payload, or a severe security weakness * is introduced!) */ - struct srtp_policy_t *next; /**< Pointer to next stream policy. */ + struct srtp_policy_t *next; /**< Pointer to next stream policy. */ } srtp_policy_t; @@ -252,7 +253,7 @@ typedef struct srtp_policy_t { * @brief An srtp_t points to an SRTP session structure. * * The typedef srtp_t is a pointer to a structure that represents - * an SRTP session. This datatype is intentially opaque in + * an SRTP session. This datatype is intentially opaque in * order to separate the interface from the implementation. * * An SRTP session consists of all of the traffic sent to the RTP and @@ -269,11 +270,11 @@ typedef struct srtp_ctx_t *srtp_t; * * The typedef srtp_stream_t is a pointer to a structure that * represents an SRTP stream. This datatype is intentionally - * opaque in order to separate the interface from the implementation. - * + * opaque in order to separate the interface from the implementation. + * * An SRTP stream consists of all of the traffic sent to an SRTP * session by a single participant. A session can be viewed as - * a set of streams. + * a set of streams. * */ typedef struct srtp_stream_ctx_t *srtp_stream_t; @@ -281,7 +282,7 @@ typedef struct srtp_stream_ctx_t *srtp_stream_t; /** - * @brief srtp_init() initializes the srtp library. + * @brief srtp_init() initializes the srtp library. * * @warning This function @b must be called before any other srtp * functions. @@ -302,14 +303,14 @@ srtp_shutdown(void); /** * @brief srtp_protect() is the Secure RTP sender-side packet processing * function. - * + * * The function call srtp_protect(ctx, rtp_hdr, len_ptr) applies SRTP * protection to the RTP packet rtp_hdr (which has length *len_ptr) using * the SRTP context ctx. If err_status_ok is returned, then rtp_hdr * points to the resulting SRTP packet and *len_ptr is the number of * octets in that packet; otherwise, no assumptions should be made * about the value of either data elements. - * + * * The sequence numbers of the RTP packets presented to this function * need not be consecutive, but they @b must be out of order by less * than 2^15 = 32,768 packets. @@ -319,11 +320,11 @@ srtp_shutdown(void); * packet, and assumes that the RTP packet is aligned on a 32-bit * boundary. * - * @warning This function assumes that it can write SRTP_MAX_TRAILER_LEN - * into the location in memory immediately following the RTP packet. - * Callers MUST ensure that this much writable memory is available in + * @warning This function assumes that it can write SRTP_MAX_TRAILER_LEN + * into the location in memory immediately following the RTP packet. + * Callers MUST ensure that this much writable memory is available in * the buffer that holds the RTP packet. - * + * * @param ctx is the SRTP context to use in processing the packet. * * @param rtp_hdr is a pointer to the RTP packet (before the call); after @@ -334,7 +335,7 @@ srtp_shutdown(void); * complete SRTP packet after the call, if err_status_ok was returned. * Otherwise, the value of the data to which it points is undefined. * - * @return + * @return * - err_status_ok no problems * - err_status_replay_fail rtp sequence number was non-increasing * - @e other failure in cryptographic mechanisms @@ -342,7 +343,7 @@ srtp_shutdown(void); err_status_t srtp_protect(srtp_t ctx, void *rtp_hdr, int *len_ptr); - + /** * @brief srtp_unprotect() is the Secure RTP receiver-side packet * processing function. @@ -353,12 +354,12 @@ srtp_protect(srtp_t ctx, void *rtp_hdr, int *len_ptr); * err_status_ok is returned, then srtp_hdr points to the resulting * RTP packet and *len_ptr is the number of octets in that packet; * otherwise, no assumptions should be made about the value of either - * data elements. - * + * data elements. + * * The sequence numbers of the RTP packets presented to this function * need not be consecutive, but they @b must be out of order by less * than 2^15 = 32,768 packets. - * + * * @warning This function assumes that the SRTP packet is aligned on a * 32-bit boundary. * @@ -374,9 +375,9 @@ srtp_protect(srtp_t ctx, void *rtp_hdr, int *len_ptr); * complete rtp packet after the call, if err_status_ok was returned. * Otherwise, the value of the data to which it points is undefined. * - * @return + * @return * - err_status_ok if the RTP packet is valid. - * - err_status_auth_fail if the SRTP packet failed the message + * - err_status_auth_fail if the SRTP packet failed the message * authentication check. * - err_status_replay_fail if the SRTP packet is a replay (e.g. packet has * already been processed and accepted). @@ -397,14 +398,14 @@ srtp_unprotect(srtp_t ctx, void *srtp_hdr, int *len_ptr); * * @param session is a pointer to the SRTP session to which the policy is * to be added. - * + * * @param policy is the srtp_policy_t struct that describes the policy * for the session. The struct may be a single element, or it may be * the head of a list, in which case each element of the list is * processed. It may also be NULL, in which case streams should be added * later using srtp_add_stream(). The final element of the list @b must * have its `next' field set to NULL. - * + * * @return * - err_status_ok if creation succeded. * - err_status_alloc_fail if allocation failed. @@ -418,7 +419,7 @@ srtp_create(srtp_t *session, const srtp_policy_t *policy); /** * @brief srtp_add_stream() allocates and initializes an SRTP stream * within a given SRTP session. - * + * * The function call srtp_add_stream(session, policy) allocates and * initializes a new SRTP stream within a given, previously created * session, applying the policy given as the other argument to that @@ -431,13 +432,13 @@ srtp_create(srtp_t *session, const srtp_policy_t *policy); */ err_status_t -srtp_add_stream(srtp_t session, - const srtp_policy_t *policy); +srtp_add_stream(srtp_t session, + const srtp_policy_t *policy); /** * @brief srtp_remove_stream() deallocates an SRTP stream. - * + * * The function call srtp_remove_stream(session, ssrc) removes * the SRTP stream with the SSRC value ssrc from the SRTP session * context given by the argument session. @@ -449,7 +450,7 @@ srtp_add_stream(srtp_t session, * * @warning Wildcard SSRC values cannot be removed from a * session. - * + * * @return * - err_status_ok if the stream deallocation succeded. * - [other] otherwise. @@ -463,8 +464,8 @@ srtp_remove_stream(srtp_t session, unsigned int ssrc); * @brief crypto_policy_set_rtp_default() sets a crypto policy * structure to the SRTP default policy for RTP protection. * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_rtp_default(&p) sets the * crypto_policy_t at location p to the SRTP default policy for RTP * protection, as defined in the specification. This function is a @@ -473,9 +474,9 @@ srtp_remove_stream(srtp_t session, unsigned int ssrc); * with this function call. Doing so may allow your code to be * forward compatible with later versions of libSRTP that include more * elements in the crypto_policy_t datatype. - * + * * @return void. - * + * */ void @@ -485,8 +486,8 @@ crypto_policy_set_rtp_default(crypto_policy_t *p); * @brief crypto_policy_set_rtcp_default() sets a crypto policy * structure to the SRTP default policy for RTCP protection. * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_rtcp_default(&p) sets the * crypto_policy_t at location p to the SRTP default policy for RTCP * protection, as defined in the specification. This function is a @@ -495,9 +496,9 @@ crypto_policy_set_rtp_default(crypto_policy_t *p); * with this function call. Doing so may allow your code to be * forward compatible with later versions of libSRTP that include more * elements in the crypto_policy_t datatype. - * + * * @return void. - * + * */ void @@ -507,15 +508,15 @@ crypto_policy_set_rtcp_default(crypto_policy_t *p); * @brief crypto_policy_set_aes_cm_128_hmac_sha1_80() sets a crypto * policy structure to the SRTP default policy for RTP protection. * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function crypto_policy_set_aes_cm_128_hmac_sha1_80() is a * synonym for crypto_policy_set_rtp_default(). It conforms to the * naming convention used in RFC 4568 (SDP Security Descriptions for * Media Streams). - * + * * @return void. - * + * */ #define crypto_policy_set_aes_cm_128_hmac_sha1_80(p) crypto_policy_set_rtp_default(p) @@ -525,8 +526,8 @@ crypto_policy_set_rtcp_default(crypto_policy_t *p); * @brief crypto_policy_set_aes_cm_128_hmac_sha1_32() sets a crypto * policy structure to a short-authentication tag policy * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_aes_cm_128_hmac_sha1_32(&p) * sets the crypto_policy_t at location p to use policy * AES_CM_128_HMAC_SHA1_32 as defined in RFC 4568. @@ -536,7 +537,7 @@ crypto_policy_set_rtcp_default(crypto_policy_t *p); * considered adequate only for protecting audio and video media that * use a stateless playback function. See Section 7.5 of RFC 3711 * (http://www.ietf.org/rfc/rfc3711.txt). - * + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your @@ -549,7 +550,7 @@ crypto_policy_set_rtcp_default(crypto_policy_t *p); * (http://www.ietf.org/rfc/rfc3711.txt). * * @return void. - * + * */ void @@ -561,14 +562,14 @@ crypto_policy_set_aes_cm_128_hmac_sha1_32(crypto_policy_t *p); * @brief crypto_policy_set_aes_cm_128_null_auth() sets a crypto * policy structure to an encryption-only policy * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_aes_cm_128_null_auth(&p) sets * the crypto_policy_t at location p to use the SRTP default cipher * (AES-128 Counter Mode), but to use no authentication method. This * policy is NOT RECOMMENDED unless it is unavoidable; see Section 7.5 * of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). - * + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your @@ -580,7 +581,7 @@ crypto_policy_set_aes_cm_128_hmac_sha1_32(crypto_policy_t *p); * Section 7.5 of RFC 3711 (http://www.ietf.org/rfc/rfc3711.txt). * * @return void. - * + * */ void @@ -591,14 +592,14 @@ crypto_policy_set_aes_cm_128_null_auth(crypto_policy_t *p); * @brief crypto_policy_set_null_cipher_hmac_sha1_80() sets a crypto * policy structure to an authentication-only policy * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_null_cipher_hmac_sha1_80(&p) * sets the crypto_policy_t at location p to use HMAC-SHA1 with an 80 * bit authentication tag to provide message authentication, but to * use no encryption. This policy is NOT RECOMMENDED for SRTP unless - * there is a requirement to forego encryption. - * + * there is a requirement to forego encryption. + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your @@ -606,10 +607,10 @@ crypto_policy_set_aes_cm_128_null_auth(crypto_policy_t *p); * include more elements in the crypto_policy_t datatype. * * @warning This policy is NOT RECOMMENDED for SRTP unless there is a - * requirement to forego encryption. + * requirement to forego encryption. * * @return void. - * + * */ void @@ -618,18 +619,18 @@ crypto_policy_set_null_cipher_hmac_sha1_80(crypto_policy_t *p); /** * @brief crypto_policy_set_aes_cm_256_hmac_sha1_80() sets a crypto - * policy structure to a encryption and authentication policy using AES-256 + * policy structure to a encryption and authentication policy using AES-256 * for RTP protection. * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_aes_cm_256_hmac_sha1_80(&p) * sets the crypto_policy_t at location p to use policy * AES_CM_256_HMAC_SHA1_80 as defined in * draft-ietf-avt-srtp-big-aes-03.txt. This policy uses AES-256 * Counter Mode encryption and HMAC-SHA1 authentication, with an 80 bit * authentication tag. - * + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your @@ -637,7 +638,7 @@ crypto_policy_set_null_cipher_hmac_sha1_80(crypto_policy_t *p); * include more elements in the crypto_policy_t datatype. * * @return void. - * + * */ void crypto_policy_set_aes_cm_256_hmac_sha1_80(crypto_policy_t *p); @@ -648,8 +649,8 @@ void crypto_policy_set_aes_cm_256_hmac_sha1_80(crypto_policy_t *p); * policy structure to a short-authentication tag policy using AES-256 * encryption. * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_aes_cm_256_hmac_sha1_32(&p) * sets the crypto_policy_t at location p to use policy * AES_CM_256_HMAC_SHA1_32 as defined in @@ -659,7 +660,7 @@ void crypto_policy_set_aes_cm_256_hmac_sha1_80(crypto_policy_t *p); * considered adequate only for protecting audio and video media that * use a stateless playback function. See Section 7.5 of RFC 3711 * (http://www.ietf.org/rfc/rfc3711.txt). - * + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your @@ -672,7 +673,7 @@ void crypto_policy_set_aes_cm_256_hmac_sha1_80(crypto_policy_t *p); * (http://www.ietf.org/rfc/rfc3711.txt). * * @return void. - * + * */ void @@ -710,14 +711,14 @@ crypto_policy_set_aes_cm_256_null_auth(crypto_policy_t *p); * @brief crypto_policy_set_aes_gcm_128_8_auth() sets a crypto * policy structure to an AEAD encryption policy. * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_aes_gcm_128_8_auth(&p) sets * the crypto_policy_t at location p to use the SRTP default cipher * (AES-128 Galois Counter Mode) with 8 octet auth tag. This * policy applies confidentiality and authentication to both the * RTP and RTCP packets. - * + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your @@ -725,7 +726,7 @@ crypto_policy_set_aes_cm_256_null_auth(crypto_policy_t *p); * include more elements in the crypto_policy_t datatype. * * @return void. - * + * */ void crypto_policy_set_aes_gcm_128_8_auth(crypto_policy_t *p); @@ -734,14 +735,14 @@ crypto_policy_set_aes_gcm_128_8_auth(crypto_policy_t *p); * @brief crypto_policy_set_aes_gcm_256_8_auth() sets a crypto * policy structure to an AEAD encryption policy * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_aes_gcm_256_8_auth(&p) sets * the crypto_policy_t at location p to use the SRTP default cipher - * (AES-256 Galois Counter Mode) with 8 octet auth tag. This + * (AES-256 Galois Counter Mode) with 8 octet auth tag. This * policy applies confidentiality and authentication to both the * RTP and RTCP packets. - * + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your @@ -749,7 +750,7 @@ crypto_policy_set_aes_gcm_128_8_auth(crypto_policy_t *p); * include more elements in the crypto_policy_t datatype. * * @return void. - * + * */ void crypto_policy_set_aes_gcm_256_8_auth(crypto_policy_t *p); @@ -758,14 +759,14 @@ crypto_policy_set_aes_gcm_256_8_auth(crypto_policy_t *p); * @brief crypto_policy_set_aes_gcm_128_8_only_auth() sets a crypto * policy structure to an AEAD authentication-only policy * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_aes_gcm_128_8_only_auth(&p) sets * the crypto_policy_t at location p to use the SRTP default cipher - * (AES-128 Galois Counter Mode) with 8 octet auth tag. This policy - * applies confidentiality and authentication to the RTP packets, + * (AES-128 Galois Counter Mode) with 8 octet auth tag. This policy + * applies confidentiality and authentication to the RTP packets, * but only authentication to the RTCP packets. - * + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your @@ -773,7 +774,7 @@ crypto_policy_set_aes_gcm_256_8_auth(crypto_policy_t *p); * include more elements in the crypto_policy_t datatype. * * @return void. - * + * */ void crypto_policy_set_aes_gcm_128_8_only_auth(crypto_policy_t *p); @@ -782,14 +783,14 @@ crypto_policy_set_aes_gcm_128_8_only_auth(crypto_policy_t *p); * @brief crypto_policy_set_aes_gcm_256_8_only_auth() sets a crypto * policy structure to an AEAD authentication-only policy * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_aes_gcm_256_8_only_auth(&p) sets * the crypto_policy_t at location p to use the SRTP default cipher - * (AES-256 Galois Counter Mode) with 8 octet auth tag. This policy - * applies confidentiality and authentication to the RTP packets, + * (AES-256 Galois Counter Mode) with 8 octet auth tag. This policy + * applies confidentiality and authentication to the RTP packets, * but only authentication to the RTCP packets. - * + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your @@ -797,7 +798,7 @@ crypto_policy_set_aes_gcm_128_8_only_auth(crypto_policy_t *p); * include more elements in the crypto_policy_t datatype. * * @return void. - * + * */ void crypto_policy_set_aes_gcm_256_8_only_auth(crypto_policy_t *p); @@ -806,14 +807,14 @@ crypto_policy_set_aes_gcm_256_8_only_auth(crypto_policy_t *p); * @brief crypto_policy_set_aes_gcm_128_16_auth() sets a crypto * policy structure to an AEAD encryption policy. * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_aes_gcm_128_16_auth(&p) sets * the crypto_policy_t at location p to use the SRTP default cipher * (AES-128 Galois Counter Mode) with 16 octet auth tag. This * policy applies confidentiality and authentication to both the * RTP and RTCP packets. - * + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your @@ -821,7 +822,7 @@ crypto_policy_set_aes_gcm_256_8_only_auth(crypto_policy_t *p); * include more elements in the crypto_policy_t datatype. * * @return void. - * + * */ void crypto_policy_set_aes_gcm_128_16_auth(crypto_policy_t *p); @@ -830,14 +831,14 @@ crypto_policy_set_aes_gcm_128_16_auth(crypto_policy_t *p); * @brief crypto_policy_set_aes_gcm_256_16_auth() sets a crypto * policy structure to an AEAD encryption policy * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_aes_gcm_256_16_auth(&p) sets * the crypto_policy_t at location p to use the SRTP default cipher - * (AES-256 Galois Counter Mode) with 16 octet auth tag. This + * (AES-256 Galois Counter Mode) with 16 octet auth tag. This * policy applies confidentiality and authentication to both the * RTP and RTCP packets. - * + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your @@ -845,7 +846,7 @@ crypto_policy_set_aes_gcm_128_16_auth(crypto_policy_t *p); * include more elements in the crypto_policy_t datatype. * * @return void. - * + * */ void crypto_policy_set_aes_gcm_256_16_auth(crypto_policy_t *p); @@ -854,7 +855,7 @@ crypto_policy_set_aes_gcm_256_16_auth(crypto_policy_t *p); /** * @brief srtp_dealloc() deallocates storage for an SRTP session * context. - * + * * The function call srtp_dealloc(s) deallocates storage for the * SRTP session context s. This function should be called no more * than one time for each of the contexts allocated by the function @@ -872,7 +873,7 @@ srtp_dealloc(srtp_t s); /* - * @brief identifies a particular SRTP profile + * @brief identifies a particular SRTP profile * * An srtp_profile_t enumeration is used to identify a particular SRTP * profile (that is, a set of algorithms and parameters). These @@ -880,13 +881,13 @@ srtp_dealloc(srtp_t s); */ typedef enum { - srtp_profile_reserved = 0, - srtp_profile_aes128_cm_sha1_80 = 1, - srtp_profile_aes128_cm_sha1_32 = 2, - srtp_profile_aes256_cm_sha1_80 = 3, - srtp_profile_aes256_cm_sha1_32 = 4, - srtp_profile_null_sha1_80 = 5, - srtp_profile_null_sha1_32 = 6, + srtp_profile_reserved = 0, + srtp_profile_aes128_cm_sha1_80 = 1, + srtp_profile_aes128_cm_sha1_32 = 2, + srtp_profile_aes256_cm_sha1_80 = 3, + srtp_profile_aes256_cm_sha1_32 = 4, + srtp_profile_null_sha1_80 = 5, + srtp_profile_null_sha1_32 = 6, } srtp_profile_t; @@ -894,26 +895,26 @@ typedef enum { * @brief crypto_policy_set_from_profile_for_rtp() sets a crypto policy * structure to the appropriate value for RTP based on an srtp_profile_t * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_rtp_default(&policy, profile) * sets the crypto_policy_t at location policy to the policy for RTP * protection, as defined by the srtp_profile_t profile. - * + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your * code to be forward compatible with later versions of libSRTP that * include more elements in the crypto_policy_t datatype. - * + * * @return values * - err_status_ok no problems were encountered - * - err_status_bad_param the profile is not supported - * + * - err_status_bad_param the profile is not supported + * */ err_status_t -crypto_policy_set_from_profile_for_rtp(crypto_policy_t *policy, - srtp_profile_t profile); +crypto_policy_set_from_profile_for_rtp(crypto_policy_t *policy, + srtp_profile_t profile); @@ -922,26 +923,26 @@ crypto_policy_set_from_profile_for_rtp(crypto_policy_t *policy, * @brief crypto_policy_set_from_profile_for_rtcp() sets a crypto policy * structure to the appropriate value for RTCP based on an srtp_profile_t * - * @param p is a pointer to the policy structure to be set - * + * @param p is a pointer to the policy structure to be set + * * The function call crypto_policy_set_rtcp_default(&policy, profile) * sets the crypto_policy_t at location policy to the policy for RTCP * protection, as defined by the srtp_profile_t profile. - * + * * This function is a convenience that helps to avoid dealing directly * with the policy data structure. You are encouraged to initialize * policy elements with this function call. Doing so may allow your * code to be forward compatible with later versions of libSRTP that * include more elements in the crypto_policy_t datatype. - * + * * @return values * - err_status_ok no problems were encountered - * - err_status_bad_param the profile is not supported - * + * - err_status_bad_param the profile is not supported + * */ err_status_t -crypto_policy_set_from_profile_for_rtcp(crypto_policy_t *policy, - srtp_profile_t profile); +crypto_policy_set_from_profile_for_rtcp(crypto_policy_t *policy, + srtp_profile_t profile); /** * @brief returns the master key length for a given SRTP profile @@ -959,18 +960,18 @@ srtp_profile_get_master_salt_length(srtp_profile_t profile); /** * @brief appends the salt to the key * - * The function call append_salt_to_key(k, klen, s, slen) + * The function call append_salt_to_key(k, klen, s, slen) * copies the string s to the location at klen bytes following - * the location k. + * the location k. * * @warning There must be at least bytes_in_salt + bytes_in_key bytes * available at the location pointed to by key. - * + * */ void append_salt_to_key(unsigned char *key, unsigned int bytes_in_key, - unsigned char *salt, unsigned int bytes_in_salt); + unsigned char *salt, unsigned int bytes_in_salt); @@ -982,7 +983,7 @@ append_salt_to_key(unsigned char *key, unsigned int bytes_in_key, /** * @defgroup SRTCP Secure RTCP - * @ingroup SRTP + * @ingroup SRTP * * @brief Secure RTCP functions are used to protect RTCP traffic. * @@ -990,36 +991,36 @@ append_salt_to_key(unsigned char *key, unsigned int bytes_in_key, * traffic in much the same way as it does RTP traffic. The function * srtp_protect_rtcp() applies cryptographic protections to outbound * RTCP packets, and srtp_unprotect_rtcp() verifies the protections on - * inbound RTCP packets. + * inbound RTCP packets. * * A note on the naming convention: srtp_protect_rtcp() has an srtp_t * as its first argument, and thus has `srtp_' as its prefix. The - * trailing `_rtcp' indicates the protocol on which it acts. - * + * trailing `_rtcp' indicates the protocol on which it acts. + * * @{ */ /** * @brief srtp_protect_rtcp() is the Secure RTCP sender-side packet * processing function. - * + * * The function call srtp_protect_rtcp(ctx, rtp_hdr, len_ptr) applies * SRTCP protection to the RTCP packet rtcp_hdr (which has length * *len_ptr) using the SRTP session context ctx. If err_status_ok is * returned, then rtp_hdr points to the resulting SRTCP packet and * *len_ptr is the number of octets in that packet; otherwise, no * assumptions should be made about the value of either data elements. - * + * * @warning This function assumes that it can write the authentication * tag into the location in memory immediately following the RTCP * packet, and assumes that the RTCP packet is aligned on a 32-bit * boundary. * - * @warning This function assumes that it can write SRTP_MAX_TRAILER_LEN+4 - * into the location in memory immediately following the RTCP packet. - * Callers MUST ensure that this much writable memory is available in + * @warning This function assumes that it can write SRTP_MAX_TRAILER_LEN+4 + * into the location in memory immediately following the RTCP packet. + * Callers MUST ensure that this much writable memory is available in * the buffer that holds the RTCP packet. - * + * * @param ctx is the SRTP context to use in processing the packet. * * @param rtcp_hdr is a pointer to the RTCP packet (before the call); after @@ -1031,14 +1032,14 @@ append_salt_to_key(unsigned char *key, unsigned int bytes_in_key, * was returned. Otherwise, the value of the data to which it points * is undefined. * - * @return + * @return * - err_status_ok if there were no problems. - * - [other] if there was a failure in + * - [other] if there was a failure in * the cryptographic mechanisms. */ - -err_status_t + +err_status_t srtp_protect_rtcp(srtp_t ctx, void *rtcp_hdr, int *pkt_octet_len); /** @@ -1052,7 +1053,7 @@ srtp_protect_rtcp(srtp_t ctx, void *rtcp_hdr, int *pkt_octet_len); * to the resulting RTCP packet and *len_ptr is the number of octets * in that packet; otherwise, no assumptions should be made about the * value of either data elements. - * + * * @warning This function assumes that the SRTCP packet is aligned on a * 32-bit boundary. * @@ -1070,9 +1071,9 @@ srtp_protect_rtcp(srtp_t ctx, void *rtcp_hdr, int *pkt_octet_len); * returned. Otherwise, the value of the data to which it points is * undefined. * - * @return + * @return * - err_status_ok if the RTCP packet is valid. - * - err_status_auth_fail if the SRTCP packet failed the message + * - err_status_auth_fail if the SRTCP packet failed the message * authentication check. * - err_status_replay_fail if the SRTCP packet is a replay (e.g. has * already been processed and accepted). @@ -1080,7 +1081,7 @@ srtp_protect_rtcp(srtp_t ctx, void *rtcp_hdr, int *pkt_octet_len); * */ -err_status_t +err_status_t srtp_unprotect_rtcp(srtp_t ctx, void *srtcp_hdr, int *pkt_octet_len); /** @@ -1142,10 +1143,10 @@ srtp_get_user_data(srtp_t ctx); * @defgroup SRTPevents SRTP events and callbacks * @ingroup SRTP * - * @brief libSRTP can use a user-provided callback function to + * @brief libSRTP can use a user-provided callback function to * handle events. * - * + * * libSRTP allows a user to provide a callback function to handle * events that need to be dealt with outside of the data plane (see * the enum srtp_event_t for a description of these events). Dealing @@ -1166,8 +1167,8 @@ srtp_get_user_data(srtp_t ctx); * @brief srtp_event_t defines events that need to be handled * * The enum srtp_event_t defines events that need to be handled - * outside the `data plane', such as SSRC collisions and - * key expirations. + * outside the `data plane', such as SSRC collisions and + * key expirations. * * When a key expires or the maximum number of packets has been * reached, an SRTP stream will enter an `expired' state in which no @@ -1180,33 +1181,33 @@ srtp_get_user_data(srtp_t ctx); * latter case, all of the streams in the session will expire. */ -typedef enum { - event_ssrc_collision, /**< - * An SSRC collision occured. +typedef enum { + event_ssrc_collision, /**< + * An SSRC collision occured. */ - event_key_soft_limit, /**< An SRTP stream reached the soft key - * usage limit and will expire soon. + event_key_soft_limit, /**< An SRTP stream reached the soft key + * usage limit and will expire soon. */ - event_key_hard_limit, /**< An SRTP stream reached the hard + event_key_hard_limit, /**< An SRTP stream reached the hard * key usage limit and has expired. */ - event_packet_index_limit /**< An SRTP stream reached the hard - * packet limit (2^48 packets). + event_packet_index_limit /**< An SRTP stream reached the hard + * packet limit (2^48 packets). */ } srtp_event_t; /** - * @brief srtp_event_data_t is the structure passed as a callback to + * @brief srtp_event_data_t is the structure passed as a callback to * the event handler function * * The struct srtp_event_data_t holds the data passed to the event - * handler function. + * handler function. */ typedef struct srtp_event_data_t { - srtp_t session; /**< The session in which the event happend. */ - srtp_stream_t stream; /**< The stream in which the event happend. */ - srtp_event_t event; /**< An enum indicating the type of event. */ + srtp_t session; /**< The session in which the event happend. */ + srtp_stream_t stream; /**< The stream in which the event happend. */ + srtp_event_t event; /**< An enum indicating the type of event. */ } srtp_event_data_t; /** @@ -1224,7 +1225,7 @@ typedef void (srtp_event_handler_func_t)(srtp_event_data_t *data); /** * @brief sets the event handler to the function supplied by the caller. - * + * * The function call srtp_install_event_handler(func) sets the event * handler function to the value func. The value NULL is acceptable * as an argument; in this case, events will be ignored rather than @@ -1239,14 +1240,14 @@ err_status_t srtp_install_event_handler(srtp_event_handler_func_t func); /** - * @brief Returns the version string of the library. - * + * @brief Returns the version string of the library. + * */ const char *srtp_get_version_string(void); /** - * @brief Returns the numeric representation of the library version. - * + * @brief Returns the numeric representation of the library version. + * */ unsigned int srtp_get_version(void); |