• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

randombit / botan / 19012754211

02 Nov 2025 01:10PM UTC coverage: 90.677% (+0.006%) from 90.671%
19012754211

push

github

web-flow
Merge pull request #5137 from randombit/jack/clang-tidy-includes

Remove various unused includes flagged by clang-tidy misc-include-cleaner

100457 of 110786 relevant lines covered (90.68%)

12189873.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

73.58
/src/lib/pubkey/sphincsplus/sphincsplus_common/sp_parameters.cpp
1
/*
2
 * SLH-DSA Parameters
3
 * (C) 2023 Jack Lloyd
4
 *     2023 Fabian Albert, René Meusel, Amos Treiber - Rohde & Schwarz Cybersecurity
5
 *
6
 * Botan is released under the Simplified BSD License (see license.txt)
7
 */
8

9
#include <botan/sp_parameters.h>
10

11
#include <botan/assert.h>
12
#include <botan/exceptn.h>
13
#include <botan/internal/bit_ops.h>
14
#include <botan/internal/fmt.h>
15

16
namespace Botan {
17

18
namespace {
19
/// @returns pair: (parameter set, hash type)
20
std::pair<Sphincs_Parameter_Set, Sphincs_Hash_Type> set_and_hash_from_name(std::string_view name) {
604✔
21
   // SPHINCS+ Round 3.1 instances
22
   if(name == "SphincsPlus-sha2-128s-r3.1") {
604✔
23
      return {Sphincs_Parameter_Set::Sphincs128Small, Sphincs_Hash_Type::Sha256};
23✔
24
   }
25
   if(name == "SphincsPlus-sha2-128f-r3.1") {
581✔
26
      return {Sphincs_Parameter_Set::Sphincs128Fast, Sphincs_Hash_Type::Sha256};
24✔
27
   }
28
   if(name == "SphincsPlus-sha2-192s-r3.1") {
557✔
29
      return {Sphincs_Parameter_Set::Sphincs192Small, Sphincs_Hash_Type::Sha256};
23✔
30
   }
31
   if(name == "SphincsPlus-sha2-192f-r3.1") {
534✔
32
      return {Sphincs_Parameter_Set::Sphincs192Fast, Sphincs_Hash_Type::Sha256};
23✔
33
   }
34
   if(name == "SphincsPlus-sha2-256s-r3.1") {
511✔
35
      return {Sphincs_Parameter_Set::Sphincs256Small, Sphincs_Hash_Type::Sha256};
23✔
36
   }
37
   if(name == "SphincsPlus-sha2-256f-r3.1") {
488✔
38
      return {Sphincs_Parameter_Set::Sphincs256Fast, Sphincs_Hash_Type::Sha256};
23✔
39
   }
40

41
   if(name == "SphincsPlus-shake-128s-r3.1") {
465✔
42
      return {Sphincs_Parameter_Set::Sphincs128Small, Sphincs_Hash_Type::Shake256};
23✔
43
   }
44
   if(name == "SphincsPlus-shake-128f-r3.1") {
442✔
45
      return {Sphincs_Parameter_Set::Sphincs128Fast, Sphincs_Hash_Type::Shake256};
24✔
46
   }
47
   if(name == "SphincsPlus-shake-192s-r3.1") {
418✔
48
      return {Sphincs_Parameter_Set::Sphincs192Small, Sphincs_Hash_Type::Shake256};
23✔
49
   }
50
   if(name == "SphincsPlus-shake-192f-r3.1") {
395✔
51
      return {Sphincs_Parameter_Set::Sphincs192Fast, Sphincs_Hash_Type::Shake256};
23✔
52
   }
53
   if(name == "SphincsPlus-shake-256s-r3.1") {
372✔
54
      return {Sphincs_Parameter_Set::Sphincs256Small, Sphincs_Hash_Type::Shake256};
23✔
55
   }
56
   if(name == "SphincsPlus-shake-256f-r3.1") {
349✔
57
      return {Sphincs_Parameter_Set::Sphincs256Fast, Sphincs_Hash_Type::Shake256};
23✔
58
   }
59

60
   if(name == "SphincsPlus-haraka-128s-r3.1") {
326✔
61
      return {Sphincs_Parameter_Set::Sphincs128Small, Sphincs_Hash_Type::Haraka};
×
62
   }
63
   if(name == "SphincsPlus-haraka-128f-r3.1") {
326✔
64
      return {Sphincs_Parameter_Set::Sphincs128Fast, Sphincs_Hash_Type::Haraka};
×
65
   }
66
   if(name == "SphincsPlus-haraka-192s-r3.1") {
326✔
67
      return {Sphincs_Parameter_Set::Sphincs192Small, Sphincs_Hash_Type::Haraka};
×
68
   }
69
   if(name == "SphincsPlus-haraka-192f-r3.1") {
326✔
70
      return {Sphincs_Parameter_Set::Sphincs192Fast, Sphincs_Hash_Type::Haraka};
×
71
   }
72
   if(name == "SphincsPlus-haraka-256s-r3.1") {
326✔
73
      return {Sphincs_Parameter_Set::Sphincs256Small, Sphincs_Hash_Type::Haraka};
×
74
   }
75
   if(name == "SphincsPlus-haraka-256f-r3.1") {
326✔
76
      return {Sphincs_Parameter_Set::Sphincs256Fast, Sphincs_Hash_Type::Haraka};
×
77
   }
78

79
   // SLH-DSA instances WITHOUT prehash mode
80
   if(name == "SLH-DSA-SHA2-128s") {
326✔
81
      return {Sphincs_Parameter_Set::SLHDSA128Small, Sphincs_Hash_Type::Sha256};
24✔
82
   }
83
   if(name == "SLH-DSA-SHA2-128f") {
302✔
84
      return {Sphincs_Parameter_Set::SLHDSA128Fast, Sphincs_Hash_Type::Sha256};
45✔
85
   }
86
   if(name == "SLH-DSA-SHA2-192s") {
257✔
87
      return {Sphincs_Parameter_Set::SLHDSA192Small, Sphincs_Hash_Type::Sha256};
24✔
88
   }
89
   if(name == "SLH-DSA-SHA2-192f") {
233✔
90
      return {Sphincs_Parameter_Set::SLHDSA192Fast, Sphincs_Hash_Type::Sha256};
24✔
91
   }
92
   if(name == "SLH-DSA-SHA2-256s") {
209✔
93
      return {Sphincs_Parameter_Set::SLHDSA256Small, Sphincs_Hash_Type::Sha256};
24✔
94
   }
95
   if(name == "SLH-DSA-SHA2-256f") {
185✔
96
      return {Sphincs_Parameter_Set::SLHDSA256Fast, Sphincs_Hash_Type::Sha256};
24✔
97
   }
98

99
   if(name == "SLH-DSA-SHAKE-128s") {
161✔
100
      return {Sphincs_Parameter_Set::SLHDSA128Small, Sphincs_Hash_Type::Shake256};
36✔
101
   }
102
   if(name == "SLH-DSA-SHAKE-128f") {
125✔
103
      return {Sphincs_Parameter_Set::SLHDSA128Fast, Sphincs_Hash_Type::Shake256};
29✔
104
   }
105
   if(name == "SLH-DSA-SHAKE-192s") {
96✔
106
      return {Sphincs_Parameter_Set::SLHDSA192Small, Sphincs_Hash_Type::Shake256};
24✔
107
   }
108
   if(name == "SLH-DSA-SHAKE-192f") {
72✔
109
      return {Sphincs_Parameter_Set::SLHDSA192Fast, Sphincs_Hash_Type::Shake256};
24✔
110
   }
111
   if(name == "SLH-DSA-SHAKE-256s") {
48✔
112
      return {Sphincs_Parameter_Set::SLHDSA256Small, Sphincs_Hash_Type::Shake256};
24✔
113
   }
114
   if(name == "SLH-DSA-SHAKE-256f") {
24✔
115
      return {Sphincs_Parameter_Set::SLHDSA256Fast, Sphincs_Hash_Type::Shake256};
24✔
116
   }
117

118
   // SLH-DSA instances WITH prehash mode
119
   if(name == "Hash-SLH-DSA-SHA2-128s-with-SHA256") {
×
120
      return {Sphincs_Parameter_Set::SLHDSA128Small, Sphincs_Hash_Type::Sha256};
×
121
   }
122
   if(name == "Hash-SLH-DSA-SHA2-128f-with-SHA256") {
×
123
      return {Sphincs_Parameter_Set::SLHDSA128Fast, Sphincs_Hash_Type::Sha256};
×
124
   }
125
   if(name == "Hash-SLH-DSA-SHA2-192s-with-SHA512") {
×
126
      return {Sphincs_Parameter_Set::SLHDSA192Small, Sphincs_Hash_Type::Sha256};
×
127
   }
128
   if(name == "Hash-SLH-DSA-SHA2-192f-with-SHA512") {
×
129
      return {Sphincs_Parameter_Set::SLHDSA192Fast, Sphincs_Hash_Type::Sha256};
×
130
   }
131
   if(name == "Hash-SLH-DSA-SHA2-256s-with-SHA512") {
×
132
      return {Sphincs_Parameter_Set::SLHDSA256Small, Sphincs_Hash_Type::Sha256};
×
133
   }
134
   if(name == "Hash-SLH-DSA-SHA2-256f-with-SHA512") {
×
135
      return {Sphincs_Parameter_Set::SLHDSA256Fast, Sphincs_Hash_Type::Sha256};
×
136
   }
137

138
   if(name == "Hash-SLH-DSA-SHAKE-128s-with-SHAKE128") {
×
139
      return {Sphincs_Parameter_Set::SLHDSA128Small, Sphincs_Hash_Type::Shake256};
×
140
   }
141
   if(name == "Hash-SLH-DSA-SHAKE-128f-with-SHAKE128") {
×
142
      return {Sphincs_Parameter_Set::SLHDSA128Fast, Sphincs_Hash_Type::Shake256};
×
143
   }
144
   if(name == "Hash-SLH-DSA-SHAKE-192s-with-SHAKE256") {
×
145
      return {Sphincs_Parameter_Set::SLHDSA192Small, Sphincs_Hash_Type::Shake256};
×
146
   }
147
   if(name == "Hash-SLH-DSA-SHAKE-192f-with-SHAKE256") {
×
148
      return {Sphincs_Parameter_Set::SLHDSA192Fast, Sphincs_Hash_Type::Shake256};
×
149
   }
150
   if(name == "Hash-SLH-DSA-SHAKE-256s-with-SHAKE256") {
×
151
      return {Sphincs_Parameter_Set::SLHDSA256Small, Sphincs_Hash_Type::Shake256};
×
152
   }
153
   if(name == "Hash-SLH-DSA-SHAKE-256f-with-SHAKE256") {
×
154
      return {Sphincs_Parameter_Set::SLHDSA256Fast, Sphincs_Hash_Type::Shake256};
×
155
   }
156

157
   throw Lookup_Error(fmt("No SLH-DSA (or SPHINCS+) parameter supported for: {}", name));
×
158
}
159

160
std::string name_from_set_and_hash(Sphincs_Parameter_Set set, Sphincs_Hash_Type hash) {
720✔
161
   if(hash == Sphincs_Hash_Type::Sha256) {
720✔
162
      switch(set) {
379✔
163
         case Sphincs_Parameter_Set::Sphincs128Small:
27✔
164
            return "SphincsPlus-sha2-128s-r3.1";
27✔
165
         case Sphincs_Parameter_Set::Sphincs128Fast:
30✔
166
            return "SphincsPlus-sha2-128f-r3.1";
30✔
167
         case Sphincs_Parameter_Set::Sphincs192Small:
27✔
168
            return "SphincsPlus-sha2-192s-r3.1";
27✔
169
         case Sphincs_Parameter_Set::Sphincs192Fast:
27✔
170
            return "SphincsPlus-sha2-192f-r3.1";
27✔
171
         case Sphincs_Parameter_Set::Sphincs256Small:
27✔
172
            return "SphincsPlus-sha2-256s-r3.1";
27✔
173
         case Sphincs_Parameter_Set::Sphincs256Fast:
27✔
174
            return "SphincsPlus-sha2-256f-r3.1";
27✔
175

176
         case Sphincs_Parameter_Set::SLHDSA128Small:
28✔
177
            return "SLH-DSA-SHA2-128s";
28✔
178
         case Sphincs_Parameter_Set::SLHDSA128Fast:
74✔
179
            return "SLH-DSA-SHA2-128f";
74✔
180
         case Sphincs_Parameter_Set::SLHDSA192Small:
28✔
181
            return "SLH-DSA-SHA2-192s";
28✔
182
         case Sphincs_Parameter_Set::SLHDSA192Fast:
28✔
183
            return "SLH-DSA-SHA2-192f";
28✔
184
         case Sphincs_Parameter_Set::SLHDSA256Small:
28✔
185
            return "SLH-DSA-SHA2-256s";
28✔
186
         case Sphincs_Parameter_Set::SLHDSA256Fast:
28✔
187
            return "SLH-DSA-SHA2-256f";
28✔
188
      }
189
   }
190

191
   if(hash == Sphincs_Hash_Type::Shake256) {
341✔
192
      switch(set) {
341✔
193
         case Sphincs_Parameter_Set::Sphincs128Small:
27✔
194
            return "SphincsPlus-shake-128s-r3.1";
27✔
195
         case Sphincs_Parameter_Set::Sphincs128Fast:
30✔
196
            return "SphincsPlus-shake-128f-r3.1";
30✔
197
         case Sphincs_Parameter_Set::Sphincs192Small:
27✔
198
            return "SphincsPlus-shake-192s-r3.1";
27✔
199
         case Sphincs_Parameter_Set::Sphincs192Fast:
27✔
200
            return "SphincsPlus-shake-192f-r3.1";
27✔
201
         case Sphincs_Parameter_Set::Sphincs256Small:
27✔
202
            return "SphincsPlus-shake-256s-r3.1";
27✔
203
         case Sphincs_Parameter_Set::Sphincs256Fast:
27✔
204
            return "SphincsPlus-shake-256f-r3.1";
27✔
205

206
         case Sphincs_Parameter_Set::SLHDSA128Small:
32✔
207
            return "SLH-DSA-SHAKE-128s";
32✔
208
         case Sphincs_Parameter_Set::SLHDSA128Fast:
32✔
209
            return "SLH-DSA-SHAKE-128f";
32✔
210
         case Sphincs_Parameter_Set::SLHDSA192Small:
28✔
211
            return "SLH-DSA-SHAKE-192s";
28✔
212
         case Sphincs_Parameter_Set::SLHDSA192Fast:
28✔
213
            return "SLH-DSA-SHAKE-192f";
28✔
214
         case Sphincs_Parameter_Set::SLHDSA256Small:
28✔
215
            return "SLH-DSA-SHAKE-256s";
28✔
216
         case Sphincs_Parameter_Set::SLHDSA256Fast:
28✔
217
            return "SLH-DSA-SHAKE-256f";
28✔
218
      }
219
   }
220

221
   if(hash == Sphincs_Hash_Type::Haraka) {
×
222
      switch(set) {
×
223
         case Sphincs_Parameter_Set::Sphincs128Small:
×
224
            return "SphincsPlus-haraka-128s-r3.1";
×
225
         case Sphincs_Parameter_Set::Sphincs128Fast:
×
226
            return "SphincsPlus-haraka-128f-r3.1";
×
227
         case Sphincs_Parameter_Set::Sphincs192Small:
×
228
            return "SphincsPlus-haraka-192s-r3.1";
×
229
         case Sphincs_Parameter_Set::Sphincs192Fast:
×
230
            return "SphincsPlus-haraka-192f-r3.1";
×
231
         case Sphincs_Parameter_Set::Sphincs256Small:
×
232
            return "SphincsPlus-haraka-256s-r3.1";
×
233
         case Sphincs_Parameter_Set::Sphincs256Fast:
×
234
            return "SphincsPlus-haraka-256f-r3.1";
×
235

236
         case Sphincs_Parameter_Set::SLHDSA128Small:
×
237
         case Sphincs_Parameter_Set::SLHDSA128Fast:
×
238
         case Sphincs_Parameter_Set::SLHDSA192Small:
×
239
         case Sphincs_Parameter_Set::SLHDSA192Fast:
×
240
         case Sphincs_Parameter_Set::SLHDSA256Small:
×
241
         case Sphincs_Parameter_Set::SLHDSA256Fast:
×
242
            throw Invalid_Argument("SLH-DSA does not support Haraka");
×
243
      }
244
   }
245
   throw Invalid_Argument("Cannot serialize invalid parameter combination");
×
246
}
247

248
constexpr bool is_slh_dsa_set(Sphincs_Parameter_Set set) {
2,572✔
249
   switch(set) {
×
250
      case Sphincs_Parameter_Set::SLHDSA128Small:
251
      case Sphincs_Parameter_Set::SLHDSA128Fast:
252
      case Sphincs_Parameter_Set::SLHDSA192Small:
253
      case Sphincs_Parameter_Set::SLHDSA192Fast:
254
      case Sphincs_Parameter_Set::SLHDSA256Small:
255
      case Sphincs_Parameter_Set::SLHDSA256Fast:
256
         return true;
257
      case Sphincs_Parameter_Set::Sphincs128Small:
866✔
258
      case Sphincs_Parameter_Set::Sphincs128Fast:
866✔
259
      case Sphincs_Parameter_Set::Sphincs192Small:
866✔
260
      case Sphincs_Parameter_Set::Sphincs192Fast:
866✔
261
      case Sphincs_Parameter_Set::Sphincs256Small:
866✔
262
      case Sphincs_Parameter_Set::Sphincs256Fast:
866✔
263
         return false;
568✔
264
   }
265
   BOTAN_ASSERT_UNREACHABLE();
×
266
}
267

268
}  // namespace
269

270
Sphincs_Parameters::Sphincs_Parameters(Sphincs_Parameter_Set set,
604✔
271
                                       Sphincs_Hash_Type hash_type,
272
                                       uint32_t n,
273
                                       uint32_t h,
274
                                       uint32_t d,
275
                                       uint32_t a,
276
                                       uint32_t k,
277
                                       uint32_t w,
278
                                       uint32_t bitsec) :
604✔
279
      m_set(set), m_hash_type(hash_type), m_n(n), m_h(h), m_d(d), m_a(a), m_k(k), m_w(w), m_bitsec(bitsec) {
604✔
280
   BOTAN_ARG_CHECK(!(hash_type == Sphincs_Hash_Type::Haraka && is_slh_dsa_set(set)),
604✔
281
                   "Haraka is not available for SLH-DSA");
282
   BOTAN_ARG_CHECK(w == 4 || w == 16 || w == 256, "Winternitz parameter must be one of 4, 16, 256");
604✔
283
   BOTAN_ARG_CHECK(n == 16 || n == 24 || n == 32, "n must be one of 16, 24, 32");
604✔
284
   BOTAN_ARG_CHECK(m_d > 0, "d must be greater than zero");
604✔
285

286
   m_xmss_tree_height = m_h / m_d;
604✔
287
   m_lg_w = ceil_log2(m_w);
604✔
288

289
   // base_2^b algorithm (Fips 205, Algorithm 4) only works
290
   // when m_log_w is a divisor of 8.
291
   BOTAN_ASSERT_NOMSG(m_lg_w <= 8 && 8 % m_lg_w == 0);
604✔
292

293
   // # Winternitz blocks of the message (len_1 of FIPS 205, Algorithm 1)
294
   m_wots_len1 = (m_n * 8) / m_lg_w;
604✔
295

296
   // # Winternitz blocks of the checksum (output of FIPS 205 Algorithm 1)
297
   m_wots_len2 = ceil_log2(m_wots_len1 * (m_w - 1)) / m_lg_w + 1;
604✔
298

299
   // # Winternitz blocks in the signature (len of FIPS 205, Equation 5.4)
300
   m_wots_len = m_wots_len1 + m_wots_len2;
604✔
301

302
   // byte length of WOTS+ signature as well as public key
303
   m_wots_bytes = m_wots_len * m_n;
604✔
304

305
   // # of bytes the WOTS+ checksum consists of
306
   m_wots_checksum_bytes = ceil_tobytes(m_wots_len2 * m_lg_w);
604✔
307

308
   m_fors_sig_bytes = (m_a + 1) * m_k * m_n;
604✔
309

310
   // byte length of the FORS input message
311
   m_fors_message_bytes = ceil_tobytes(m_k * m_a);
604✔
312

313
   m_xmss_sig_bytes = m_wots_bytes + m_xmss_tree_height * m_n;
604✔
314
   m_ht_sig_bytes = m_d * m_xmss_sig_bytes;
604✔
315
   m_sp_sig_bytes = m_n /* random */ + m_fors_sig_bytes + m_ht_sig_bytes;
604✔
316

317
   m_tree_digest_bytes = ceil_tobytes(m_h - m_xmss_tree_height);
604✔
318
   m_leaf_digest_bytes = ceil_tobytes(m_xmss_tree_height);
604✔
319
   m_h_msg_digest_bytes = m_fors_message_bytes + m_tree_digest_bytes + m_leaf_digest_bytes;
604✔
320
}
604✔
321

322
bool Sphincs_Parameters::is_available() const {
788✔
323
   [[maybe_unused]] const bool is_slh_dsa = is_slh_dsa_set(m_set);
788✔
324
#ifdef BOTAN_HAS_SLH_DSA_WITH_SHA2
325
   if(is_slh_dsa && m_hash_type == Sphincs_Hash_Type::Sha256) {
490✔
326
      return true;
327
   }
328
#endif
329
#ifdef BOTAN_HAS_SLH_DSA_WITH_SHAKE
330
   if(is_slh_dsa && m_hash_type == Sphincs_Hash_Type::Shake256) {
231✔
331
      return true;
231✔
332
   }
333
#endif
334
#ifdef BOTAN_HAS_SPHINCS_PLUS_WITH_SHA2
335
   if(!is_slh_dsa && m_hash_type == Sphincs_Hash_Type::Sha256) {
298✔
336
      return true;
337
   }
338
#endif
339
#ifdef BOTAN_HAS_SPHINCS_PLUS_WITH_SHAKE
340
   if(!is_slh_dsa && m_hash_type == Sphincs_Hash_Type::Shake256) {
149✔
341
      return true;
149✔
342
   }
343
#endif
344
   return false;
345
}
346

347
Sphincs_Parameters Sphincs_Parameters::create(
604✔
348
   Sphincs_Parameter_Set set, Sphincs_Hash_Type hash /*, SlhDsaInputMode input_mode [TODO: prehash mode]*/) {
349
   // See FIPS 205, Table 2
350
   switch(set) {
604✔
351
      case Sphincs_Parameter_Set::Sphincs128Small:
106✔
352
      case Sphincs_Parameter_Set::SLHDSA128Small:
106✔
353
         return Sphincs_Parameters(set, hash, 16, 63, 7, 12, 14, 16, 133);
106✔
354
      case Sphincs_Parameter_Set::Sphincs128Fast:
122✔
355
      case Sphincs_Parameter_Set::SLHDSA128Fast:
122✔
356
         return Sphincs_Parameters(set, hash, 16, 66, 22, 6, 33, 16, 128);
122✔
357

358
      case Sphincs_Parameter_Set::Sphincs192Small:
94✔
359
      case Sphincs_Parameter_Set::SLHDSA192Small:
94✔
360
         return Sphincs_Parameters(set, hash, 24, 63, 7, 14, 17, 16, 193);
94✔
361
      case Sphincs_Parameter_Set::Sphincs192Fast:
94✔
362
      case Sphincs_Parameter_Set::SLHDSA192Fast:
94✔
363
         return Sphincs_Parameters(set, hash, 24, 66, 22, 8, 33, 16, 194);
94✔
364

365
      case Sphincs_Parameter_Set::Sphincs256Small:
94✔
366
      case Sphincs_Parameter_Set::SLHDSA256Small:
94✔
367
         return Sphincs_Parameters(set, hash, 32, 64, 8, 14, 22, 16, 255);
94✔
368
      case Sphincs_Parameter_Set::Sphincs256Fast:
94✔
369
      case Sphincs_Parameter_Set::SLHDSA256Fast:
94✔
370
         return Sphincs_Parameters(set, hash, 32, 68, 17, 9, 35, 16, 255);
94✔
371
   }
372
   BOTAN_ASSERT_UNREACHABLE();
×
373
}
374

375
Sphincs_Parameters Sphincs_Parameters::create(std::string_view name) {
604✔
376
   auto [param_set, hash_type] = set_and_hash_from_name(name);
604✔
377
   return Sphincs_Parameters::create(param_set, hash_type);
604✔
378
}
379

380
bool Sphincs_Parameters::is_slh_dsa() const {
1,784✔
381
   return is_slh_dsa_set(m_set);
1,784✔
382
}
383

384
std::string Sphincs_Parameters::hash_name() const {
×
385
   switch(m_hash_type) {
×
386
      case Sphincs_Hash_Type::Sha256:
×
387
         return "SHA-256";
×
388
      case Sphincs_Hash_Type::Shake256:
×
389
         return fmt("SHAKE-256({})", 8 * n());
×
390
      case Sphincs_Hash_Type::Haraka:
×
391
         return "Haraka";
×
392
   }
393
   BOTAN_ASSERT_UNREACHABLE();
×
394
}
395

396
std::string Sphincs_Parameters::to_string() const {
720✔
397
   return name_from_set_and_hash(parameter_set(), hash_type());
720✔
398
}
399

400
Sphincs_Parameters Sphincs_Parameters::create(const OID& oid) {
374✔
401
   return Sphincs_Parameters::create(oid.to_formatted_string());
748✔
402
}
403

404
OID Sphincs_Parameters::object_identifier() const {
696✔
405
   return OID::from_string(to_string());
1,392✔
406
}
407

408
AlgorithmIdentifier Sphincs_Parameters::algorithm_identifier() const {
533✔
409
   return AlgorithmIdentifier(object_identifier(), AlgorithmIdentifier::USE_EMPTY_PARAM);
533✔
410
}
411

412
}  // namespace Botan
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc