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

Unified Diff: net/ssl/ssl_cipher_suite_names.cc

Issue 1313363003: Expose OpenSSL's key_exchange_info in the content API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fixups: Renumber enum, add tests Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
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 271ccdfd90f7d6ef6116e99a625556d5f9fe94fd..9a4d3e98ed0125d6829f627f38bea5ce0451261b 100644
--- a/net/ssl/ssl_cipher_suite_names.cc
+++ b/net/ssl/ssl_cipher_suite_names.cc
@@ -4,6 +4,9 @@
#include "net/ssl/ssl_cipher_suite_names.h"
+#if defined(USE_OPENSSL)
+#include <openssl/ssl.h>
+#endif
#include <stdlib.h>
#include "base/logging.h"
@@ -419,4 +422,21 @@ bool IsFalseStartableTLSCipherSuite(uint16 cipher_suite) {
return true;
}
+const char* ECCurveName(uint16 cipher_suite, int key_exchange_info) {
+ int key_exchange, cipher, mac;
+ if (!GetCipherProperties(cipher_suite, &key_exchange, &cipher, &mac))
Ryan Sleevi 2015/09/02 01:37:07 Why do this lookup for non-OpenSSL cases?
sigbjorn 2015/09/02 13:42:14 Done.
+ return NULL;
Ryan Sleevi 2015/09/02 01:37:07 nullptr throughout.
sigbjorn 2015/09/02 13:42:14 Done.
+ switch (key_exchange) {
+ case 14: // ECDHE_ECDSA
+ case 16: // ECDHE_RSA
Ryan Sleevi 2015/09/02 01:37:07 This seems very brittle; I guess it's contingent u
sigbjorn 2015/09/02 13:42:14 I don't know if the methods above are generated, t
+ break;
+ default:
+ return NULL;
+ }
+#if defined(USE_OPENSSL)
Ryan Sleevi 2015/09/02 01:37:07 newline between 435/436 for legibility.
sigbjorn 2015/09/02 13:42:14 Code changed.
+ return SSL_get_curve_name(key_exchange_info);
+#endif
+ return NULL;
+}
+
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698