Index: net/ssl/ssl_cipher_suite_names.cc |
diff --git a/net/ssl/ssl_cipher_suite_names.cc b/net/ssl/ssl_cipher_suite_names.cc |
index 320c22e1f3c02ce0d5a85e4f42cc7a5d15d331b6..3e3e46faf4eea9695fb44e873642885951f8f423 100644 |
--- a/net/ssl/ssl_cipher_suite_names.cc |
+++ b/net/ssl/ssl_cipher_suite_names.cc |
@@ -9,6 +9,7 @@ |
#include "base/logging.h" |
#include "base/strings/string_number_conversions.h" |
#include "base/strings/string_util.h" |
+#include "base/strings/stringprintf.h" |
#include "net/ssl/ssl_connection_status_flags.h" |
#include "third_party/boringssl/src/include/openssl/ssl.h" |
@@ -384,6 +385,47 @@ void SSLCipherSuiteToStrings(const char** key_exchange_str, |
} |
} |
+std::string SSLCipherSuiteToComposedString(uint16_t cipher_suite) { |
+ int key_exchange, cipher, mac; |
+ if (!GetCipherProperties(cipher_suite, &key_exchange, &cipher, &mac)) |
+ return "UNKNOWN"; |
+ |
+ const char* prf; |
+ switch (mac) { |
+ case 1: |
+ prf = "MD5"; |
+ break; |
+ case 2: |
+ prf = "SHA"; |
+ break; |
+ case 3: |
+ prf = "SHA256"; |
+ break; |
+ case 4: |
+ prf = "SHA384"; |
+ break; |
+ case 7: // kAEADMACValue |
+ if (cipher == 14 || cipher == 9) { // AES_256_GCM or AES_256_CBC |
+ prf = "SHA384"; |
+ break; |
+ } |
+ prf = "SHA256"; |
+ break; |
+ default: |
+ NOTREACHED() << mac; |
+ prf = "???"; |
+ break; |
+ } |
+ |
+ std::string composed = "TLS"; |
+ if (key_exchange != kTLS13KeyExchangeValue) |
+ composed += |
+ base::StringPrintf("_%s_WITH", kKeyExchangeNames[key_exchange].name); |
+ composed += base::StringPrintf("_%s_%s", kCipherNames[cipher].name, prf); |
+ |
+ return composed; |
+} |
davidben
2016/12/07 15:31:45
I haven't looked at the rest yet, but the whole po
|
+ |
void SSLVersionToString(const char** name, int ssl_version) { |
switch (ssl_version) { |
case SSL_CONNECTION_VERSION_SSL2: |