test-structs.h (4376B)
1 /* vim: set ts=2 et sw=2 tw=80: */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 /* This file is generated from sources in nss/gtests/common/wycheproof 7 * automatically and should not be touched manually. 8 * Generation is trigged by calling ./mach wycheproof */ 9 10 #ifndef test_structs_h__ 11 #define test_structs_h__ 12 13 #include <string> 14 #include <vector> 15 #include "secoidt.h" 16 #include "pkcs11t.h" 17 #include "kyber.h" 18 19 typedef struct AesCbcTestVectorStr { 20 uint32_t id; 21 std::string key; 22 std::string msg; 23 std::string iv; 24 std::string ciphertext; 25 bool valid; 26 } AesCbcTestVector; 27 28 typedef struct AesCmacTestVectorStr { 29 uint32_t id; 30 std::string comment; 31 std::string key; 32 std::string msg; 33 std::string tag; 34 bool invalid; 35 } AesCmacTestVector; 36 typedef AesCmacTestVector HmacTestVector; 37 38 typedef struct AesGcmKatValueStr { 39 uint32_t id; 40 std::string key; 41 std::string plaintext; 42 std::string additional_data; 43 std::string iv; 44 std::string hash_key; 45 std::string ghash; 46 std::string result; 47 bool invalid_ct; 48 bool invalid_iv; 49 } AesGcmKatValue; 50 51 typedef struct ChaChaTestVectorStr { 52 uint32_t id; 53 std::vector<uint8_t> plaintext; 54 std::vector<uint8_t> aad; 55 std::vector<uint8_t> key; 56 std::vector<uint8_t> iv; 57 std::vector<uint8_t> ciphertext; 58 bool invalid_tag; 59 bool invalid_iv; 60 } ChaChaTestVector; 61 62 typedef struct MlKemKeyGenTestVectorStr { 63 uint32_t id; 64 KyberParams params; 65 std::vector<uint8_t> seed; 66 std::vector<uint8_t> publicKeyDigest; 67 std::vector<uint8_t> privateKeyDigest; 68 } MlKemKeyGenTestVector; 69 70 typedef struct MlKemEncapTestVectorStr { 71 uint32_t id; 72 KyberParams params; 73 std::vector<uint8_t> entropy; 74 std::vector<uint8_t> publicKey; 75 std::vector<uint8_t> cipherTextDigest; 76 std::vector<uint8_t> secret; 77 bool expectedResult; 78 } MlKemEncapTestVector; 79 80 typedef struct MlKemDecapTestVectorStr { 81 uint32_t id; 82 KyberParams params; 83 std::vector<uint8_t> privateKey; 84 std::vector<uint8_t> cipherText; 85 std::vector<uint8_t> secret; 86 bool expectedResult; 87 } MlKemDecapTestVector; 88 89 typedef struct EcdsaTestVectorStr { 90 SECOidTag hash_oid; 91 uint32_t id; 92 std::vector<uint8_t> sig; 93 std::vector<uint8_t> public_key; 94 std::vector<uint8_t> msg; 95 bool valid; 96 } EcdsaTestVector; 97 98 typedef EcdsaTestVector DsaTestVector; 99 100 typedef struct EddsaTestVectorStr { 101 uint32_t id; 102 std::vector<uint8_t> sig; 103 std::vector<uint8_t> public_key; 104 std::vector<uint8_t> msg; 105 bool valid; 106 } EddsaTestVector; 107 108 typedef struct EcdhTestVectorStr { 109 uint64_t id; 110 std::vector<uint8_t> private_key; 111 std::vector<uint8_t> public_key; 112 std::vector<uint8_t> secret; 113 bool invalid_asn; 114 bool valid; 115 } EcdhTestVector; 116 117 typedef struct HkdfTestVectorStr { 118 uint32_t id; 119 std::string ikm; 120 std::string salt; 121 std::string info; 122 std::string okm; 123 uint32_t size; 124 bool valid; 125 } HkdfTestVector; 126 127 enum class IkeTestType { 128 ikeGxy, /* CKM_IKE_PRF_DERIVE case 1 */ 129 ikeV1Psk, /* CKM_IKE_PRF_DERIVE case 2 */ 130 ikeV2Rekey, /* CKM_IKE_PRF_DERIVE case 3 */ 131 ikeV1, /* CKM_IKE1_PRF_DERIVE */ 132 ikeV1AppB, /* CKM_IKE1_PRF_EXTENDED_DERIVE base mode */ 133 ikeV1AppBQuick, /* CKM_IKE1_PRF_EXTENDED_DERIVE quick mode */ 134 ikePlus /* CKM_IKE2_PRF_PLUS_DERIVE */ 135 }; 136 137 typedef struct IkeTestVectorStr { 138 uint32_t id; 139 IkeTestType test_type; 140 std::string ikm; 141 std::string gxykm; 142 std::string prevkm; 143 std::string okm; 144 std::string Ni; 145 std::string Nr; 146 std::string seed_data; 147 uint8_t key_number; 148 uint32_t size; 149 bool valid; 150 } IkeTestVector; 151 152 typedef struct RsaSignatureTestVectorStr { 153 SECOidTag hash_oid; 154 uint32_t id; 155 std::vector<uint8_t> sig; 156 std::vector<uint8_t> public_key; 157 std::vector<uint8_t> msg; 158 bool valid; 159 } RsaSignatureTestVector; 160 161 typedef struct RsaDecryptTestVectorStr { 162 uint32_t id; 163 std::vector<uint8_t> msg; 164 std::vector<uint8_t> ct; 165 std::vector<uint8_t> priv_key; 166 bool invalid_padding; 167 bool valid; 168 } RsaDecryptTestVector; 169 170 typedef struct RsaPssTestVectorStr { 171 SECOidTag hash_oid; 172 CK_RSA_PKCS_MGF_TYPE mgf_hash; 173 uint32_t id; 174 unsigned long sLen; 175 std::vector<uint8_t> sig; 176 std::vector<uint8_t> public_key; 177 std::vector<uint8_t> msg; 178 bool valid; 179 } RsaPssTestVector; 180 181 #endif // test_structs_h__