mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-23 00:47:31 +09:00
Replace NSS with Pale Moon's
This commit is contained in:
parent
ff1e5e48bf
commit
8c2e376f94
2870 changed files with 1762232 additions and 1374220 deletions
|
|
@ -1,4 +1,5 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
|
@ -618,55 +619,6 @@ TEST_P(TlsDropDatagram13, ReorderServerEE) {
|
|||
|
||||
// The client sends an out of order non-handshake message
|
||||
// but with the handshake key.
|
||||
class TlsSendCipherSpecCapturer {
|
||||
public:
|
||||
TlsSendCipherSpecCapturer(const std::shared_ptr<TlsAgent>& agent)
|
||||
: agent_(agent), send_cipher_specs_() {
|
||||
EXPECT_EQ(SECSuccess,
|
||||
SSL_SecretCallback(agent_->ssl_fd(), SecretCallback, this));
|
||||
}
|
||||
|
||||
std::shared_ptr<TlsCipherSpec> spec(size_t i) {
|
||||
if (i >= send_cipher_specs_.size()) {
|
||||
return nullptr;
|
||||
}
|
||||
return send_cipher_specs_[i];
|
||||
}
|
||||
|
||||
private:
|
||||
static void SecretCallback(PRFileDesc* fd, PRUint16 epoch,
|
||||
SSLSecretDirection dir, PK11SymKey* secret,
|
||||
void* arg) {
|
||||
auto self = static_cast<TlsSendCipherSpecCapturer*>(arg);
|
||||
std::cerr << self->agent_->role_str() << ": capture " << dir
|
||||
<< " secret for epoch " << epoch << std::endl;
|
||||
|
||||
if (dir == ssl_secret_read) {
|
||||
return;
|
||||
}
|
||||
|
||||
SSLPreliminaryChannelInfo preinfo;
|
||||
EXPECT_EQ(SECSuccess,
|
||||
SSL_GetPreliminaryChannelInfo(self->agent_->ssl_fd(), &preinfo,
|
||||
sizeof(preinfo)));
|
||||
EXPECT_EQ(sizeof(preinfo), preinfo.length);
|
||||
EXPECT_TRUE(preinfo.valuesSet & ssl_preinfo_cipher_suite);
|
||||
|
||||
SSLCipherSuiteInfo cipherinfo;
|
||||
EXPECT_EQ(SECSuccess,
|
||||
SSL_GetCipherSuiteInfo(preinfo.cipherSuite, &cipherinfo,
|
||||
sizeof(cipherinfo)));
|
||||
EXPECT_EQ(sizeof(cipherinfo), cipherinfo.length);
|
||||
|
||||
auto spec = std::make_shared<TlsCipherSpec>(true, epoch);
|
||||
EXPECT_TRUE(spec->SetKeys(&cipherinfo, secret));
|
||||
self->send_cipher_specs_.push_back(spec);
|
||||
}
|
||||
|
||||
std::shared_ptr<TlsAgent> agent_;
|
||||
std::vector<std::shared_ptr<TlsCipherSpec>> send_cipher_specs_;
|
||||
};
|
||||
|
||||
TEST_F(TlsConnectDatagram13, SendOutOfOrderAppWithHandshakeKey) {
|
||||
StartConnect();
|
||||
// Capturing secrets means that we can't use decrypting filters on the client.
|
||||
|
|
@ -683,8 +635,10 @@ TEST_F(TlsConnectDatagram13, SendOutOfOrderAppWithHandshakeKey) {
|
|||
auto spec = capturer.spec(0);
|
||||
ASSERT_NE(nullptr, spec.get());
|
||||
ASSERT_EQ(2, spec->epoch());
|
||||
ASSERT_TRUE(client_->SendEncryptedRecord(spec, 0x0002000000000002,
|
||||
ssl_ct_application_data,
|
||||
|
||||
uint8_t dtls13_ct = kCtDtlsCiphertext | kCtDtlsCiphertext16bSeqno |
|
||||
kCtDtlsCiphertextLengthPresent;
|
||||
ASSERT_TRUE(client_->SendEncryptedRecord(spec, 0x0002000000000002, dtls13_ct,
|
||||
DataBuffer(buf, sizeof(buf))));
|
||||
|
||||
// Now have the server consume the bogus message.
|
||||
|
|
@ -843,7 +797,7 @@ static void GetCipherAndLimit(uint16_t version, uint16_t* cipher,
|
|||
// a reasonable amount of time.
|
||||
*cipher = TLS_CHACHA20_POLY1305_SHA256;
|
||||
// Assume that we are starting with an expected sequence number of 0.
|
||||
*limit = (1ULL << 29) - 1;
|
||||
*limit = (1ULL << 15) - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -865,14 +819,14 @@ TEST_P(TlsConnectDatagram, MissLotsOfPackets) {
|
|||
SendReceive();
|
||||
}
|
||||
|
||||
// Send a sequence number of 0xfffffffd and it should be interpreted as that
|
||||
// Send a sequence number of 0xfffd and it should be interpreted as that
|
||||
// (and not -3 or UINT64_MAX - 2).
|
||||
TEST_F(TlsConnectDatagram13, UnderflowSequenceNumber) {
|
||||
Connect();
|
||||
// This is only valid if short headers are disabled.
|
||||
client_->SetOption(SSL_ENABLE_DTLS_SHORT_HEADER, PR_FALSE);
|
||||
EXPECT_EQ(SECSuccess,
|
||||
SSLInt_AdvanceWriteSeqNum(client_->ssl_fd(), (1ULL << 30) - 3));
|
||||
SSLInt_AdvanceWriteSeqNum(client_->ssl_fd(), (1ULL << 16) - 3));
|
||||
SendReceive();
|
||||
}
|
||||
|
||||
|
|
@ -917,9 +871,13 @@ class TlsReplaceFirstRecordWithJunk : public TlsRecordFilter {
|
|||
return KEEP;
|
||||
}
|
||||
replaced_ = true;
|
||||
TlsRecordHeader out_header(header.variant(), header.version(),
|
||||
ssl_ct_application_data,
|
||||
header.sequence_number());
|
||||
|
||||
uint8_t dtls13_ct = kCtDtlsCiphertext | kCtDtlsCiphertext16bSeqno |
|
||||
kCtDtlsCiphertextLengthPresent;
|
||||
TlsRecordHeader out_header(
|
||||
header.variant(), header.version(),
|
||||
is_dtls13() ? dtls13_ct : ssl_ct_application_data,
|
||||
header.sequence_number());
|
||||
|
||||
static const uint8_t junk[] = {1, 2, 3, 4};
|
||||
*offset = out_header.Write(output, *offset, DataBuffer(junk, sizeof(junk)));
|
||||
|
|
@ -942,15 +900,15 @@ TEST_P(TlsConnectDatagram, ReplaceFirstClientRecordWithApplicationData) {
|
|||
Connect();
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_CASE_P(Datagram12Plus, TlsConnectDatagram12Plus,
|
||||
TlsConnectTestBase::kTlsV12Plus);
|
||||
INSTANTIATE_TEST_CASE_P(DatagramPre13, TlsConnectDatagramPre13,
|
||||
TlsConnectTestBase::kTlsV11V12);
|
||||
INSTANTIATE_TEST_CASE_P(DatagramDrop13, TlsDropDatagram13,
|
||||
::testing::Values(true, false));
|
||||
INSTANTIATE_TEST_CASE_P(DatagramReorder13, TlsReorderDatagram13,
|
||||
::testing::Values(true, false));
|
||||
INSTANTIATE_TEST_CASE_P(DatagramFragment13, TlsFragmentationAndRecoveryTest,
|
||||
::testing::Values(true, false));
|
||||
INSTANTIATE_TEST_SUITE_P(Datagram12Plus, TlsConnectDatagram12Plus,
|
||||
TlsConnectTestBase::kTlsV12Plus);
|
||||
INSTANTIATE_TEST_SUITE_P(DatagramPre13, TlsConnectDatagramPre13,
|
||||
TlsConnectTestBase::kTlsV11V12);
|
||||
INSTANTIATE_TEST_SUITE_P(DatagramDrop13, TlsDropDatagram13,
|
||||
::testing::Values(true, false));
|
||||
INSTANTIATE_TEST_SUITE_P(DatagramReorder13, TlsReorderDatagram13,
|
||||
::testing::Values(true, false));
|
||||
INSTANTIATE_TEST_SUITE_P(DatagramFragment13, TlsFragmentationAndRecoveryTest,
|
||||
::testing::Values(true, false));
|
||||
|
||||
} // namespace nss_test
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue