xref: /openbsd-src/lib/libssl/srtp.h (revision d10f98510e816f59ba90467479444955e0a550c6)
1*d10f9851Slandry /* $OpenBSD: srtp.h,v 1.7 2021/06/11 15:28:13 landry Exp $ */
2ec07fdf1Sdjm /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3ec07fdf1Sdjm  * All rights reserved.
4ec07fdf1Sdjm  *
5ec07fdf1Sdjm  * This package is an SSL implementation written
6ec07fdf1Sdjm  * by Eric Young (eay@cryptsoft.com).
7ec07fdf1Sdjm  * The implementation was written so as to conform with Netscapes SSL.
8ec07fdf1Sdjm  *
9ec07fdf1Sdjm  * This library is free for commercial and non-commercial use as long as
10ec07fdf1Sdjm  * the following conditions are aheared to.  The following conditions
11ec07fdf1Sdjm  * apply to all code found in this distribution, be it the RC4, RSA,
12ec07fdf1Sdjm  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
13ec07fdf1Sdjm  * included with this distribution is covered by the same copyright terms
14ec07fdf1Sdjm  * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15ec07fdf1Sdjm  *
16ec07fdf1Sdjm  * Copyright remains Eric Young's, and as such any Copyright notices in
17ec07fdf1Sdjm  * the code are not to be removed.
18ec07fdf1Sdjm  * If this package is used in a product, Eric Young should be given attribution
19ec07fdf1Sdjm  * as the author of the parts of the library used.
20ec07fdf1Sdjm  * This can be in the form of a textual message at program startup or
21ec07fdf1Sdjm  * in documentation (online or textual) provided with the package.
22ec07fdf1Sdjm  *
23ec07fdf1Sdjm  * Redistribution and use in source and binary forms, with or without
24ec07fdf1Sdjm  * modification, are permitted provided that the following conditions
25ec07fdf1Sdjm  * are met:
26ec07fdf1Sdjm  * 1. Redistributions of source code must retain the copyright
27ec07fdf1Sdjm  *    notice, this list of conditions and the following disclaimer.
28ec07fdf1Sdjm  * 2. Redistributions in binary form must reproduce the above copyright
29ec07fdf1Sdjm  *    notice, this list of conditions and the following disclaimer in the
30ec07fdf1Sdjm  *    documentation and/or other materials provided with the distribution.
31ec07fdf1Sdjm  * 3. All advertising materials mentioning features or use of this software
32ec07fdf1Sdjm  *    must display the following acknowledgement:
33ec07fdf1Sdjm  *    "This product includes cryptographic software written by
34ec07fdf1Sdjm  *     Eric Young (eay@cryptsoft.com)"
35ec07fdf1Sdjm  *    The word 'cryptographic' can be left out if the rouines from the library
36ec07fdf1Sdjm  *    being used are not cryptographic related :-).
37ec07fdf1Sdjm  * 4. If you include any Windows specific code (or a derivative thereof) from
38ec07fdf1Sdjm  *    the apps directory (application code) you must include an acknowledgement:
39ec07fdf1Sdjm  *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40ec07fdf1Sdjm  *
41ec07fdf1Sdjm  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42ec07fdf1Sdjm  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43ec07fdf1Sdjm  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44ec07fdf1Sdjm  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45ec07fdf1Sdjm  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46ec07fdf1Sdjm  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47ec07fdf1Sdjm  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48ec07fdf1Sdjm  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49ec07fdf1Sdjm  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50ec07fdf1Sdjm  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51ec07fdf1Sdjm  * SUCH DAMAGE.
52ec07fdf1Sdjm  *
53ec07fdf1Sdjm  * The licence and distribution terms for any publically available version or
54ec07fdf1Sdjm  * derivative of this code cannot be changed.  i.e. this code cannot simply be
55ec07fdf1Sdjm  * copied and put under another distribution licence
56ec07fdf1Sdjm  * [including the GNU Public Licence.]
57ec07fdf1Sdjm  */
58ec07fdf1Sdjm /* ====================================================================
59ec07fdf1Sdjm  * Copyright (c) 1998-2006 The OpenSSL Project.  All rights reserved.
60ec07fdf1Sdjm  *
61ec07fdf1Sdjm  * Redistribution and use in source and binary forms, with or without
62ec07fdf1Sdjm  * modification, are permitted provided that the following conditions
63ec07fdf1Sdjm  * are met:
64ec07fdf1Sdjm  *
65ec07fdf1Sdjm  * 1. Redistributions of source code must retain the above copyright
66ec07fdf1Sdjm  *    notice, this list of conditions and the following disclaimer.
67ec07fdf1Sdjm  *
68ec07fdf1Sdjm  * 2. Redistributions in binary form must reproduce the above copyright
69ec07fdf1Sdjm  *    notice, this list of conditions and the following disclaimer in
70ec07fdf1Sdjm  *    the documentation and/or other materials provided with the
71ec07fdf1Sdjm  *    distribution.
72ec07fdf1Sdjm  *
73ec07fdf1Sdjm  * 3. All advertising materials mentioning features or use of this
74ec07fdf1Sdjm  *    software must display the following acknowledgment:
75ec07fdf1Sdjm  *    "This product includes software developed by the OpenSSL Project
76ec07fdf1Sdjm  *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77ec07fdf1Sdjm  *
78ec07fdf1Sdjm  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79ec07fdf1Sdjm  *    endorse or promote products derived from this software without
80ec07fdf1Sdjm  *    prior written permission. For written permission, please contact
81ec07fdf1Sdjm  *    openssl-core@openssl.org.
82ec07fdf1Sdjm  *
83ec07fdf1Sdjm  * 5. Products derived from this software may not be called "OpenSSL"
84ec07fdf1Sdjm  *    nor may "OpenSSL" appear in their names without prior written
85ec07fdf1Sdjm  *    permission of the OpenSSL Project.
86ec07fdf1Sdjm  *
87ec07fdf1Sdjm  * 6. Redistributions of any form whatsoever must retain the following
88ec07fdf1Sdjm  *    acknowledgment:
89ec07fdf1Sdjm  *    "This product includes software developed by the OpenSSL Project
90ec07fdf1Sdjm  *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91ec07fdf1Sdjm  *
92ec07fdf1Sdjm  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93ec07fdf1Sdjm  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94ec07fdf1Sdjm  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95ec07fdf1Sdjm  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
96ec07fdf1Sdjm  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97ec07fdf1Sdjm  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98ec07fdf1Sdjm  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99ec07fdf1Sdjm  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100ec07fdf1Sdjm  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101ec07fdf1Sdjm  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102ec07fdf1Sdjm  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103ec07fdf1Sdjm  * OF THE POSSIBILITY OF SUCH DAMAGE.
104ec07fdf1Sdjm  * ====================================================================
105ec07fdf1Sdjm  *
106ec07fdf1Sdjm  * This product includes cryptographic software written by Eric Young
107ec07fdf1Sdjm  * (eay@cryptsoft.com).  This product includes software written by Tim
108ec07fdf1Sdjm  * Hudson (tjh@cryptsoft.com).
109ec07fdf1Sdjm  *
110ec07fdf1Sdjm  */
111ec07fdf1Sdjm /*
112dbea66cdSguenther  * DTLS code by Eric Rescorla <ekr@rtfm.com>
113dbea66cdSguenther  *
114dbea66cdSguenther  * Copyright (C) 2006, Network Resonance, Inc.
115dbea66cdSguenther  * Copyright (C) 2011, RTFM, Inc.
116ec07fdf1Sdjm  */
117ec07fdf1Sdjm 
118ec07fdf1Sdjm #ifndef HEADER_D1_SRTP_H
119ec07fdf1Sdjm #define HEADER_D1_SRTP_H
120ec07fdf1Sdjm 
121ec07fdf1Sdjm #ifdef  __cplusplus
122ec07fdf1Sdjm extern "C" {
123ec07fdf1Sdjm #endif
124ec07fdf1Sdjm 
125ec07fdf1Sdjm #define SRTP_AES128_CM_SHA1_80 0x0001
126ec07fdf1Sdjm #define SRTP_AES128_CM_SHA1_32 0x0002
127ec07fdf1Sdjm #define SRTP_AES128_F8_SHA1_80 0x0003
128ec07fdf1Sdjm #define SRTP_AES128_F8_SHA1_32 0x0004
129ec07fdf1Sdjm #define SRTP_NULL_SHA1_80      0x0005
130ec07fdf1Sdjm #define SRTP_NULL_SHA1_32      0x0006
131ec07fdf1Sdjm 
132*d10f9851Slandry /* AEAD SRTP protection profiles from RFC 7714 */
133*d10f9851Slandry #define SRTP_AEAD_AES_128_GCM  0x0007
134*d10f9851Slandry #define SRTP_AEAD_AES_256_GCM  0x0008
135*d10f9851Slandry 
136ec07fdf1Sdjm int SSL_CTX_set_tlsext_use_srtp(SSL_CTX *ctx, const char *profiles);
137ec07fdf1Sdjm int SSL_set_tlsext_use_srtp(SSL *ctx, const char *profiles);
138ec07fdf1Sdjm 
139ec07fdf1Sdjm STACK_OF(SRTP_PROTECTION_PROFILE) *SSL_get_srtp_profiles(SSL *ssl);
140ec07fdf1Sdjm SRTP_PROTECTION_PROFILE *SSL_get_selected_srtp_profile(SSL *s);
141ec07fdf1Sdjm 
142ec07fdf1Sdjm #ifdef  __cplusplus
143ec07fdf1Sdjm }
144ec07fdf1Sdjm #endif
145ec07fdf1Sdjm 
146ec07fdf1Sdjm #endif
147