mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 02:47:31 +09:00
import NSS tip revs: bug1594965, bug1593167, bug1603027, bug1600144, bug1590001, bug1603257, bug1605545, bug1513586
This commit is contained in:
parent
5ff81ed6e6
commit
9778f15c7d
10 changed files with 285 additions and 41 deletions
|
|
@ -261,13 +261,16 @@ TEST_F(Pkcs11ChaCha20Poly1305Test, GenerateXor) {
|
|||
ScopedPK11SymKey key(PK11_KeyGen(slot.get(), kMech, nullptr, 32, nullptr));
|
||||
EXPECT_TRUE(!!key);
|
||||
|
||||
SECItem ctrNonceItem = {siBuffer, toUcharPtr(kCtrNonce),
|
||||
static_cast<unsigned int>(sizeof(kCtrNonce))};
|
||||
std::vector<uint8_t> iv(16);
|
||||
SECStatus rv = PK11_GenerateRandomOnSlot(slot.get(), iv.data(), iv.size());
|
||||
EXPECT_EQ(SECSuccess, rv);
|
||||
|
||||
SECItem ctrNonceItem = {siBuffer, toUcharPtr(iv.data()),
|
||||
static_cast<unsigned int>(iv.size())};
|
||||
uint8_t encrypted[sizeof(kData)];
|
||||
unsigned int encrypted_len = 88; // This should be overwritten.
|
||||
SECStatus rv =
|
||||
PK11_Encrypt(key.get(), kMechXor, &ctrNonceItem, encrypted,
|
||||
&encrypted_len, sizeof(encrypted), kData, sizeof(kData));
|
||||
rv = PK11_Encrypt(key.get(), kMechXor, &ctrNonceItem, encrypted,
|
||||
&encrypted_len, sizeof(encrypted), kData, sizeof(kData));
|
||||
ASSERT_EQ(SECSuccess, rv);
|
||||
ASSERT_EQ(sizeof(kData), static_cast<size_t>(encrypted_len));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue