diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 09:22:09 +0000 |
commit | 43a97878ce14b72f0981164f87f2e35e14151312 (patch) | |
tree | 620249daf56c0258faa40cbdcf9cfba06de2a846 /security/nss/gtests/common/testvectors_base/test-structs.h | |
parent | Initial commit. (diff) | |
download | firefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip |
Adding upstream version 110.0.1.upstream/110.0.1upstream
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 | 155 |
1 files changed, 155 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..2d3d981639 --- /dev/null +++ b/security/nss/gtests/common/testvectors_base/test-structs.h @@ -0,0 +1,155 @@ +/* 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 { + uint32_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 valid; +} RsaDecryptTestVector; + +typedef struct RsaOaepTestVectorStr { + SECOidTag hash_oid; + CK_RSA_PKCS_MGF_TYPE mgf_hash; + uint32_t id; + std::vector<uint8_t> msg; + std::vector<uint8_t> ct; + std::vector<uint8_t> label; + std::vector<uint8_t> priv_key; + bool valid; +} RsaOaepTestVector; + +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__ |