diff options
author | Anna Weine <anna.weine@mozilla.com> | 2022-10-07 11:25:24 +0000 |
---|---|---|
committer | Anna Weine <anna.weine@mozilla.com> | 2022-10-07 11:25:24 +0000 |
commit | 811625e10804cb6a36b5e643b9bb9c1fcb0a8398 (patch) | |
tree | 7c8d5fad269f9436132b6880b69abd467b926069 /gtests/pk11_gtest | |
parent | c14535f9c17c47e1ca55af69c0214289af57a684 (diff) | |
download | nss-hg-811625e10804cb6a36b5e643b9bb9c1fcb0a8398.tar.gz |
Bug 1792821 - Updating the clang-format version to 10. r=jschanck
Differential Revision: https://phabricator.services.mozilla.com/D158323
Diffstat (limited to 'gtests/pk11_gtest')
-rw-r--r-- | gtests/pk11_gtest/pk11_aeskeywrap_unittest.cc | 2 | ||||
-rw-r--r-- | gtests/pk11_gtest/pk11_aeskeywrapkwp_unittest.cc | 2 | ||||
-rw-r--r-- | gtests/pk11_gtest/pk11_cipherop_unittest.cc | 20 | ||||
-rw-r--r-- | gtests/pk11_gtest/pk11_der_private_key_import_unittest.cc | 7 | ||||
-rw-r--r-- | gtests/pk11_gtest/pk11_encrypt_derive_unittest.cc | 15 | ||||
-rw-r--r-- | gtests/pk11_gtest/pk11_find_certs_unittest.cc | 12 | ||||
-rw-r--r-- | gtests/pk11_gtest/pk11_hpke_unittest.cc | 13 | ||||
-rw-r--r-- | gtests/pk11_gtest/pk11_kbkdf.cc | 2 | ||||
-rw-r--r-- | gtests/pk11_gtest/pk11_keygen.cc | 4 | ||||
-rw-r--r-- | gtests/pk11_gtest/pk11_module_unittest.cc | 12 |
10 files changed, 47 insertions, 42 deletions
diff --git a/gtests/pk11_gtest/pk11_aeskeywrap_unittest.cc b/gtests/pk11_gtest/pk11_aeskeywrap_unittest.cc index ebd762ca6..710938cf4 100644 --- a/gtests/pk11_gtest/pk11_aeskeywrap_unittest.cc +++ b/gtests/pk11_gtest/pk11_aeskeywrap_unittest.cc @@ -119,4 +119,4 @@ TEST_P(Pkcs11AESKeyWrapTest, TestVectors) { WrapUnwrap(GetParam()); } INSTANTIATE_TEST_SUITE_P(Pkcs11WycheproofAESKWTest, Pkcs11AESKeyWrapTest, ::testing::ValuesIn(kWycheproofAesKWVectors)); -} /* nss_test */ +} // namespace nss_test diff --git a/gtests/pk11_gtest/pk11_aeskeywrapkwp_unittest.cc b/gtests/pk11_gtest/pk11_aeskeywrapkwp_unittest.cc index c7e27a75c..232424701 100644 --- a/gtests/pk11_gtest/pk11_aeskeywrapkwp_unittest.cc +++ b/gtests/pk11_gtest/pk11_aeskeywrapkwp_unittest.cc @@ -120,4 +120,4 @@ TEST_P(Pkcs11AESKeyWrapKwpTest, TestVectors) { WrapUnwrap(GetParam()); } INSTANTIATE_TEST_SUITE_P(Pkcs11NistAESKWPTest, Pkcs11AESKeyWrapKwpTest, ::testing::ValuesIn(kNistAesKWPVectors)); -} /* nss_test */ +} // namespace nss_test diff --git a/gtests/pk11_gtest/pk11_cipherop_unittest.cc b/gtests/pk11_gtest/pk11_cipherop_unittest.cc index b43583377..b57c5af69 100644 --- a/gtests/pk11_gtest/pk11_cipherop_unittest.cc +++ b/gtests/pk11_gtest/pk11_cipherop_unittest.cc @@ -36,10 +36,10 @@ static SECStatus GetBytes(const ScopedPK11Context& ctx, size_t len) { } TEST(Pkcs11CipherOp, SingleCtxMultipleUnalignedCipherOps) { - ScopedNSSInitContext globalctx(NSS_InitContext( - "", "", "", "", NULL, NSS_INIT_READONLY | NSS_INIT_NOCERTDB | - NSS_INIT_NOMODDB | NSS_INIT_FORCEOPEN | - NSS_INIT_NOROOTINIT)); + ScopedNSSInitContext globalctx( + NSS_InitContext("", "", "", "", NULL, + NSS_INIT_READONLY | NSS_INIT_NOCERTDB | NSS_INIT_NOMODDB | + NSS_INIT_FORCEOPEN | NSS_INIT_NOROOTINIT)); ASSERT_TRUE(globalctx); const CK_MECHANISM_TYPE cipher = CKM_AES_CTR; @@ -76,10 +76,10 @@ TEST(Pkcs11CipherOp, SingleCtxMultipleUnalignedCipherOps) { // PK11_CipherOp operation is calling the C_EncryptUpdate function for // which multi-part is disabled for ChaCha20 in counter mode. void ChachaMulti(CK_MECHANISM_TYPE cipher, SECItem* param) { - ScopedNSSInitContext globalctx(NSS_InitContext( - "", "", "", "", NULL, NSS_INIT_READONLY | NSS_INIT_NOCERTDB | - NSS_INIT_NOMODDB | NSS_INIT_FORCEOPEN | - NSS_INIT_NOROOTINIT)); + ScopedNSSInitContext globalctx( + NSS_InitContext("", "", "", "", NULL, + NSS_INIT_READONLY | NSS_INIT_NOCERTDB | NSS_INIT_NOMODDB | + NSS_INIT_FORCEOPEN | NSS_INIT_NOROOTINIT)); ASSERT_TRUE(globalctx); ScopedPK11SlotInfo slot(PK11_GetInternalSlot()); @@ -119,9 +119,7 @@ TEST(Pkcs11CipherOp, ChachaMulti) { for (size_t i = 0; i < 16; i++) { iv_bytes[i] = i; } - CK_CHACHA20_PARAMS chacha_params = { - iv_bytes, 32, iv_bytes + 4, 96, - }; + CK_CHACHA20_PARAMS chacha_params = {iv_bytes, 32, iv_bytes + 4, 96}; SECItem param_item = {siBuffer, reinterpret_cast<uint8_t*>(&chacha_params), sizeof(chacha_params)}; diff --git a/gtests/pk11_gtest/pk11_der_private_key_import_unittest.cc b/gtests/pk11_gtest/pk11_der_private_key_import_unittest.cc index 449e7728b..c052e2882 100644 --- a/gtests/pk11_gtest/pk11_der_private_key_import_unittest.cc +++ b/gtests/pk11_gtest/pk11_der_private_key_import_unittest.cc @@ -95,9 +95,10 @@ class DERPrivateKeyImportTest : public ::testing::Test { std::to_string(rand()); SECItem item = {siBuffer, const_cast<unsigned char*>(data.data()), static_cast<unsigned int>(data.size())}; - SECItem nick = {siBuffer, reinterpret_cast<unsigned char*>( - const_cast<char*>(nick_str.data())), - static_cast<unsigned int>(nick_str.length())}; + SECItem nick = { + siBuffer, + reinterpret_cast<unsigned char*>(const_cast<char*>(nick_str.data())), + static_cast<unsigned int>(nick_str.length())}; ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot()); EXPECT_TRUE(slot); diff --git a/gtests/pk11_gtest/pk11_encrypt_derive_unittest.cc b/gtests/pk11_gtest/pk11_encrypt_derive_unittest.cc index c3cb75d48..1e957c9a5 100644 --- a/gtests/pk11_gtest/pk11_encrypt_derive_unittest.cc +++ b/gtests/pk11_gtest/pk11_encrypt_derive_unittest.cc @@ -195,12 +195,17 @@ class EncryptDeriveTest TEST_P(EncryptDeriveTest, Test) { TestEncryptDerive(); } -static const CK_MECHANISM_TYPE kEncryptDeriveMechanisms[] = { - CKM_DES3_ECB, CKM_DES3_CBC, CKM_AES_ECB, CKM_AES_ECB, CKM_AES_CBC, - CKM_CAMELLIA_ECB, CKM_CAMELLIA_CBC +static const CK_MECHANISM_TYPE kEncryptDeriveMechanisms[] = {CKM_DES3_ECB, + CKM_DES3_CBC, + CKM_AES_ECB, + CKM_AES_ECB, + CKM_AES_CBC, + CKM_CAMELLIA_ECB, + CKM_CAMELLIA_CBC #ifndef NSS_DISABLE_DEPRECATED_SEED - , - CKM_SEED_ECB, CKM_SEED_CBC + , + CKM_SEED_ECB, + CKM_SEED_CBC #endif }; diff --git a/gtests/pk11_gtest/pk11_find_certs_unittest.cc b/gtests/pk11_gtest/pk11_find_certs_unittest.cc index 9f6baf178..b5e1474b0 100644 --- a/gtests/pk11_gtest/pk11_find_certs_unittest.cc +++ b/gtests/pk11_gtest/pk11_find_certs_unittest.cc @@ -438,7 +438,8 @@ const std::vector<uint8_t> kTestCertWithOtherKeyDER = { // If there are no certs at all, we'll get back a null list. TEST_F(PK11GetCertsMatchingPrivateKeyTest, TestNoCertsAtAll) { SECItem private_key_info = { - siBuffer, const_cast<unsigned char*>(kTestPrivateKeyInfoDER.data()), + siBuffer, + const_cast<unsigned char*>(kTestPrivateKeyInfoDER.data()), (unsigned int)kTestPrivateKeyInfoDER.size(), }; SECKEYPrivateKey* priv_key = nullptr; @@ -455,7 +456,8 @@ TEST_F(PK11GetCertsMatchingPrivateKeyTest, TestNoCertsAtAll) { // If there are no certs for the private key, we'll get back a null list. TEST_F(PK11GetCertsMatchingPrivateKeyTest, TestNoCertsForKey) { SECItem private_key_info = { - siBuffer, const_cast<unsigned char*>(kTestPrivateKeyInfoDER.data()), + siBuffer, + const_cast<unsigned char*>(kTestPrivateKeyInfoDER.data()), (unsigned int)kTestPrivateKeyInfoDER.size(), }; SECKEYPrivateKey* priv_key = nullptr; @@ -502,7 +504,8 @@ void CheckCertListForSubjects( // We should only get back certs that actually match the private key. TEST_F(PK11GetCertsMatchingPrivateKeyTest, TestOneCertForKey) { SECItem private_key_info = { - siBuffer, const_cast<unsigned char*>(kTestPrivateKeyInfoDER.data()), + siBuffer, + const_cast<unsigned char*>(kTestPrivateKeyInfoDER.data()), (unsigned int)kTestPrivateKeyInfoDER.size(), }; SECKEYPrivateKey* priv_key = nullptr; @@ -536,7 +539,8 @@ TEST_F(PK11GetCertsMatchingPrivateKeyTest, TestOneCertForKey) { // We should be able to get back all certs that match the private key. TEST_F(PK11GetCertsMatchingPrivateKeyTest, TestTwoCertsForKey) { SECItem private_key_info = { - siBuffer, const_cast<unsigned char*>(kTestPrivateKeyInfoDER.data()), + siBuffer, + const_cast<unsigned char*>(kTestPrivateKeyInfoDER.data()), (unsigned int)kTestPrivateKeyInfoDER.size(), }; SECKEYPrivateKey* priv_key = nullptr; diff --git a/gtests/pk11_gtest/pk11_hpke_unittest.cc b/gtests/pk11_gtest/pk11_hpke_unittest.cc index 0ed81f899..aaddfddc8 100644 --- a/gtests/pk11_gtest/pk11_hpke_unittest.cc +++ b/gtests/pk11_gtest/pk11_hpke_unittest.cc @@ -310,15 +310,12 @@ struct HpkeVector { const std::vector<uint8_t> &pk) { // Only X25519 format. std::vector<uint8_t> v(105); - v.assign({ - 0x30, 0x67, 0x02, 0x01, 0x00, 0x30, 0x14, 0x06, 0x07, 0x2a, 0x86, 0x48, - 0xce, 0x3d, 0x02, 0x01, 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, - 0x47, 0x0f, 0x01, 0x04, 0x4c, 0x30, 0x4a, 0x02, 0x01, 0x01, 0x04, 0x20, - }); + v.assign({0x30, 0x67, 0x02, 0x01, 0x00, 0x30, 0x14, 0x06, 0x07, + 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 0x01, 0x06, 0x09, + 0x2b, 0x06, 0x01, 0x04, 0x01, 0xda, 0x47, 0x0f, 0x01, + 0x04, 0x4c, 0x30, 0x4a, 0x02, 0x01, 0x01, 0x04, 0x20}); v.insert(v.end(), sk.begin(), sk.end()); - v.insert(v.end(), { - 0xa1, 0x23, 0x03, 0x21, 0x00, - }); + v.insert(v.end(), {0xa1, 0x23, 0x03, 0x21, 0x00}); v.insert(v.end(), pk.begin(), pk.end()); return v; } diff --git a/gtests/pk11_gtest/pk11_kbkdf.cc b/gtests/pk11_gtest/pk11_kbkdf.cc index d8a0a0f58..3800dcdd8 100644 --- a/gtests/pk11_gtest/pk11_kbkdf.cc +++ b/gtests/pk11_gtest/pk11_kbkdf.cc @@ -133,4 +133,4 @@ TEST_F(Pkcs11KbkdfTest, TestAdditionalKey) { } // Close the namespace -} +} // namespace nss_test diff --git a/gtests/pk11_gtest/pk11_keygen.cc b/gtests/pk11_gtest/pk11_keygen.cc index 5b4de29de..e5449f80b 100644 --- a/gtests/pk11_gtest/pk11_keygen.cc +++ b/gtests/pk11_gtest/pk11_keygen.cc @@ -38,8 +38,8 @@ void Pkcs11KeyPairGenerator::GenerateKey(ScopedSECKEYPrivateKey* priv_key, ScopedSECKEYPrivateKey priv_tmp( PK11_GenerateKeyPair(slot.get(), mech_, params->get(), &pub_tmp, PR_FALSE, sensitive ? PR_TRUE : PR_FALSE, nullptr)); - ASSERT_NE(nullptr, priv_tmp) << "PK11_GenerateKeyPair failed: " - << PORT_ErrorToName(PORT_GetError()); + ASSERT_NE(nullptr, priv_tmp) + << "PK11_GenerateKeyPair failed: " << PORT_ErrorToName(PORT_GetError()); ASSERT_NE(nullptr, pub_tmp); priv_key->swap(priv_tmp); diff --git a/gtests/pk11_gtest/pk11_module_unittest.cc b/gtests/pk11_gtest/pk11_module_unittest.cc index 42b59c605..4eaa894cd 100644 --- a/gtests/pk11_gtest/pk11_module_unittest.cc +++ b/gtests/pk11_gtest/pk11_module_unittest.cc @@ -22,9 +22,9 @@ class Pkcs11ModuleTest : public ::testing::Test { Pkcs11ModuleTest() {} void SetUp() override { - ASSERT_EQ(SECSuccess, SECMOD_AddNewModule("Pkcs11ModuleTest", DLL_PREFIX - "pkcs11testmodule." DLL_SUFFIX, - 0, 0)) + ASSERT_EQ(SECSuccess, SECMOD_AddNewModule( + "Pkcs11ModuleTest", + DLL_PREFIX "pkcs11testmodule." DLL_SUFFIX, 0, 0)) << PORT_ErrorToName(PORT_GetError()); } @@ -134,9 +134,9 @@ class Pkcs11NonAsciiTest : public ::testing::Test { BOOL result = CopyFileW(originalModuleName, nonAsciiModuleName, TRUE); ASSERT_TRUE(result); ASSERT_EQ(SECSuccess, - SECMOD_AddNewModule("Pkcs11NonAsciiTest", DLL_PREFIX - "pkcs11testmodule\xE2\x99\xA5." DLL_SUFFIX, - 0, 0)) + SECMOD_AddNewModule( + "Pkcs11NonAsciiTest", + DLL_PREFIX "pkcs11testmodule\xE2\x99\xA5." DLL_SUFFIX, 0, 0)) << PORT_ErrorToName(PORT_GetError()); } |