OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/ssl/ssl_cipher_suite_names.h" | 5 #include "net/ssl/ssl_cipher_suite_names.h" |
6 | 6 |
7 #include <stdlib.h> | 7 #include <stdlib.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 NOTREACHED() << ssl_version; | 342 NOTREACHED() << ssl_version; |
343 *name = "???"; | 343 *name = "???"; |
344 break; | 344 break; |
345 } | 345 } |
346 } | 346 } |
347 | 347 |
348 bool ParseSSLCipherString(const std::string& cipher_string, | 348 bool ParseSSLCipherString(const std::string& cipher_string, |
349 uint16* cipher_suite) { | 349 uint16* cipher_suite) { |
350 int value = 0; | 350 int value = 0; |
351 if (cipher_string.size() == 6 && | 351 if (cipher_string.size() == 6 && |
352 base::StartsWithASCII(cipher_string, "0x", | 352 base::StartsWith(cipher_string, "0x", |
353 false /* case insensitive */) && | 353 base::CompareCase::INSENSITIVE_ASCII) && |
354 base::HexStringToInt(cipher_string, &value)) { | 354 base::HexStringToInt(cipher_string, &value)) { |
355 *cipher_suite = static_cast<uint16>(value); | 355 *cipher_suite = static_cast<uint16>(value); |
356 return true; | 356 return true; |
357 } | 357 } |
358 return false; | 358 return false; |
359 } | 359 } |
360 | 360 |
361 bool IsSecureTLSCipherSuite(uint16 cipher_suite) { | 361 bool IsSecureTLSCipherSuite(uint16 cipher_suite) { |
362 int key_exchange, cipher, mac; | 362 int key_exchange, cipher, mac; |
363 if (!GetCipherProperties(cipher_suite, &key_exchange, &cipher, &mac)) | 363 if (!GetCipherProperties(cipher_suite, &key_exchange, &cipher, &mac)) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 } | 413 } |
414 | 414 |
415 // Only AEADs allowed. | 415 // Only AEADs allowed. |
416 if (mac != kAEADMACValue) | 416 if (mac != kAEADMACValue) |
417 return false; | 417 return false; |
418 | 418 |
419 return true; | 419 return true; |
420 } | 420 } |
421 | 421 |
422 } // namespace net | 422 } // namespace net |
OLD | NEW |