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

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

Issue 1380603005: Revert of 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";
76 const int SRTP_MASTER_KEY_BASE64_LEN = SRTP_MASTER_KEY_LEN * 4 / 3; 78 const int SRTP_MASTER_KEY_BASE64_LEN = SRTP_MASTER_KEY_LEN * 4 / 3;
77 const int SRTP_MASTER_KEY_KEY_LEN = 16; 79 const int SRTP_MASTER_KEY_KEY_LEN = 16;
78 const int SRTP_MASTER_KEY_SALT_LEN = 14; 80 const int SRTP_MASTER_KEY_SALT_LEN = 14;
79 81
80 #ifndef HAVE_SRTP 82 #ifndef HAVE_SRTP
81 83
82 // This helper function is used on systems that don't (yet) have SRTP, 84 // This helper function is used on systems that don't (yet) have SRTP,
83 // to log that the functions that require it won't do anything. 85 // to log that the functions that require it won't do anything.
84 namespace { 86 namespace {
85 bool SrtpNotAvailable(const char *func) { 87 bool SrtpNotAvailable(const char *func) {
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 return false; 656 return false;
655 } 657 }
656 658
657 if (!Init()) { 659 if (!Init()) {
658 return false; 660 return false;
659 } 661 }
660 662
661 srtp_policy_t policy; 663 srtp_policy_t policy;
662 memset(&policy, 0, sizeof(policy)); 664 memset(&policy, 0, sizeof(policy));
663 665
664 if (cs == rtc::CS_AES_CM_128_HMAC_SHA1_80) { 666 if (cs == CS_AES_CM_128_HMAC_SHA1_80) {
665 crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp); 667 crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtp);
666 crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); 668 crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp);
667 } else if (cs == rtc::CS_AES_CM_128_HMAC_SHA1_32) { 669 } else if (cs == CS_AES_CM_128_HMAC_SHA1_32) {
668 crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp); // rtp is 32, 670 crypto_policy_set_aes_cm_128_hmac_sha1_32(&policy.rtp); // rtp is 32,
669 crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); // rtcp still 80 671 crypto_policy_set_aes_cm_128_hmac_sha1_80(&policy.rtcp); // rtcp still 80
670 } else { 672 } else {
671 LOG(LS_WARNING) << "Failed to create SRTP session: unsupported" 673 LOG(LS_WARNING) << "Failed to create SRTP session: unsupported"
672 << " cipher_suite " << cs.c_str(); 674 << " cipher_suite " << cs.c_str();
673 return false; 675 return false;
674 } 676 }
675 677
676 if (!key || len != SRTP_MASTER_KEY_LEN) { 678 if (!key || len != SRTP_MASTER_KEY_LEN) {
677 LOG(LS_WARNING) << "Failed to create SRTP session: invalid key"; 679 LOG(LS_WARNING) << "Failed to create SRTP session: invalid key";
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 SrtpNotAvailable(__FUNCTION__); 930 SrtpNotAvailable(__FUNCTION__);
929 } 931 }
930 932
931 void SrtpStat::HandleSrtpResult(const SrtpStat::FailureKey& key) { 933 void SrtpStat::HandleSrtpResult(const SrtpStat::FailureKey& key) {
932 SrtpNotAvailable(__FUNCTION__); 934 SrtpNotAvailable(__FUNCTION__);
933 } 935 }
934 936
935 #endif // HAVE_SRTP 937 #endif // HAVE_SRTP
936 938
937 } // namespace cricket 939 } // 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