| OLD | NEW |
| 1 /* | 1 /* |
| 2 * srtp_priv.h | 2 * srtp_priv.h |
| 3 * | 3 * |
| 4 * private internal data structures and functions for libSRTP | 4 * private internal data structures and functions for 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 27 matching lines...) Expand all Loading... |
| 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 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 #ifndef SRTP_PRIV_H | 45 #ifndef SRTP_PRIV_H |
| 46 #define SRTP_PRIV_H | 46 #define SRTP_PRIV_H |
| 47 | 47 |
| 48 #include "config.h" |
| 48 #include "srtp.h" | 49 #include "srtp.h" |
| 49 #include "rdbx.h" | 50 #include "rdbx.h" |
| 50 #include "rdb.h" | 51 #include "rdb.h" |
| 51 #include "integers.h" | 52 #include "integers.h" |
| 53 #include "crypto.h" |
| 54 #include "cipher.h" |
| 55 #include "auth.h" |
| 56 #include "aes.h" |
| 57 #include "key.h" |
| 58 #include "crypto_kernel.h" |
| 59 |
| 60 #define SRTP_VER_STRING PACKAGE_STRING |
| 61 #define SRTP_VERSION PACKAGE_VERSION |
| 52 | 62 |
| 53 /* | 63 /* |
| 54 * an srtp_hdr_t represents the srtp header | 64 * an srtp_hdr_t represents the srtp header |
| 55 * | 65 * |
| 56 * in this implementation, an srtp_hdr_t is assumed to be 32-bit aligned | 66 * in this implementation, an srtp_hdr_t is assumed to be 32-bit aligned |
| 57 * | 67 * |
| 58 * (note that this definition follows that of RFC 1889 Appendix A, but | 68 * (note that this definition follows that of RFC 1889 Appendix A, but |
| 59 * is not identical) | 69 * is not identical) |
| 60 */ | 70 */ |
| 61 | 71 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 81 } srtp_hdr_t; | 91 } srtp_hdr_t; |
| 82 | 92 |
| 83 #else /* BIG_ENDIAN */ | 93 #else /* BIG_ENDIAN */ |
| 84 | 94 |
| 85 typedef struct { | 95 typedef struct { |
| 86 unsigned char version:2; /* protocol version */ | 96 unsigned char version:2; /* protocol version */ |
| 87 unsigned char p:1; /* padding flag */ | 97 unsigned char p:1; /* padding flag */ |
| 88 unsigned char x:1; /* header extension flag */ | 98 unsigned char x:1; /* header extension flag */ |
| 89 unsigned char cc:4; /* CSRC count */ | 99 unsigned char cc:4; /* CSRC count */ |
| 90 unsigned char m:1; /* marker bit */ | 100 unsigned char m:1; /* marker bit */ |
| 91 unsigned pt:7;» /* payload type */ | 101 unsigned char pt:7;» /* payload type */ |
| 92 uint16_t seq; /* sequence number */ | 102 uint16_t seq; /* sequence number */ |
| 93 uint32_t ts; /* timestamp */ | 103 uint32_t ts; /* timestamp */ |
| 94 uint32_t ssrc; /* synchronization source */ | 104 uint32_t ssrc; /* synchronization source */ |
| 95 } srtp_hdr_t; | 105 } srtp_hdr_t; |
| 96 | 106 |
| 97 #endif | 107 #endif |
| 98 | 108 |
| 99 typedef struct { | 109 typedef struct { |
| 100 uint16_t profile_specific; /* profile-specific info */ | 110 uint16_t profile_specific; /* profile-specific info */ |
| 101 uint16_t length; /* number of 32-bit words in extension */ | 111 uint16_t length; /* number of 32-bit words in extension */ |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 rdbx_t rtp_rdbx; | 223 rdbx_t rtp_rdbx; |
| 214 sec_serv_t rtp_services; | 224 sec_serv_t rtp_services; |
| 215 cipher_t *rtcp_cipher; | 225 cipher_t *rtcp_cipher; |
| 216 auth_t *rtcp_auth; | 226 auth_t *rtcp_auth; |
| 217 rdb_t rtcp_rdb; | 227 rdb_t rtcp_rdb; |
| 218 sec_serv_t rtcp_services; | 228 sec_serv_t rtcp_services; |
| 219 key_limit_ctx_t *limit; | 229 key_limit_ctx_t *limit; |
| 220 direction_t direction; | 230 direction_t direction; |
| 221 int allow_repeat_tx; | 231 int allow_repeat_tx; |
| 222 ekt_stream_t ekt; | 232 ekt_stream_t ekt; |
| 233 uint8_t salt[SRTP_AEAD_SALT_LEN]; /* used with GCM mode for SRTP */ |
| 234 uint8_t c_salt[SRTP_AEAD_SALT_LEN]; /* used with GCM mode for SRTCP */ |
| 223 struct srtp_stream_ctx_t *next; /* linked list of streams */ | 235 struct srtp_stream_ctx_t *next; /* linked list of streams */ |
| 224 } srtp_stream_ctx_t; | 236 } srtp_stream_ctx_t; |
| 225 | 237 |
| 226 | 238 |
| 227 /* | 239 /* |
| 228 * an srtp_ctx_t holds a stream list and a service description | 240 * an srtp_ctx_t holds a stream list and a service description |
| 229 */ | 241 */ |
| 230 | 242 |
| 231 typedef struct srtp_ctx_t { | 243 typedef struct srtp_ctx_t { |
| 232 srtp_stream_ctx_t *stream_list; /* linked list of streams */ | 244 srtp_stream_ctx_t *stream_list; /* linked list of streams */ |
| 233 srtp_stream_ctx_t *stream_template; /* act as template for other streams */ | 245 srtp_stream_ctx_t *stream_template; /* act as template for other streams */ |
| 246 void *user_data; /* user custom data */ |
| 234 } srtp_ctx_t; | 247 } srtp_ctx_t; |
| 235 | 248 |
| 236 | 249 |
| 237 | 250 |
| 238 /* | 251 /* |
| 239 * srtp_handle_event(srtp, srtm, evnt) calls the event handling | 252 * srtp_handle_event(srtp, srtm, evnt) calls the event handling |
| 240 * function, if there is one. | 253 * function, if there is one. |
| 241 * | 254 * |
| 242 * This macro is not included in the documentation as it is | 255 * This macro is not included in the documentation as it is |
| 243 * an internal-only function. | 256 * an internal-only function. |
| 244 */ | 257 */ |
| 245 | 258 |
| 246 #define srtp_handle_event(srtp, strm, evnt) \ | 259 #define srtp_handle_event(srtp, strm, evnt) \ |
| 247 if(srtp_event_handler) { \ | 260 if(srtp_event_handler) { \ |
| 248 srtp_event_data_t data; \ | 261 srtp_event_data_t data; \ |
| 249 data.session = srtp; \ | 262 data.session = srtp; \ |
| 250 data.stream = strm; \ | 263 data.stream = strm; \ |
| 251 data.event = evnt; \ | 264 data.event = evnt; \ |
| 252 srtp_event_handler(&data); \ | 265 srtp_event_handler(&data); \ |
| 253 } | 266 } |
| 254 | 267 |
| 255 | 268 |
| 256 #endif /* SRTP_PRIV_H */ | 269 #endif /* SRTP_PRIV_H */ |
| OLD | NEW |