diff --git a/netwerk/protocol/http/Http2Session.cpp b/netwerk/protocol/http/Http2Session.cpp index 644c1781c36f..57189763b921 100644 --- a/netwerk/protocol/http/Http2Session.cpp +++ b/netwerk/protocol/http/Http2Session.cpp @@ -2947,6 +2947,14 @@ Http2Session::ConfirmTLSProfile() RETURN_SESSION_ERROR(this, INADEQUATE_SECURITY); } + int16_t macAlgorithm = ssl->GetMACAlgorithmUsed(); + LOG3(("Http2Session::ConfirmTLSProfile %p MAC Algortihm (aead==6) %d\n", + this, macAlgorithm)); + if (macAlgorithm != nsISSLSocketControl::nsISSLSocketControl::SSL_MAC_AEAD) { + LOG3(("Http2Session::ConfirmTLSProfile %p FAILED due to lack of AEAD\n", this)); + RETURN_SESSION_ERROR(this, INADEQUATE_SECURITY); + } + /* We are required to send SNI. We do that already, so no check is done * here to make sure we did. */ diff --git a/netwerk/socket/nsISSLSocketControl.idl b/netwerk/socket/nsISSLSocketControl.idl index c6dd95514762..0703bbe4765f 100644 --- a/netwerk/socket/nsISSLSocketControl.idl +++ b/netwerk/socket/nsISSLSocketControl.idl @@ -14,7 +14,7 @@ class nsCString; %} [ref] native nsCStringTArrayRef(nsTArray); -[scriptable, builtinclass, uuid(ec72446c-8241-457f-ba75-83d214392289)] +[scriptable, builtinclass, uuid(2032ad83-229f-4ddb-818a-59b9ae4ecd4b)] interface nsISSLSocketControl : nsISupports { attribute nsIInterfaceRequestor notificationCallbacks; @@ -82,5 +82,17 @@ interface nsISSLSocketControl : nsISupports { const short SSL_VERSION_UNKNOWN = -1; [infallible] readonly attribute short SSLVersionUsed; + + /* These values match the NSS defined values in sslt.h */ + const short SSL_MAC_UNKNOWN = -1; + const short SSL_MAC_NULL = 0; + const short SSL_MAC_MD5 = 1; + const short SSL_MAC_SHA = 2; + const short SSL_HMAC_MD5 = 3; + const short SSL_HMAC_SHA = 4; + const short SSL_HMAC_SHA256 = 5; + const short SSL_MAC_AEAD = 6; + + [infallible] readonly attribute short MACAlgorithmUsed; }; diff --git a/security/manager/ssl/src/nsNSSCallbacks.cpp b/security/manager/ssl/src/nsNSSCallbacks.cpp index 2e4a9898242b..0fe3ea745e6a 100644 --- a/security/manager/ssl/src/nsNSSCallbacks.cpp +++ b/security/manager/ssl/src/nsNSSCallbacks.cpp @@ -898,6 +898,7 @@ PreliminaryHandshakeDone(PRFileDesc* fd) status->mCipherName.Assign(cipherInfo.cipherSuiteName); infoObject->SetKEAUsed(cipherInfo.keaType); infoObject->SetKEAKeyBits(channelInfo.keaKeyBits); + infoObject->SetMACAlgorithmUsed(cipherInfo.macAlgorithm); } } diff --git a/security/manager/ssl/src/nsNSSIOLayer.cpp b/security/manager/ssl/src/nsNSSIOLayer.cpp index e193e217ee14..3be405f47f40 100644 --- a/security/manager/ssl/src/nsNSSIOLayer.cpp +++ b/security/manager/ssl/src/nsNSSIOLayer.cpp @@ -137,6 +137,7 @@ nsNSSSocketInfo::nsNSSSocketInfo(SharedSSLState& aState, uint32_t providerFlags) mKEAExpected(nsISSLSocketControl::KEY_EXCHANGE_UNKNOWN), mKEAKeyBits(0), mSSLVersionUsed(nsISSLSocketControl::SSL_VERSION_UNKNOWN), + mMACAlgorithmUsed(nsISSLSocketControl::SSL_MAC_UNKNOWN), mProviderFlags(providerFlags), mSocketCreationTimestamp(TimeStamp::Now()), mPlaintextBytesRead(0) @@ -195,6 +196,13 @@ nsNSSSocketInfo::GetSSLVersionUsed(int16_t* aSSLVersionUsed) return NS_OK; } +NS_IMETHODIMP +nsNSSSocketInfo::GetMACAlgorithmUsed(int16_t* aMac) +{ + *aMac = mMACAlgorithmUsed; + return NS_OK; +} + NS_IMETHODIMP nsNSSSocketInfo::GetRememberClientAuthCertificate(bool* aRemember) { diff --git a/security/manager/ssl/src/nsNSSIOLayer.h b/security/manager/ssl/src/nsNSSIOLayer.h index 050a5ac81ef0..6c5661e16498 100644 --- a/security/manager/ssl/src/nsNSSIOLayer.h +++ b/security/manager/ssl/src/nsNSSIOLayer.h @@ -111,6 +111,8 @@ public: mSSLVersionUsed = version; } + void SetMACAlgorithmUsed(int16_t mac) { mMACAlgorithmUsed = mac; } + protected: virtual ~nsNSSSocketInfo(); @@ -144,6 +146,7 @@ private: int16_t mKEAExpected; uint32_t mKEAKeyBits; int16_t mSSLVersionUsed; + int16_t mMACAlgorithmUsed; uint32_t mProviderFlags; mozilla::TimeStamp mSocketCreationTimestamp;