Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(525)

Side by Side Diff: webrtc/base/sslstreamadapter.h

Issue 1528843005: Add support for GCM cipher suites from RFC 7714. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Disable GCM if ENABLE_EXTERNAL_AUTH is defined. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/base/opensslstreamadapter.cc ('k') | webrtc/base/sslstreamadapter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 13 matching lines...) Expand all
24 const int TLS_NULL_WITH_NULL_NULL = 0; 24 const int TLS_NULL_WITH_NULL_NULL = 0;
25 25
26 // Constants for SRTP profiles. 26 // Constants for SRTP profiles.
27 const int SRTP_INVALID_CRYPTO_SUITE = 0; 27 const int SRTP_INVALID_CRYPTO_SUITE = 0;
28 #ifndef SRTP_AES128_CM_SHA1_80 28 #ifndef SRTP_AES128_CM_SHA1_80
29 const int SRTP_AES128_CM_SHA1_80 = 0x0001; 29 const int SRTP_AES128_CM_SHA1_80 = 0x0001;
30 #endif 30 #endif
31 #ifndef SRTP_AES128_CM_SHA1_32 31 #ifndef SRTP_AES128_CM_SHA1_32
32 const int SRTP_AES128_CM_SHA1_32 = 0x0002; 32 const int SRTP_AES128_CM_SHA1_32 = 0x0002;
33 #endif 33 #endif
34 #ifndef SRTP_AEAD_AES_128_GCM
35 const int SRTP_AEAD_AES_128_GCM = 0x0007;
36 #endif
37 #ifndef SRTP_AEAD_AES_256_GCM
38 const int SRTP_AEAD_AES_256_GCM = 0x0008;
39 #endif
34 40
35 // Cipher suite to use for SRTP. Typically a 80-bit HMAC will be used, except 41 // Cipher suite to use for SRTP. Typically a 80-bit HMAC will be used, except
36 // in applications (voice) where the additional bandwidth may be significant. 42 // in applications (voice) where the additional bandwidth may be significant.
37 // A 80-bit HMAC is always used for SRTCP. 43 // A 80-bit HMAC is always used for SRTCP.
38 // 128-bit AES with 80-bit SHA-1 HMAC. 44 // 128-bit AES with 80-bit SHA-1 HMAC.
39 extern const char CS_AES_CM_128_HMAC_SHA1_80[]; 45 extern const char CS_AES_CM_128_HMAC_SHA1_80[];
40 // 128-bit AES with 32-bit SHA-1 HMAC. 46 // 128-bit AES with 32-bit SHA-1 HMAC.
41 extern const char CS_AES_CM_128_HMAC_SHA1_32[]; 47 extern const char CS_AES_CM_128_HMAC_SHA1_32[];
48 // 128-bit AES GCM with 16 byte AEAD auth tag.
49 extern const char CS_AEAD_AES_128_GCM[];
50 // 256-bit AES GCM with 16 byte AEAD auth tag.
51 extern const char CS_AEAD_AES_256_GCM[];
42 52
43 // Given the DTLS-SRTP protection profile ID, as defined in 53 // Given the DTLS-SRTP protection profile ID, as defined in
44 // https://tools.ietf.org/html/rfc4568#section-6.2 , return the SRTP profile 54 // https://tools.ietf.org/html/rfc4568#section-6.2 , return the SRTP profile
45 // name, as defined in https://tools.ietf.org/html/rfc5764#section-4.1.2. 55 // name, as defined in https://tools.ietf.org/html/rfc5764#section-4.1.2.
46 std::string SrtpCryptoSuiteToName(int crypto_suite); 56 std::string SrtpCryptoSuiteToName(int crypto_suite);
47 57
48 // The reverse of above conversion. 58 // The reverse of above conversion.
49 int SrtpCryptoSuiteFromName(const std::string& crypto_suite); 59 int SrtpCryptoSuiteFromName(const std::string& crypto_suite);
50 60
61 // Get key length and salt length for given crypto suite. Returns true for
62 // valid suites, otherwise false.
63 bool GetSrtpKeyAndSaltLengths(int crypto_suite, int *key_length,
64 int *salt_length);
65
66 // Returns true if the given crypto suite id uses a GCM cipher.
67 bool IsGcmCryptoSuite(int crypto_suite);
68
69 // Returns true if the given crypto suite name uses a GCM cipher.
70 bool IsGcmCryptoSuiteName(const std::string& crypto_suite);
71
72 struct CryptoOptions {
73 CryptoOptions() {}
74
75 // Helper method to return an instance of the CryptoOptions with GCM crypto
76 // suites disabled. This method should be used instead of depending on current
77 // default values set by the constructor.
78 static CryptoOptions NoGcm();
79
80 // Enable GCM crypto suites from RFC 7714 for SRTP. GCM will only be used
81 // if both sides enable it.
82 bool enable_gcm_crypto_suites = false;
83 };
84
51 // SSLStreamAdapter : A StreamInterfaceAdapter that does SSL/TLS. 85 // SSLStreamAdapter : A StreamInterfaceAdapter that does SSL/TLS.
52 // After SSL has been started, the stream will only open on successful 86 // After SSL has been started, the stream will only open on successful
53 // SSL verification of certificates, and the communication is 87 // SSL verification of certificates, and the communication is
54 // encrypted of course. 88 // encrypted of course.
55 // 89 //
56 // This class was written with SSLAdapter as a starting point. It 90 // This class was written with SSLAdapter as a starting point. It
57 // offers a similar interface, with two differences: there is no 91 // offers a similar interface, with two differences: there is no
58 // support for a restartable SSL connection, and this class has a 92 // support for a restartable SSL connection, and this class has a
59 // peer-to-peer mode. 93 // peer-to-peer mode.
60 // 94 //
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 249
216 // If true (default), the client is required to provide a certificate during 250 // If true (default), the client is required to provide a certificate during
217 // handshake. If no certificate is given, handshake fails. This applies to 251 // handshake. If no certificate is given, handshake fails. This applies to
218 // server mode only. 252 // server mode only.
219 bool client_auth_enabled_; 253 bool client_auth_enabled_;
220 }; 254 };
221 255
222 } // namespace rtc 256 } // namespace rtc
223 257
224 #endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_ 258 #endif // WEBRTC_BASE_SSLSTREAMADAPTER_H_
OLDNEW
« no previous file with comments | « webrtc/base/opensslstreamadapter.cc ('k') | webrtc/base/sslstreamadapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698