Skip to content

Commit 423360c

Browse files
committed
ML-KEM: add schema
1 parent d6f955d commit 423360c

File tree

1 file changed

+228
-0
lines changed

1 file changed

+228
-0
lines changed

schemas/mlkem_test_schema.json

Lines changed: 228 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,228 @@
1+
{
2+
"type": "object",
3+
"properties": {
4+
"algorithm": {
5+
"enum": [
6+
"ML-KEM"
7+
]
8+
},
9+
"header": {
10+
"type": "array",
11+
"items": {
12+
"type": "string"
13+
},
14+
"description": "additional documentation"
15+
},
16+
"notes": {
17+
"type": "object",
18+
"description": "a description of the labels used in the test vectors"
19+
},
20+
"numberOfTests": {
21+
"type": "integer",
22+
"description": "the number of test vectors in this test"
23+
},
24+
"schema": {
25+
"enum": [
26+
"mlkem_test_schema.json"
27+
]
28+
},
29+
"testGroups": {
30+
"type": "array",
31+
"items": {
32+
"oneOf": [
33+
{
34+
"$ref": "#/definitions/MLKEMTestGroup"
35+
},
36+
{
37+
"$ref": "#/definitions/MLKEMEncapsTestGroup"
38+
}
39+
]
40+
}
41+
}
42+
},
43+
"required": [
44+
"algorithm",
45+
"numberOfTests",
46+
"schema",
47+
"testGroups"
48+
],
49+
"additionalProperties": false,
50+
"definitions": {
51+
"MLKEMTestGroup": {
52+
"type": "object",
53+
"description": "A test for KeyGen and/or Decaps",
54+
"properties": {
55+
"type": {
56+
"enum": [
57+
"MLKEMTest"
58+
]
59+
},
60+
"source": {
61+
"$ref": "common.json#/definitions/Source"
62+
},
63+
"parameterSet": {
64+
"enum": [
65+
"ML-KEM-512",
66+
"ML-KEM-768",
67+
"ML-KEM-1024"
68+
]
69+
},
70+
"tests": {
71+
"type": "array",
72+
"items": {
73+
"type": "object",
74+
"properties": {
75+
"tcId": {
76+
"type": "integer",
77+
"description": "Identifier of the test case"
78+
},
79+
"comment": {
80+
"type": "string",
81+
"description": "A brief description of the test case"
82+
},
83+
"seed": {
84+
"type": "string",
85+
"format": "HexBytes",
86+
"description": "The d || z seed"
87+
},
88+
"ek": {
89+
"type": "string",
90+
"format": "HexBytes",
91+
"description": "The encapsulation key derived from the seed"
92+
},
93+
"c": {
94+
"type": "string",
95+
"format": "HexBytes",
96+
"description": "An input ciphertext"
97+
},
98+
"K": {
99+
"type": "string",
100+
"format": "HexBytes",
101+
"description": "The output shared secret"
102+
},
103+
"result": {
104+
"type": "string",
105+
"description": "Test result",
106+
"enum": [
107+
"valid",
108+
"invalid",
109+
"acceptable"
110+
]
111+
},
112+
"flags": {
113+
"type": "array",
114+
"items": {
115+
"type": "string"
116+
},
117+
"description": "A list of flags"
118+
}
119+
},
120+
"required": [
121+
"tcId",
122+
"seed",
123+
"ek",
124+
"c",
125+
"K",
126+
"result"
127+
],
128+
"additionalProperties": false
129+
}
130+
}
131+
},
132+
"required": [
133+
"source",
134+
"parameterSet",
135+
"tests"
136+
],
137+
"additionalProperties": false
138+
},
139+
"MLKEMEncapsTestGroup": {
140+
"type": "object",
141+
"description": "A test for Encaps",
142+
"properties": {
143+
"type": {
144+
"enum": [
145+
"MLKEMEncapsTest"
146+
]
147+
},
148+
"source": {
149+
"$ref": "common.json#/definitions/Source"
150+
},
151+
"parameterSet": {
152+
"enum": [
153+
"ML-KEM-512",
154+
"ML-KEM-768",
155+
"ML-KEM-1024"
156+
]
157+
},
158+
"tests": {
159+
"type": "array",
160+
"items": {
161+
"type": "object",
162+
"properties": {
163+
"tcId": {
164+
"type": "integer",
165+
"description": "Identifier of the test case"
166+
},
167+
"comment": {
168+
"type": "string",
169+
"description": "A brief description of the test case"
170+
},
171+
"ek": {
172+
"type": "string",
173+
"format": "HexBytes",
174+
"description": "The encapsulation key"
175+
},
176+
"m": {
177+
"type": "string",
178+
"format": "HexBytes",
179+
"description": "The ML-KEM.Encaps_internal m input"
180+
},
181+
"c": {
182+
"type": "string",
183+
"format": "HexBytes",
184+
"description": "The output ciphertext"
185+
},
186+
"K": {
187+
"type": "string",
188+
"format": "HexBytes",
189+
"description": "The output shared secret"
190+
},
191+
"result": {
192+
"type": "string",
193+
"description": "Test result",
194+
"enum": [
195+
"valid",
196+
"invalid",
197+
"acceptable"
198+
]
199+
},
200+
"flags": {
201+
"type": "array",
202+
"items": {
203+
"type": "string"
204+
},
205+
"description": "A list of flags"
206+
}
207+
},
208+
"required": [
209+
"tcId",
210+
"ek",
211+
"m",
212+
"c",
213+
"K",
214+
"result"
215+
],
216+
"additionalProperties": false
217+
}
218+
}
219+
},
220+
"required": [
221+
"source",
222+
"parameterSet",
223+
"tests"
224+
],
225+
"additionalProperties": false
226+
}
227+
}
228+
}

0 commit comments

Comments
 (0)