VLC 4.0.0-dev
Loading...
Searching...
No Matches
srtp.h
Go to the documentation of this file.
1/*
2 * Secure RTP with libgcrypt
3 * Copyright (C) 2007 RĂ©mi Denis-Courmont
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 2.1
8 * of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 ****************************************************************************/
19
20#ifndef LIBVLC_SRTP_H
21# define LIBVLC_SRTP_H 1
22
24
25enum
26{
27 SRTP_UNENCRYPTED=0x1, //< do not encrypt SRTP packets
28 SRTCP_UNENCRYPTED=0x2, //< do not encrypt SRTCP packets
29 SRTP_UNAUTHENTICATED=0x4, //< authenticate only SRTCP packets
30
31 SRTP_RCC_MODE1=0x10, //< use Roll-over-Counter Carry mode 1
32 SRTP_RCC_MODE2=0x20, //< use Roll-over-Counter Carry mode 2
33 SRTP_RCC_MODE3=0x30, //< use Roll-over-Counter Carry mode 3 (insecure)
34
35 SRTP_FLAGS_MASK=0x37 //< mask for valid flags
36};
37
38/** SRTP encryption algorithms (ciphers); same values as MIKEY */
39enum
40{
41 SRTP_ENCR_NULL=0, //< no encryption
42 SRTP_ENCR_AES_CM=1, //< AES counter mode
43 SRTP_ENCR_AES_F8=2, //< AES F8 mode (not implemented)
44};
45
46/** SRTP authenticaton algorithms; same values as MIKEY */
47enum
48{
49 SRTP_AUTH_NULL=0, //< no authentication code
50 SRTP_AUTH_HMAC_SHA1=1, //< HMAC-SHA1
51};
52
53/** SRTP pseudo random function; same values as MIKEY */
54enum
55{
56 SRTP_PRF_AES_CM=0, //< AES counter mode
57};
58
59# ifdef __cplusplus
60extern "C" {
61# endif
62
63srtp_session_t *srtp_create (int encr, int auth, unsigned tag_len, int prf,
64 unsigned flags);
66
67int srtp_setkey (srtp_session_t *s, const void *key, size_t keylen,
68 const void *salt, size_t saltlen);
69int srtp_setkeystring (srtp_session_t *s, const char *key, const char *salt);
70
71void srtp_setrcc_rate (srtp_session_t *s, uint16_t rate);
72
73int srtp_send (srtp_session_t *s, uint8_t *buf, size_t *lenp, size_t maxsize);
74int srtp_recv (srtp_session_t *s, uint8_t *buf, size_t *lenp);
75int srtcp_send (srtp_session_t *s, uint8_t *buf, size_t *lenp, size_t maxsiz);
76int srtcp_recv (srtp_session_t *s, uint8_t *buf, size_t *lenp);
77
78# ifdef __cplusplus
79}
80# endif
81#endif
82
@ SRTP_ENCR_AES_CM
Definition srtp.h:42
@ SRTP_ENCR_NULL
Definition srtp.h:41
@ SRTP_ENCR_AES_F8
Definition srtp.h:43
@ SRTP_UNENCRYPTED
Definition srtp.h:27
@ SRTP_RCC_MODE1
Definition srtp.h:31
@ SRTP_RCC_MODE3
Definition srtp.h:33
@ SRTP_FLAGS_MASK
Definition srtp.h:35
@ SRTP_UNAUTHENTICATED
Definition srtp.h:29
@ SRTP_RCC_MODE2
Definition srtp.h:32
@ SRTCP_UNENCRYPTED
Definition srtp.h:28
int srtp_setkey(srtp_session_t *s, const void *key, size_t keylen, const void *salt, size_t saltlen)
Sets (or resets) the master key and master salt for a SRTP session.
Definition srtp.c:267
int srtcp_send(srtp_session_t *s, uint8_t *buf, size_t *lenp, size_t maxsiz)
Turns a RTCP packet into a SRTCP packet: encrypt it, then computes the authentication tag and appends...
Definition srtp.c:788
void srtp_destroy(srtp_session_t *s)
Releases all resources associated with a Secure RTP session.
Definition srtp.c:98
int srtcp_recv(srtp_session_t *s, uint8_t *buf, size_t *lenp)
Turns a SRTCP packet into a RTCP packet: authenticates the packet, then decrypts it.
Definition srtp.c:829
int srtp_recv(srtp_session_t *s, uint8_t *buf, size_t *lenp)
Turns a SRTP packet into a RTP packet: authenticates the packet, then decrypts it.
Definition srtp.c:628
@ SRTP_PRF_AES_CM
Definition srtp.h:56
int srtp_send(srtp_session_t *s, uint8_t *buf, size_t *lenp, size_t maxsize)
Turns a RTP packet into a SRTP packet: encrypt it, then computes the authentication tag and appends i...
Definition srtp.c:544
void srtp_setrcc_rate(srtp_session_t *s, uint16_t rate)
Sets Roll-over-Counter Carry (RCC) rate for the SRTP session.
Definition srtp.c:386
srtp_session_t * srtp_create(int encr, int auth, unsigned tag_len, int prf, unsigned flags)
Allocates a Secure RTP one-way session.
Definition srtp.c:135
int srtp_setkeystring(srtp_session_t *s, const char *key, const char *salt)
Sets (or resets) the master key and master salt for a SRTP session from hexadecimal strings.
Definition srtp.c:353
@ SRTP_AUTH_NULL
Definition srtp.h:49
@ SRTP_AUTH_HMAC_SHA1
Definition srtp.h:50
Definition srtp.c:59
uint8_t tag_len
Definition srtp.c:68
unsigned flags
Definition srtp.c:62