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

Unified Diff: net/ssl/ssl_connection_status_flags.h

Issue 291093002: Fail the SPDY transaction if it does not meet TLS base requirements. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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_connection_status_flags.h
diff --git a/net/ssl/ssl_connection_status_flags.h b/net/ssl/ssl_connection_status_flags.h
index 05757558ed8e9b2acdd8c686359e30cbff8201b0..a01056a6cbcf84160bb65503201c5b9d1fd26ef5 100644
--- a/net/ssl/ssl_connection_status_flags.h
+++ b/net/ssl/ssl_connection_status_flags.h
@@ -5,6 +5,9 @@
#ifndef NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_
#define NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_
+#include "base/logging.h"
+#include "base/macros.h"
+
namespace net {
// Status flags for SSLInfo::connection_status.
@@ -60,6 +63,32 @@ inline int SSLConnectionStatusToVersion(int connection_status) {
SSL_CONNECTION_VERSION_MASK;
}
+inline void SSLConnectionStatusSetCipherSuite(int cipher_suite,
+ int* connection_status) {
+ int tmp = *connection_status;
+ // Clear out the old ciphersuite.
+ tmp &= ~(SSL_CONNECTION_CIPHERSUITE_MASK << SSL_CONNECTION_CIPHERSUITE_SHIFT);
+ // Set the new ciphersuite.
+ tmp |= ((cipher_suite & SSL_CONNECTION_CIPHERSUITE_MASK)
+ << SSL_CONNECTION_CIPHERSUITE_SHIFT);
+
+ *connection_status = tmp;
+}
+
+inline void SSLConnectionStatusSetVersion(int version, int* connection_status) {
+ DCHECK_GT(version, 0);
agl 2014/05/20 02:45:13 The minimum should be SSLv3 (and then be >=).
+ DCHECK_LT(version, SSL_CONNECTION_VERSION_MAX);
+
+ int tmp = *connection_status;
+ // Clear out the old version.
+ tmp &= ~(SSL_CONNECTION_VERSION_MASK << SSL_CONNECTION_VERSION_SHIFT);
+ // Set the new version.
+ tmp |=
+ ((version & SSL_CONNECTION_VERSION_MASK) << SSL_CONNECTION_VERSION_SHIFT);
+
+ *connection_status = tmp;
+}
+
} // namespace net
#endif // NET_SSL_SSL_CONNECTION_STATUS_FLAGS_H_

Powered by Google App Engine
This is Rietveld 408576698