summaryrefslogtreecommitdiffstats
path: root/security/nss/gtests/common/testvectors_base/test-structs.h
blob: 1ed227da50cf5b15a3955192e759a9059445d72d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
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__