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

Side by Side Diff: talk/session/media/srtpfilter.cc

Issue 1337673002: Change WebRTC SslCipher to be exposed as number only. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Created 5 years, 2 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 | « talk/session/media/srtpfilter.h ('k') | talk/session/media/srtpfilter_unittest.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 * libjingle 2 * libjingle
3 * Copyright 2009 Google Inc. 3 * Copyright 2009 Google Inc.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met: 6 * modification, are permitted provided that the following conditions are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright notice, 8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer. 9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, 10 * 2. Redistributions in binary form must reproduce the above copyright notice,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 extern "C" debug_module_t mod_aes_icm; 66 extern "C" debug_module_t mod_aes_icm;
67 extern "C" debug_module_t mod_aes_hmac; 67 extern "C" debug_module_t mod_aes_hmac;
68 #endif 68 #endif
69 #else 69 #else
70 // SrtpFilter needs that constant. 70 // SrtpFilter needs that constant.
71 #define SRTP_MASTER_KEY_LEN 30 71 #define SRTP_MASTER_KEY_LEN 30
72 #endif // HAVE_SRTP 72 #endif // HAVE_SRTP
73 73
74 namespace cricket { 74 namespace cricket {
75 75
76 const char CS_AES_CM_128_HMAC_SHA1_80[] = "AES_CM_128_HMAC_SHA1_80";
77 const char CS_AES_CM_128_HMAC_SHA1_32[] = "AES_CM_128_HMAC_SHA1_32";
78 const int SRTP_MASTER_KEY_BASE64_LEN = SRTP_MASTER_KEY_LEN * 4 / 3; 76 const int SRTP_MASTER_KEY_BASE64_LEN = SRTP_MASTER_KEY_LEN * 4 / 3;
79 const int SRTP_MASTER_KEY_KEY_LEN = 16; 77 const int SRTP_MASTER_KEY_KEY_LEN = 16;
80 const int SRTP_MASTER_KEY_SALT_LEN = 14; 78 const int SRTP_MASTER_KEY_SALT_LEN = 14;
81 79
82 #ifndef HAVE_SRTP 80 #ifndef HAVE_SRTP
83 81
84 // This helper function is used on systems that don't (yet) have SRTP, 82 // This helper function is used on systems that don't (yet) have SRTP,
85 // to log that the functions that require it won't do anything. 83 // to log that the functions that require it won't do anything.
86 namespace { 84 namespace {
87 bool SrtpNotAvailable(const char *func) { 85 bool SrtpNotAvailable(const char *func) {
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 return false; 654 return false;
657 } 655 }
658 656
659 if (!Init()) { 657 if (!Init()) {
660 return false; 658 return false;
661 } 659 }
662 660
663 srtp_policy_t policy; 661 srtp_policy_t policy;
664 memset(&policy, 0, sizeof(policy)); 662 memset(&policy, 0, sizeof(policy));
665 663
666 if (cs == CS_AES_CM_128_HMAC_SHA1_80) { 664 if (cs == rtc::CS_AES_CM_128_HMAC_SHA1_80) {
667 crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp); 665 crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp);
668 crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); 666 crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp);
669 } else if (cs == CS_AES_CM_128_HMAC_SHA1_32) { 667 } else if (cs == rtc::CS_AES_CM_128_HMAC_SHA1_32) {
670 crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp); // rtp is 32, 668 crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp); // rtp is 32,
671 crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); // rtcp still 80 669 crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); // rtcp still 80
672 } else { 670 } else {
673 LOG(LS_WARNING) << "Failed to create SRTP session: unsupported" 671 LOG(LS_WARNING) << "Failed to create SRTP session: unsupported"
674 << " cipher_suite " << cs.c_str(); 672 << " cipher_suite " << cs.c_str();
675 return false; 673 return false;
676 } 674 }
677 675
678 if (!key || len != SRTP_MASTER_KEY_LEN) { 676 if (!key || len != SRTP_MASTER_KEY_LEN) {
679 LOG(LS_WARNING) << "Failed to create SRTP session: invalid key"; 677 LOG(LS_WARNING) << "Failed to create SRTP session: invalid key";
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
930 SrtpNotAvailable(__FUNCTION__); 928 SrtpNotAvailable(__FUNCTION__);
931 } 929 }
932 930
933 void SrtpStat::HandleSrtpResult(const SrtpStat::FailureKey& key) { 931 void SrtpStat::HandleSrtpResult(const SrtpStat::FailureKey& key) {
934 SrtpNotAvailable(__FUNCTION__); 932 SrtpNotAvailable(__FUNCTION__);
935 } 933 }
936 934
937 #endif // HAVE_SRTP 935 #endif // HAVE_SRTP
938 936
939 } // namespace cricket 937 } // namespace cricket
OLDNEW
« no previous file with comments | « talk/session/media/srtpfilter.h ('k') | talk/session/media/srtpfilter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698