mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-22 08:27:31 +09:00
imported changes from mozilla NSS:
- Bug 1755555 - Hold tokensLock through nssToken_GetSlot calls in nssTrustDomain_GetActiveSlots. r=rrelyea (a36477f0) - Bug 1370866 - Check return value of PK11Slot_GetNSSToken. r=djackson (d7e8c2df) - Bug 1751157 - Throw illegal_parameter alert for illegal extensions in handshake message. r=djackson (8fd5ca0c)
This commit is contained in:
parent
e350f0c040
commit
c403014cbe
14 changed files with 282 additions and 106 deletions
|
|
@ -730,7 +730,7 @@ TEST_F(TlsExtensionTest13Stream, AddServerSignatureAlgorithmsOnResumption) {
|
|||
DataBuffer empty;
|
||||
MakeTlsFilter<TlsExtensionInjector>(server_, ssl_signature_algorithms_xtn,
|
||||
empty);
|
||||
client_->ExpectSendAlert(kTlsAlertUnsupportedExtension);
|
||||
client_->ExpectSendAlert(kTlsAlertIllegalParameter);
|
||||
server_->ExpectSendAlert(kTlsAlertUnexpectedMessage);
|
||||
ConnectExpectFail();
|
||||
EXPECT_EQ(SSL_ERROR_EXTENSION_DISALLOWED_FOR_VERSION, client_->error_code());
|
||||
|
|
@ -1178,19 +1178,6 @@ TEST_P(TlsBogusExtensionTest13, AddBogusExtensionHelloRetryRequest) {
|
|||
Run(kTlsHandshakeHelloRetryRequest);
|
||||
}
|
||||
|
||||
TEST_P(TlsBogusExtensionTest13, AddVersionExtensionEncryptedExtensions) {
|
||||
Run(kTlsHandshakeEncryptedExtensions, ssl_tls13_supported_versions_xtn);
|
||||
}
|
||||
|
||||
TEST_P(TlsBogusExtensionTest13, AddVersionExtensionCertificate) {
|
||||
Run(kTlsHandshakeCertificate, ssl_tls13_supported_versions_xtn);
|
||||
}
|
||||
|
||||
TEST_P(TlsBogusExtensionTest13, AddVersionExtensionCertificateRequest) {
|
||||
server_->RequestClientAuth(false);
|
||||
Run(kTlsHandshakeCertificateRequest, ssl_tls13_supported_versions_xtn);
|
||||
}
|
||||
|
||||
// NewSessionTicket allows unknown extensions AND it isn't protected by the
|
||||
// Finished. So adding an unknown extension doesn't cause an error.
|
||||
TEST_P(TlsBogusExtensionTest13, AddBogusExtensionNewSessionTicket) {
|
||||
|
|
@ -1208,6 +1195,55 @@ TEST_P(TlsBogusExtensionTest13, AddBogusExtensionNewSessionTicket) {
|
|||
SendReceive();
|
||||
}
|
||||
|
||||
class TlsDisallowedExtensionTest13 : public TlsBogusExtensionTest {
|
||||
protected:
|
||||
void ConnectAndFail(uint8_t message) override {
|
||||
ConnectExpectAlert(client_, kTlsAlertIllegalParameter);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(TlsDisallowedExtensionTest13, AddVersionExtensionEncryptedExtensions) {
|
||||
Run(kTlsHandshakeEncryptedExtensions, ssl_tls13_supported_versions_xtn);
|
||||
}
|
||||
|
||||
TEST_P(TlsDisallowedExtensionTest13, AddVersionExtensionCertificate) {
|
||||
Run(kTlsHandshakeCertificate, ssl_tls13_supported_versions_xtn);
|
||||
}
|
||||
|
||||
TEST_P(TlsDisallowedExtensionTest13, AddVersionExtensionCertificateRequest) {
|
||||
server_->RequestClientAuth(false);
|
||||
Run(kTlsHandshakeCertificateRequest, ssl_tls13_supported_versions_xtn);
|
||||
}
|
||||
|
||||
/* For unadvertised disallowed extensions an unsupported_extension alert is
|
||||
* thrown since NSS checks for unadvertised extensions before its disallowed
|
||||
* extension check. */
|
||||
class TlsDisallowedUnadvertisedExtensionTest13 : public TlsBogusExtensionTest {
|
||||
protected:
|
||||
void ConnectAndFail(uint8_t message) override {
|
||||
uint8_t alert = kTlsAlertUnsupportedExtension;
|
||||
if (message == kTlsHandshakeCertificateRequest) {
|
||||
alert = kTlsAlertIllegalParameter;
|
||||
}
|
||||
ConnectExpectAlert(client_, alert);
|
||||
}
|
||||
};
|
||||
|
||||
TEST_P(TlsDisallowedUnadvertisedExtensionTest13,
|
||||
AddPSKExtensionEncryptedExtensions) {
|
||||
Run(kTlsHandshakeEncryptedExtensions, ssl_tls13_pre_shared_key_xtn);
|
||||
}
|
||||
|
||||
TEST_P(TlsDisallowedUnadvertisedExtensionTest13, AddPSKExtensionCertificate) {
|
||||
Run(kTlsHandshakeCertificate, ssl_tls13_pre_shared_key_xtn);
|
||||
}
|
||||
|
||||
TEST_P(TlsDisallowedUnadvertisedExtensionTest13,
|
||||
AddPSKExtensionCertificateRequest) {
|
||||
server_->RequestClientAuth(false);
|
||||
Run(kTlsHandshakeCertificateRequest, ssl_tls13_pre_shared_key_xtn);
|
||||
}
|
||||
|
||||
TEST_P(TlsConnectStream, IncludePadding) {
|
||||
EnsureTlsSetup();
|
||||
|
||||
|
|
@ -1269,4 +1305,13 @@ INSTANTIATE_TEST_CASE_P(BogusExtension13, TlsBogusExtensionTest13,
|
|||
::testing::Combine(TlsConnectTestBase::kTlsVariantsAll,
|
||||
TlsConnectTestBase::kTlsV13));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(DisallowedExtension13, TlsDisallowedExtensionTest13,
|
||||
::testing::Combine(TlsConnectTestBase::kTlsVariantsAll,
|
||||
TlsConnectTestBase::kTlsV13));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(DisallowedUnadvertisedExtension13,
|
||||
TlsDisallowedUnadvertisedExtensionTest13,
|
||||
::testing::Combine(TlsConnectTestBase::kTlsVariantsAll,
|
||||
TlsConnectTestBase::kTlsV13));
|
||||
|
||||
} // namespace nss_test
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue