diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /security/nss/gtests/common/testvectors_base/test-structs.h | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'security/nss/gtests/common/testvectors_base/test-structs.h')
-rw-r--r-- | security/nss/gtests/common/testvectors_base/test-structs.h | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/security/nss/gtests/common/testvectors_base/test-structs.h b/security/nss/gtests/common/testvectors_base/test-structs.h new file mode 100644 index 0000000000..1ed227da50 --- /dev/null +++ b/security/nss/gtests/common/testvectors_base/test-structs.h @@ -0,0 +1,145 @@ +/* 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/. */ + +/* This file is generated from sources in nss/gtests/common/wycheproof + * automatically and should not be touched manually. + * Generation is trigged by calling ./mach wycheproof */ + +#ifndef test_structs_h__ +#define test_structs_h__ + +#include <string> +#include <vector> +#include "secoidt.h" +#include "pkcs11t.h" + +typedef struct AesCbcTestVectorStr { + uint32_t id; + std::string key; + std::string msg; + std::string iv; + std::string ciphertext; + bool valid; +} AesCbcTestVector; + +typedef struct AesCmacTestVectorStr { + uint32_t id; + std::string comment; + std::string key; + std::string msg; + std::string tag; + bool invalid; +} AesCmacTestVector; +typedef AesCmacTestVector HmacTestVector; + +typedef struct AesGcmKatValueStr { + uint32_t id; + std::string key; + std::string plaintext; + std::string additional_data; + std::string iv; + std::string hash_key; + std::string ghash; + std::string result; + bool invalid_ct; + bool invalid_iv; +} AesGcmKatValue; + +typedef struct ChaChaTestVectorStr { + uint32_t id; + std::vector<uint8_t> plaintext; + std::vector<uint8_t> aad; + std::vector<uint8_t> key; + std::vector<uint8_t> iv; + std::vector<uint8_t> ciphertext; + bool invalid_tag; + bool invalid_iv; +} ChaChaTestVector; + +typedef struct EcdsaTestVectorStr { + SECOidTag hash_oid; + uint32_t id; + std::vector<uint8_t> sig; + std::vector<uint8_t> public_key; + std::vector<uint8_t> msg; + bool valid; +} EcdsaTestVector; + +typedef EcdsaTestVector DsaTestVector; + +typedef struct EcdhTestVectorStr { + uint64_t id; + std::vector<uint8_t> private_key; + std::vector<uint8_t> public_key; + std::vector<uint8_t> secret; + bool invalid_asn; + bool valid; +} EcdhTestVector; + +typedef struct HkdfTestVectorStr { + uint32_t id; + std::string ikm; + std::string salt; + std::string info; + std::string okm; + uint32_t size; + bool valid; +} HkdfTestVector; + +enum class IkeTestType { + ikeGxy, /* CKM_NSS_IKE_PRF_DERIVE case 1 */ + ikeV1Psk, /* CKM_NSS_IKE_PRF_DERIVE case 2 */ + ikeV2Rekey, /* CKM_NSS_IKE_PRF_DERIVE case 3 */ + ikeV1, /* CKM_NSS_IKE1_PRF_DERIVE */ + ikeV1AppB, /* CKM_NSS_IKE1_PRF_APP_B_DERIVE base mode */ + ikeV1AppBQuick, /* CKM_NSS_IKE1_PRF_APP_B_DERIVE quick mode */ + ikePlus /* CKM_NSS_IKE_PRF_DERIVE */ +}; + +typedef struct IkeTestVectorStr { + uint32_t id; + IkeTestType test_type; + std::string ikm; + std::string gxykm; + std::string prevkm; + std::string okm; + std::string Ni; + std::string Nr; + std::string seed_data; + uint8_t key_number; + uint32_t size; + bool valid; +} IkeTestVector; + +typedef struct RsaSignatureTestVectorStr { + SECOidTag hash_oid; + uint32_t id; + std::vector<uint8_t> sig; + std::vector<uint8_t> public_key; + std::vector<uint8_t> msg; + bool valid; +} RsaSignatureTestVector; + +typedef struct RsaDecryptTestVectorStr { + uint32_t id; + std::vector<uint8_t> msg; + std::vector<uint8_t> ct; + std::vector<uint8_t> priv_key; + bool invalid_padding; + bool valid; +} RsaDecryptTestVector; + +typedef struct RsaPssTestVectorStr { + SECOidTag hash_oid; + CK_RSA_PKCS_MGF_TYPE mgf_hash; + uint32_t id; + unsigned long sLen; + std::vector<uint8_t> sig; + std::vector<uint8_t> public_key; + std::vector<uint8_t> msg; + bool valid; +} RsaPssTestVector; + +#endif // test_structs_h__ |