1 // Copyright 2021 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 ///////////////////////////////////////////////////////////////////////////////
16
17 #include "tink/experimental/pqcrypto/signature/sphincs_key_template.h"
18
19 #include "tink/util/constants.h"
20 #include "proto/experimental/pqcrypto/sphincs.pb.h"
21 #include "proto/tink.pb.h"
22
23 extern "C" {
24 #include "third_party/pqclean/crypto_sign/sphincs-haraka-128f-robust/api.h"
25 #include "third_party/pqclean/crypto_sign/sphincs-haraka-128f-simple/api.h"
26 #include "third_party/pqclean/crypto_sign/sphincs-haraka-128s-robust/api.h"
27 #include "third_party/pqclean/crypto_sign/sphincs-haraka-128s-simple/api.h"
28 #include "third_party/pqclean/crypto_sign/sphincs-haraka-192f-robust/api.h"
29 #include "third_party/pqclean/crypto_sign/sphincs-haraka-192f-simple/api.h"
30 #include "third_party/pqclean/crypto_sign/sphincs-haraka-192s-robust/api.h"
31 #include "third_party/pqclean/crypto_sign/sphincs-haraka-192s-simple/api.h"
32 #include "third_party/pqclean/crypto_sign/sphincs-haraka-256f-robust/api.h"
33 #include "third_party/pqclean/crypto_sign/sphincs-haraka-256f-simple/api.h"
34 #include "third_party/pqclean/crypto_sign/sphincs-haraka-256s-robust/api.h"
35 #include "third_party/pqclean/crypto_sign/sphincs-haraka-256s-simple/api.h"
36 #include "third_party/pqclean/crypto_sign/sphincs-sha256-128f-robust/api.h"
37 #include "third_party/pqclean/crypto_sign/sphincs-sha256-128f-simple/api.h"
38 #include "third_party/pqclean/crypto_sign/sphincs-sha256-128s-robust/api.h"
39 #include "third_party/pqclean/crypto_sign/sphincs-sha256-128s-simple/api.h"
40 #include "third_party/pqclean/crypto_sign/sphincs-sha256-192f-robust/api.h"
41 #include "third_party/pqclean/crypto_sign/sphincs-sha256-192f-simple/api.h"
42 #include "third_party/pqclean/crypto_sign/sphincs-sha256-192s-robust/api.h"
43 #include "third_party/pqclean/crypto_sign/sphincs-sha256-192s-simple/api.h"
44 #include "third_party/pqclean/crypto_sign/sphincs-sha256-256f-robust/api.h"
45 #include "third_party/pqclean/crypto_sign/sphincs-sha256-256f-simple/api.h"
46 #include "third_party/pqclean/crypto_sign/sphincs-sha256-256s-robust/api.h"
47 #include "third_party/pqclean/crypto_sign/sphincs-sha256-256s-simple/api.h"
48 #include "third_party/pqclean/crypto_sign/sphincs-shake256-128f-robust/api.h"
49 #include "third_party/pqclean/crypto_sign/sphincs-shake256-128f-simple/api.h"
50 #include "third_party/pqclean/crypto_sign/sphincs-shake256-128s-robust/api.h"
51 #include "third_party/pqclean/crypto_sign/sphincs-shake256-128s-simple/api.h"
52 #include "third_party/pqclean/crypto_sign/sphincs-shake256-192f-robust/api.h"
53 #include "third_party/pqclean/crypto_sign/sphincs-shake256-192f-simple/api.h"
54 #include "third_party/pqclean/crypto_sign/sphincs-shake256-192s-robust/api.h"
55 #include "third_party/pqclean/crypto_sign/sphincs-shake256-192s-simple/api.h"
56 #include "third_party/pqclean/crypto_sign/sphincs-shake256-256f-robust/api.h"
57 #include "third_party/pqclean/crypto_sign/sphincs-shake256-256f-simple/api.h"
58 #include "third_party/pqclean/crypto_sign/sphincs-shake256-256s-robust/api.h"
59 #include "third_party/pqclean/crypto_sign/sphincs-shake256-256s-simple/api.h"
60 }
61
62 namespace crypto {
63 namespace tink {
64 namespace {
65
66 using google::crypto::tink::KeyTemplate;
67 using google::crypto::tink::OutputPrefixType;
68 using ::google::crypto::tink::SphincsHashType;
69 using ::google::crypto::tink::SphincsKeyFormat;
70 using ::google::crypto::tink::SphincsParams;
71 using ::google::crypto::tink::SphincsPrivateKey;
72 using ::google::crypto::tink::SphincsSignatureType;
73 using ::google::crypto::tink::SphincsVariant;
74
NewSphincsKeyTemplate(int32_t private_key_size,SphincsHashType hash_type,SphincsVariant variant,SphincsSignatureType type)75 KeyTemplate* NewSphincsKeyTemplate(int32_t private_key_size,
76 SphincsHashType hash_type,
77 SphincsVariant variant,
78 SphincsSignatureType type) {
79 KeyTemplate* key_template = new KeyTemplate;
80 key_template->set_type_url(
81 absl::StrCat(kTypeGoogleapisCom, SphincsPrivateKey().GetTypeName()));
82 key_template->set_output_prefix_type(OutputPrefixType::TINK);
83
84 SphincsKeyFormat key_format;
85 SphincsParams* params = key_format.mutable_params();
86 params->set_key_size(private_key_size);
87 params->set_hash_type(hash_type);
88 params->set_variant(variant);
89 params->set_sig_length_type(type);
90 key_format.SerializeToString(key_template->mutable_value());
91
92 return key_template;
93 }
94
95 } // anonymous namespace
96
97 // HARAKA
98 const google::crypto::tink::KeyTemplate&
Sphincs_Haraka_128_F_Robust_KeyTemplate()99 Sphincs_Haraka_128_F_Robust_KeyTemplate() {
100 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
101 PQCLEAN_SPHINCSHARAKA128FROBUST_CRYPTO_SECRETKEYBYTES,
102 SphincsHashType::HARAKA, SphincsVariant::ROBUST,
103 SphincsSignatureType::FAST_SIGNING);
104 return *key_template;
105 }
106
107 const google::crypto::tink::KeyTemplate&
Sphincs_Haraka_128_F_Simple_KeyTemplate()108 Sphincs_Haraka_128_F_Simple_KeyTemplate() {
109 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
110 PQCLEAN_SPHINCSHARAKA128FSIMPLE_CRYPTO_SECRETKEYBYTES,
111 SphincsHashType::HARAKA, SphincsVariant::SIMPLE,
112 SphincsSignatureType::FAST_SIGNING);
113 return *key_template;
114 }
115
116 const google::crypto::tink::KeyTemplate&
Sphincs_Haraka_128_S_Robust_KeyTemplate()117 Sphincs_Haraka_128_S_Robust_KeyTemplate() {
118 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
119 PQCLEAN_SPHINCSHARAKA128SROBUST_CRYPTO_SECRETKEYBYTES,
120 SphincsHashType::HARAKA, SphincsVariant::ROBUST,
121 SphincsSignatureType::SMALL_SIGNATURE);
122 return *key_template;
123 }
124
125 const google::crypto::tink::KeyTemplate&
Sphincs_Haraka_128_S_Simple_KeyTemplate()126 Sphincs_Haraka_128_S_Simple_KeyTemplate() {
127 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
128 PQCLEAN_SPHINCSHARAKA128SSIMPLE_CRYPTO_SECRETKEYBYTES,
129 SphincsHashType::HARAKA, SphincsVariant::SIMPLE,
130 SphincsSignatureType::SMALL_SIGNATURE);
131 return *key_template;
132 }
133
134 const google::crypto::tink::KeyTemplate&
Sphincs_Haraka_192_F_Robust_KeyTemplate()135 Sphincs_Haraka_192_F_Robust_KeyTemplate() {
136 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
137 PQCLEAN_SPHINCSHARAKA192FROBUST_CRYPTO_SECRETKEYBYTES,
138 SphincsHashType::HARAKA, SphincsVariant::ROBUST,
139 SphincsSignatureType::FAST_SIGNING);
140 return *key_template;
141 }
142
143 const google::crypto::tink::KeyTemplate&
Sphincs_Haraka_192_F_Simple_KeyTemplate()144 Sphincs_Haraka_192_F_Simple_KeyTemplate() {
145 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
146 PQCLEAN_SPHINCSHARAKA192FSIMPLE_CRYPTO_SECRETKEYBYTES,
147 SphincsHashType::HARAKA, SphincsVariant::SIMPLE,
148 SphincsSignatureType::FAST_SIGNING);
149 return *key_template;
150 }
151
152 const google::crypto::tink::KeyTemplate&
Sphincs_Haraka_192_S_Robust_KeyTemplate()153 Sphincs_Haraka_192_S_Robust_KeyTemplate() {
154 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
155 PQCLEAN_SPHINCSHARAKA192SROBUST_CRYPTO_SECRETKEYBYTES,
156 SphincsHashType::HARAKA, SphincsVariant::ROBUST,
157 SphincsSignatureType::SMALL_SIGNATURE);
158 return *key_template;
159 }
160
161 const google::crypto::tink::KeyTemplate&
Sphincs_Haraka_192_S_Simple_KeyTemplate()162 Sphincs_Haraka_192_S_Simple_KeyTemplate() {
163 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
164 PQCLEAN_SPHINCSHARAKA192SSIMPLE_CRYPTO_SECRETKEYBYTES,
165 SphincsHashType::HARAKA, SphincsVariant::SIMPLE,
166 SphincsSignatureType::SMALL_SIGNATURE);
167 return *key_template;
168 }
169
170 const google::crypto::tink::KeyTemplate&
Sphincs_Haraka_256_F_Robust_KeyTemplate()171 Sphincs_Haraka_256_F_Robust_KeyTemplate() {
172 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
173 PQCLEAN_SPHINCSHARAKA256FROBUST_CRYPTO_SECRETKEYBYTES,
174 SphincsHashType::HARAKA, SphincsVariant::ROBUST,
175 SphincsSignatureType::FAST_SIGNING);
176 return *key_template;
177 }
178
179 const google::crypto::tink::KeyTemplate&
Sphincs_Haraka_256_F_Simple_KeyTemplate()180 Sphincs_Haraka_256_F_Simple_KeyTemplate() {
181 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
182 PQCLEAN_SPHINCSHARAKA256FSIMPLE_CRYPTO_SECRETKEYBYTES,
183 SphincsHashType::HARAKA, SphincsVariant::SIMPLE,
184 SphincsSignatureType::FAST_SIGNING);
185 return *key_template;
186 }
187
188 const google::crypto::tink::KeyTemplate&
Sphincs_Haraka_256_S_Robust_KeyTemplate()189 Sphincs_Haraka_256_S_Robust_KeyTemplate() {
190 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
191 PQCLEAN_SPHINCSHARAKA256SROBUST_CRYPTO_SECRETKEYBYTES,
192 SphincsHashType::HARAKA, SphincsVariant::ROBUST,
193 SphincsSignatureType::SMALL_SIGNATURE);
194 return *key_template;
195 }
196
197 const google::crypto::tink::KeyTemplate&
Sphincs_Haraka_256_S_Simple_KeyTemplate()198 Sphincs_Haraka_256_S_Simple_KeyTemplate() {
199 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
200 PQCLEAN_SPHINCSHARAKA256SSIMPLE_CRYPTO_SECRETKEYBYTES,
201 SphincsHashType::HARAKA, SphincsVariant::SIMPLE,
202 SphincsSignatureType::SMALL_SIGNATURE);
203 return *key_template;
204 }
205
206 // SHA256
207 const google::crypto::tink::KeyTemplate&
Sphincs_Sha256_128_F_Robust_KeyTemplate()208 Sphincs_Sha256_128_F_Robust_KeyTemplate() {
209 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
210 PQCLEAN_SPHINCSSHA256128FROBUST_CRYPTO_SECRETKEYBYTES,
211 SphincsHashType::SHA256, SphincsVariant::ROBUST,
212 SphincsSignatureType::FAST_SIGNING);
213 return *key_template;
214 }
215
216 const google::crypto::tink::KeyTemplate&
Sphincs_Sha256_128_F_Simple_KeyTemplate()217 Sphincs_Sha256_128_F_Simple_KeyTemplate() {
218 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
219 PQCLEAN_SPHINCSSHA256128FSIMPLE_CRYPTO_SECRETKEYBYTES,
220 SphincsHashType::SHA256, SphincsVariant::SIMPLE,
221 SphincsSignatureType::FAST_SIGNING);
222 return *key_template;
223 }
224
225 const google::crypto::tink::KeyTemplate&
Sphincs_Sha256_128_S_Robust_KeyTemplate()226 Sphincs_Sha256_128_S_Robust_KeyTemplate() {
227 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
228 PQCLEAN_SPHINCSSHA256128SROBUST_CRYPTO_SECRETKEYBYTES,
229 SphincsHashType::SHA256, SphincsVariant::ROBUST,
230 SphincsSignatureType::SMALL_SIGNATURE);
231 return *key_template;
232 }
233
234 const google::crypto::tink::KeyTemplate&
Sphincs_Sha256_128_S_Simple_KeyTemplate()235 Sphincs_Sha256_128_S_Simple_KeyTemplate() {
236 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
237 PQCLEAN_SPHINCSSHA256128SSIMPLE_CRYPTO_SECRETKEYBYTES,
238 SphincsHashType::SHA256, SphincsVariant::SIMPLE,
239 SphincsSignatureType::SMALL_SIGNATURE);
240 return *key_template;
241 }
242
243 const google::crypto::tink::KeyTemplate&
Sphincs_Sha256_192_F_Robust_KeyTemplate()244 Sphincs_Sha256_192_F_Robust_KeyTemplate() {
245 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
246 PQCLEAN_SPHINCSSHA256192FROBUST_CRYPTO_SECRETKEYBYTES,
247 SphincsHashType::SHA256, SphincsVariant::ROBUST,
248 SphincsSignatureType::FAST_SIGNING);
249 return *key_template;
250 }
251
252 const google::crypto::tink::KeyTemplate&
Sphincs_Sha256_192_F_Simple_KeyTemplate()253 Sphincs_Sha256_192_F_Simple_KeyTemplate() {
254 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
255 PQCLEAN_SPHINCSSHA256192FSIMPLE_CRYPTO_SECRETKEYBYTES,
256 SphincsHashType::SHA256, SphincsVariant::SIMPLE,
257 SphincsSignatureType::FAST_SIGNING);
258 return *key_template;
259 }
260
261 const google::crypto::tink::KeyTemplate&
Sphincs_Sha256_192_S_Robust_KeyTemplate()262 Sphincs_Sha256_192_S_Robust_KeyTemplate() {
263 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
264 PQCLEAN_SPHINCSSHA256192SROBUST_CRYPTO_SECRETKEYBYTES,
265 SphincsHashType::SHA256, SphincsVariant::ROBUST,
266 SphincsSignatureType::SMALL_SIGNATURE);
267 return *key_template;
268 }
269
270 const google::crypto::tink::KeyTemplate&
Sphincs_Sha256_192_S_Simple_KeyTemplate()271 Sphincs_Sha256_192_S_Simple_KeyTemplate() {
272 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
273 PQCLEAN_SPHINCSSHA256192SSIMPLE_CRYPTO_SECRETKEYBYTES,
274 SphincsHashType::SHA256, SphincsVariant::SIMPLE,
275 SphincsSignatureType::SMALL_SIGNATURE);
276 return *key_template;
277 }
278
279 const google::crypto::tink::KeyTemplate&
Sphincs_Sha256_256_F_Robust_KeyTemplate()280 Sphincs_Sha256_256_F_Robust_KeyTemplate() {
281 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
282 PQCLEAN_SPHINCSSHA256256FROBUST_CRYPTO_SECRETKEYBYTES,
283 SphincsHashType::SHA256, SphincsVariant::ROBUST,
284 SphincsSignatureType::FAST_SIGNING);
285 return *key_template;
286 }
287
288 const google::crypto::tink::KeyTemplate&
Sphincs_Sha256_256_F_Simple_KeyTemplate()289 Sphincs_Sha256_256_F_Simple_KeyTemplate() {
290 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
291 PQCLEAN_SPHINCSSHA256256FSIMPLE_CRYPTO_SECRETKEYBYTES,
292 SphincsHashType::SHA256, SphincsVariant::SIMPLE,
293 SphincsSignatureType::FAST_SIGNING);
294 return *key_template;
295 }
296
297 const google::crypto::tink::KeyTemplate&
Sphincs_Sha256_256_S_Robust_KeyTemplate()298 Sphincs_Sha256_256_S_Robust_KeyTemplate() {
299 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
300 PQCLEAN_SPHINCSSHA256256SROBUST_CRYPTO_SECRETKEYBYTES,
301 SphincsHashType::SHA256, SphincsVariant::ROBUST,
302 SphincsSignatureType::SMALL_SIGNATURE);
303 return *key_template;
304 }
305
306 const google::crypto::tink::KeyTemplate&
Sphincs_Sha256_256_S_Simple_KeyTemplate()307 Sphincs_Sha256_256_S_Simple_KeyTemplate() {
308 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
309 PQCLEAN_SPHINCSSHA256256SSIMPLE_CRYPTO_SECRETKEYBYTES,
310 SphincsHashType::SHA256, SphincsVariant::SIMPLE,
311 SphincsSignatureType::SMALL_SIGNATURE);
312 return *key_template;
313 }
314
315 // SHAKE256
316 const google::crypto::tink::KeyTemplate&
Sphincs_Shake256_128_F_Robust_KeyTemplate()317 Sphincs_Shake256_128_F_Robust_KeyTemplate() {
318 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
319 PQCLEAN_SPHINCSSHAKE256128FROBUST_CRYPTO_SECRETKEYBYTES,
320 SphincsHashType::SHAKE256, SphincsVariant::ROBUST,
321 SphincsSignatureType::FAST_SIGNING);
322 return *key_template;
323 }
324
325 const google::crypto::tink::KeyTemplate&
Sphincs_Shake256_128_F_Simple_KeyTemplate()326 Sphincs_Shake256_128_F_Simple_KeyTemplate() {
327 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
328 PQCLEAN_SPHINCSSHAKE256128FSIMPLE_CRYPTO_SECRETKEYBYTES,
329 SphincsHashType::SHAKE256, SphincsVariant::SIMPLE,
330 SphincsSignatureType::FAST_SIGNING);
331 return *key_template;
332 }
333
334 const google::crypto::tink::KeyTemplate&
Sphincs_Shake256_128_S_Robust_KeyTemplate()335 Sphincs_Shake256_128_S_Robust_KeyTemplate() {
336 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
337 PQCLEAN_SPHINCSSHAKE256128SROBUST_CRYPTO_SECRETKEYBYTES,
338 SphincsHashType::SHAKE256, SphincsVariant::ROBUST,
339 SphincsSignatureType::SMALL_SIGNATURE);
340 return *key_template;
341 }
342
343 const google::crypto::tink::KeyTemplate&
Sphincs_Shake256_128_S_Simple_KeyTemplate()344 Sphincs_Shake256_128_S_Simple_KeyTemplate() {
345 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
346 PQCLEAN_SPHINCSSHAKE256128SSIMPLE_CRYPTO_SECRETKEYBYTES,
347 SphincsHashType::SHAKE256, SphincsVariant::SIMPLE,
348 SphincsSignatureType::SMALL_SIGNATURE);
349 return *key_template;
350 }
351
352 const google::crypto::tink::KeyTemplate&
Sphincs_Shake256_192_F_Robust_KeyTemplate()353 Sphincs_Shake256_192_F_Robust_KeyTemplate() {
354 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
355 PQCLEAN_SPHINCSSHAKE256192FROBUST_CRYPTO_SECRETKEYBYTES,
356 SphincsHashType::SHAKE256, SphincsVariant::ROBUST,
357 SphincsSignatureType::FAST_SIGNING);
358 return *key_template;
359 }
360
361 const google::crypto::tink::KeyTemplate&
Sphincs_Shake256_192_F_Simple_KeyTemplate()362 Sphincs_Shake256_192_F_Simple_KeyTemplate() {
363 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
364 PQCLEAN_SPHINCSSHAKE256192FSIMPLE_CRYPTO_SECRETKEYBYTES,
365 SphincsHashType::SHAKE256, SphincsVariant::SIMPLE,
366 SphincsSignatureType::FAST_SIGNING);
367 return *key_template;
368 }
369
370 const google::crypto::tink::KeyTemplate&
Sphincs_Shake256_192_S_Robust_KeyTemplate()371 Sphincs_Shake256_192_S_Robust_KeyTemplate() {
372 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
373 PQCLEAN_SPHINCSSHAKE256192SROBUST_CRYPTO_SECRETKEYBYTES,
374 SphincsHashType::SHAKE256, SphincsVariant::ROBUST,
375 SphincsSignatureType::SMALL_SIGNATURE);
376 return *key_template;
377 }
378
379 const google::crypto::tink::KeyTemplate&
Sphincs_Shake256_192_S_Simple_KeyTemplate()380 Sphincs_Shake256_192_S_Simple_KeyTemplate() {
381 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
382 PQCLEAN_SPHINCSSHAKE256192SSIMPLE_CRYPTO_SECRETKEYBYTES,
383 SphincsHashType::SHAKE256, SphincsVariant::SIMPLE,
384 SphincsSignatureType::SMALL_SIGNATURE);
385 return *key_template;
386 }
387
388 const google::crypto::tink::KeyTemplate&
Sphincs_Shake256_256_F_Robust_KeyTemplate()389 Sphincs_Shake256_256_F_Robust_KeyTemplate() {
390 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
391 PQCLEAN_SPHINCSSHAKE256256FROBUST_CRYPTO_SECRETKEYBYTES,
392 SphincsHashType::SHAKE256, SphincsVariant::ROBUST,
393 SphincsSignatureType::FAST_SIGNING);
394 return *key_template;
395 }
396
397 const google::crypto::tink::KeyTemplate&
Sphincs_Shake256_256_F_Simple_KeyTemplate()398 Sphincs_Shake256_256_F_Simple_KeyTemplate() {
399 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
400 PQCLEAN_SPHINCSSHAKE256256FSIMPLE_CRYPTO_SECRETKEYBYTES,
401 SphincsHashType::SHAKE256, SphincsVariant::SIMPLE,
402 SphincsSignatureType::FAST_SIGNING);
403 return *key_template;
404 }
405
406 const google::crypto::tink::KeyTemplate&
Sphincs_Shake256_256_S_Robust_KeyTemplate()407 Sphincs_Shake256_256_S_Robust_KeyTemplate() {
408 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
409 PQCLEAN_SPHINCSSHAKE256256SROBUST_CRYPTO_SECRETKEYBYTES,
410 SphincsHashType::SHAKE256, SphincsVariant::ROBUST,
411 SphincsSignatureType::SMALL_SIGNATURE);
412 return *key_template;
413 }
414
415 const google::crypto::tink::KeyTemplate&
Sphincs_Shake256_256_S_Simple_KeyTemplate()416 Sphincs_Shake256_256_S_Simple_KeyTemplate() {
417 static const KeyTemplate* key_template = NewSphincsKeyTemplate(
418 PQCLEAN_SPHINCSSHAKE256256SSIMPLE_CRYPTO_SECRETKEYBYTES,
419 SphincsHashType::SHAKE256, SphincsVariant::SIMPLE,
420 SphincsSignatureType::SMALL_SIGNATURE);
421 return *key_template;
422 }
423
424 } // namespace tink
425 } // namespace crypto
426