1 =pod 2 3 =head1 NAME 4 5 EVP_PKEY-SLH-DSA, EVP_KEYMGMT-SLH-DSA, 6 EVP_PKEY-SLH-DSA-SHA2-128s, EVP_PKEY-SLH-DSA-SHA2-128f, 7 EVP_PKEY-SLH-DSA-SHA2-192s, EVP_PKEY-SLH-DSA-SHA2-192f, 8 EVP_PKEY-SLH-DSA-SHA2-256s, EVP_PKEY-SLH-DSA-SHA2-256f, 9 EVP_PKEY-SLH-DSA-SHAKE-128s, EVP_PKEY-SLH-DSA-SHAKE-128f, 10 EVP_PKEY-SLH-DSA-SHAKE-192s, EVP_PKEY-SLH-DSA-SHAKE-192f, 11 EVP_PKEY-SLH-DSA-SHAKE-256s, EVP_PKEY-SLH-DSA-SHAKE-256f 12 - EVP_PKEY SLH-DSA keytype and algorithm support 13 14 =head1 DESCRIPTION 15 16 The B<SLH-DSA-SHA2-128s>, B<EVP_PKEY-SLH-DSA-SHA2-128f>, 17 B<SLH-DSA-SHA2-192s>, B<EVP_PKEY-SLH-DSA-SHA2-192f>, 18 B<SLH-DSA-SHA2-256s>, B<EVP_PKEY-SLH-DSA-SHA2-256f>, 19 B<SLH-DSA-SHAKE-128s>, B<EVP_PKEY-SLH-DSA-SHAKE-128f>, 20 B<SLH-DSA-SHAKE-192s>, B<EVP_PKEY-SLH-DSA-SHAKE-192f>, 21 B<SLH-DSA-SHAKE-256s> and B<EVP_PKEY-SLH-DSA-SHAKE-256f> key types are 22 implemented in OpenSSL's default and FIPS providers. These implementations 23 support the associated key, containing the public key I<pub> and the 24 private key I<priv>. 25 26 SLH-DSA (Stateless Hash-based Digital Signature Standard) uses small keys, 27 but has relatively large signatures and is relatively slow performing all 28 operations compared to B<ML-DSA>. It does however have proven security proofs, 29 since it relies only on hash functions. 30 31 Each of the different key types has an associated security parameter B<n>. 32 This value is one of 16, 24 or 32 for key types B<SLH-DSA*128*>, B<SLH-DSA*192*> 33 and B<SLH-DSA*256*>, respectively. 34 35 Both the public and private key components contain 2 elements of size B<n>. 36 Key generation generates the private key elements and one of the public key 37 elements randomly, and the final public key element is computed from these values. 38 39 The public key has relatively small sizes of 32, 48 or 64 bytes, 40 corresponding to the algorithm names of 128, 192 and 256 respectively. 41 42 The algorithms ending with B<s> produce smaller signatures, but are much slower 43 than the faster B<f> variants. 44 45 The signature sizes for the B<s> algorithm variants are 7856, 16224 and 29792 46 which correspond to the algorithm names of 128s, 192s and 256s respectively. 47 The signature sizes for the B<f> algorithm variants are 17088, 35664 and 49856 48 which correspond to the algorithm names containing 128f, 192f and 256f respectively. 49 50 Internally there are 7 hash related functions that are used for each algorithm. 51 For algorithms containing B<SHAKE> in their name B<SHAKE-256> is used for all 52 functions. 53 For the <SHA2-128> algorithms the functions use <MGF1-SHA-256>, <HMAC-SHA-256> 54 and <SHA-256>. 55 The remaining <SHA2> algorithms use <MGF1-SHA-512>, <HMAC-SHA-512>, <SHA-256> and 56 <SHA-512>. 57 See FIPS 205 Section 11.1 and 11.2 for more information. 58 59 =head2 Keygen Parameters 60 61 =over 4 62 63 =item "seed" (B<OSSL_PKEY_PARAM_SLH_DSA_SEED>) <octet string> 64 65 Supplies values to use for the private seed, private prf and 66 public seed instead of generating random values. This is used for testing 67 purposes only. The length of the value supplied must be 3 * B<n>. 68 69 =item "properties" (B<OSSL_PKEY_PARAM_PROPERTIES>) <utf8_string> 70 71 Sets properties to be used when fetching algorithm implementations used for 72 SLH-DSA hashing operations. 73 74 =back 75 76 Use EVP_PKEY_CTX_set_params() after calling EVP_PKEY_keygen_init(). 77 78 =head2 Common SLH-DSA parameters 79 80 In addition to the common parameters that all keytypes should support (see 81 L<provider-keymgmt(7)/Common Information Parameters>), the implementation of 82 these key types support the following. 83 84 The following parameters are gettable using EVP_PKEY_get_octet_string_param(), 85 and settable when using EVP_PKEY_fromdata(). 86 87 =over 4 88 89 =item "pub" (B<OSSL_PKEY_PARAM_PUB_KEY>) <octet string> 90 91 The public key has a size of 2 * B<n> bytes. 92 i.e. It consists of the concatenation of PK.seed and PK.root 93 as defined by FIPS 205 Figure 16. 94 95 =item "priv" (B<OSSL_PKEY_PARAM_PRIV_KEY>) <octet string> 96 97 The private key has a size of 4 * B<n> bytes, which includes the public key components. 98 i.e. It consists of the concatenation of SK.seed, SK.prf, PK.seed and PF.root 99 as defined by FIPS 205 Figure 15. 100 101 =item "mandatory-digest" (B<OSSL_PKEY_PARAM_MANDATORY_DIGEST>) <UTF8 string> 102 103 The empty string, signifying that no digest may be specified. 104 105 =back 106 107 =head1 CONFORMING TO 108 109 =over 4 110 111 =item FIPS 205 112 113 =back 114 115 =head1 EXAMPLES 116 117 An B<EVP_PKEY> context can be obtained by calling: 118 119 EVP_PKEY_CTX *pctx = 120 EVP_PKEY_CTX_new_from_name(NULL, "SLH-DSA-SHA2-128f", NULL); 121 122 An B<SLH-DSA> key can be generated like this: 123 124 pkey = EVP_PKEY_Q_keygen(NULL, NULL, "SLH-DSA-SHA2-128f"); 125 126 The key pair components can be extracted from a key by calling: 127 128 uint8_t priv[64], pub[32]; 129 size_t priv_len, pub_len; 130 131 EVP_PKEY_get_octet_string_param(pkey, OSSL_PKEY_PARAM_PRIV_KEY, 132 priv, sizeof(priv), &priv_len); 133 EVP_PKEY_get_octet_string_param(pkey, OSSL_PKEY_PARAM_PUB_KEY, 134 pub, sizeof(pub), &pub_len)); 135 136 Similar code can be used for the other key types such as "SLH-DSA-SHAKE-256f". 137 138 =head1 SEE ALSO 139 140 L<EVP_KEYMGMT(3)>, L<EVP_PKEY(3)>, L<provider-keymgmt(7)>, 141 L<EVP_SIGNATURE-SLH-DSA(7)> 142 143 =head1 HISTORY 144 145 This functionality was added in OpenSSL 3.5. 146 147 =head1 COPYRIGHT 148 149 Copyright 2024-2025 The OpenSSL Project Authors. All Rights Reserved. 150 151 Licensed under the Apache License 2.0 (the "License"). You may not use 152 this file except in compliance with the License. You can obtain a copy 153 in the file LICENSE in the source distribution or at 154 L<https://www.openssl.org/source/license.html>. 155 156 =cut 157