Add EVP_KDF-X942 to the fips module
[openssl.git] / include / openssl / core_names.h
1 /*
2  * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 #ifndef OPENSSL_CORE_NAMES_H
11 # define OPENSSL_CORE_NAMES_H
12
13 # ifdef __cplusplus
14 extern "C" {
15 # endif
16
17 /* Well known parameter names that core passes to providers */
18 #define OSSL_PROV_PARAM_CORE_VERSION         "openssl-version" /* utf8_ptr */
19 #define OSSL_PROV_PARAM_CORE_PROV_NAME       "provider-name"   /* utf8_ptr */
20 #define OSSL_PROV_PARAM_CORE_MODULE_FILENAME "module-filename" /* utf8_ptr */
21
22 /* Well known parameter names that Providers can define */
23 #define OSSL_PROV_PARAM_NAME            "name"                /* utf8_string */
24 #define OSSL_PROV_PARAM_VERSION         "version"             /* utf8_string */
25 #define OSSL_PROV_PARAM_BUILDINFO       "buildinfo"           /* utf8_string */
26 #define OSSL_PROV_PARAM_STATUS          "status"              /* uint */
27 #define OSSL_PROV_PARAM_SECURITY_CHECKS "security-checks"     /* uint */
28
29 /* Self test callback parameters */
30 #define OSSL_PROV_PARAM_SELF_TEST_PHASE  "st-phase" /* utf8_string */
31 #define OSSL_PROV_PARAM_SELF_TEST_TYPE   "st-type"  /* utf8_string */
32 #define OSSL_PROV_PARAM_SELF_TEST_DESC   "st-desc"  /* utf8_string */
33
34 /*-
35  * Provider-native object abstractions
36  *
37  * These are used when a provider wants to pass object data or an object
38  * reference back to libcrypto.  This is only useful for provider functions
39  * that take a callback to which an OSSL_PARAM array with these parameters
40  * can be passed.
41  *
42  * This set of parameter names is explained in detail in provider-object(7)
43  * (doc/man7/provider-object.pod)
44  */
45 #define OSSL_OBJECT_PARAM_TYPE              "type"      /* INTEGER */
46 #define OSSL_OBJECT_PARAM_DATA_TYPE         "data-type" /* UTF8_STRING */
47 #define OSSL_OBJECT_PARAM_DATA_STRUCTURE    "data-structure" /* UTF8_STRING */
48 #define OSSL_OBJECT_PARAM_REFERENCE         "reference" /* OCTET_STRING */
49 #define OSSL_OBJECT_PARAM_DATA              "data" /* OCTET_STRING or UTF8_STRING */
50 #define OSSL_OBJECT_PARAM_DESC              "desc"      /* UTF8_STRING */
51
52 /*
53  * Algorithm parameters
54  * If "engine" or "properties" are specified, they should always be paired
55  * with the algorithm type.
56  * Note these are common names that are shared by many types (such as kdf, mac,
57  * and pkey) e.g: see OSSL_MAC_PARAM_DIGEST below.
58  */
59 #define OSSL_ALG_PARAM_DIGEST       "digest"    /* utf8_string */
60 #define OSSL_ALG_PARAM_CIPHER       "cipher"    /* utf8_string */
61 #define OSSL_ALG_PARAM_ENGINE       "engine"    /* utf8_string */
62 #define OSSL_ALG_PARAM_MAC          "mac"       /* utf8_string */
63 #define OSSL_ALG_PARAM_PROPERTIES   "properties"/* utf8_string */
64
65 /* cipher parameters */
66 #define OSSL_CIPHER_PARAM_PADDING              "padding"      /* uint */
67 #define OSSL_CIPHER_PARAM_TLS_VERSION          "tls-version"  /* uint */
68 #define OSSL_CIPHER_PARAM_TLS_MAC              "tls-mac"      /* octet_ptr */
69 #define OSSL_CIPHER_PARAM_TLS_MAC_SIZE         "tls-mac-size" /* size_t */
70 #define OSSL_CIPHER_PARAM_MODE                 "mode"         /* uint */
71 #define OSSL_CIPHER_PARAM_BLOCK_SIZE           "blocksize"    /* size_t */
72 #define OSSL_CIPHER_PARAM_FLAGS                "flags"        /* ulong */
73 #define OSSL_CIPHER_PARAM_KEYLEN               "keylen"       /* size_t */
74 #define OSSL_CIPHER_PARAM_IVLEN                "ivlen"        /* size_t */
75 #define OSSL_CIPHER_PARAM_IV                   "iv"           /* octet_string OR octet_ptr */
76 #define OSSL_CIPHER_PARAM_IV_STATE             "iv-state"     /* octet_string OR octet_ptr */
77 #define OSSL_CIPHER_PARAM_NUM                  "num"          /* uint */
78 #define OSSL_CIPHER_PARAM_ROUNDS               "rounds"       /* uint */
79 #define OSSL_CIPHER_PARAM_AEAD_TAG             "tag"          /* octet_string */
80 #define OSSL_CIPHER_PARAM_AEAD_TLS1_AAD        "tlsaad"       /* octet_string */
81 #define OSSL_CIPHER_PARAM_AEAD_TLS1_AAD_PAD    "tlsaadpad"    /* size_t */
82 #define OSSL_CIPHER_PARAM_AEAD_TLS1_IV_FIXED   "tlsivfixed"   /* octet_string */
83 #define OSSL_CIPHER_PARAM_AEAD_TLS1_GET_IV_GEN "tlsivgen"     /* octet_string */
84 #define OSSL_CIPHER_PARAM_AEAD_TLS1_SET_IV_INV "tlsivinv"     /* octet_string */
85 #define OSSL_CIPHER_PARAM_AEAD_IVLEN           OSSL_CIPHER_PARAM_IVLEN
86 #define OSSL_CIPHER_PARAM_AEAD_TAGLEN          "taglen"       /* size_t */
87 #define OSSL_CIPHER_PARAM_AEAD_MAC_KEY         "mackey"       /* octet_string */
88 #define OSSL_CIPHER_PARAM_RANDOM_KEY           "randkey"      /* octet_string */
89 #define OSSL_CIPHER_PARAM_RC2_KEYBITS          "keybits"      /* size_t */
90 #define OSSL_CIPHER_PARAM_SPEED                "speed"        /* uint */
91 #define OSSL_CIPHER_PARAM_CTS_MODE             "cts_mode"     /* utf8_string */
92 /* For passing the AlgorithmIdentifier parameter in DER form */
93 #define OSSL_CIPHER_PARAM_ALG_ID               "alg_id_param" /* octet_string */
94
95 #define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_SEND_FRAGMENT                    \
96     "tls1multi_maxsndfrag" /* uint */
97 #define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_MAX_BUFSIZE                          \
98     "tls1multi_maxbufsz"   /* size_t */
99 #define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_INTERLEAVE                           \
100     "tls1multi_interleave" /* uint */
101 #define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD                                  \
102     "tls1multi_aad"        /* octet_string */
103 #define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_AAD_PACKLEN                          \
104     "tls1multi_aadpacklen" /* uint */
105 #define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC                                  \
106     "tls1multi_enc"        /* octet_string */
107 #define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_IN                               \
108     "tls1multi_encin"      /* octet_string */
109 #define OSSL_CIPHER_PARAM_TLS1_MULTIBLOCK_ENC_LEN                              \
110     "tls1multi_enclen"     /* size_t */
111
112 /* OSSL_CIPHER_PARAM_CTS_MODE Values */
113 #define OSSL_CIPHER_CTS_MODE_CS1 "CS1"
114 #define OSSL_CIPHER_CTS_MODE_CS2 "CS2"
115 #define OSSL_CIPHER_CTS_MODE_CS3 "CS3"
116
117 /* digest parameters */
118 #define OSSL_DIGEST_PARAM_XOFLEN     "xoflen"    /* size_t */
119 #define OSSL_DIGEST_PARAM_SSL3_MS    "ssl3-ms"   /* octet string */
120 #define OSSL_DIGEST_PARAM_PAD_TYPE   "pad_type"  /* uint */
121 #define OSSL_DIGEST_PARAM_MICALG     "micalg"    /* utf8 string */
122 #define OSSL_DIGEST_PARAM_BLOCK_SIZE "blocksize" /* size_t */
123 #define OSSL_DIGEST_PARAM_SIZE       "size"      /* size_t */
124 #define OSSL_DIGEST_PARAM_FLAGS      "flags"     /* ulong */
125
126 /* Known DIGEST names (not a complete list) */
127 #define OSSL_DIGEST_NAME_MD5            "MD5"
128 #define OSSL_DIGEST_NAME_MD5_SHA1       "MD5-SHA1"
129 #define OSSL_DIGEST_NAME_SHA1           "SHA1"
130 #define OSSL_DIGEST_NAME_SHA2_224       "SHA2-224"
131 #define OSSL_DIGEST_NAME_SHA2_256       "SHA2-256"
132 #define OSSL_DIGEST_NAME_SHA2_384       "SHA2-384"
133 #define OSSL_DIGEST_NAME_SHA2_512       "SHA2-512"
134 #define OSSL_DIGEST_NAME_SHA2_512_224   "SHA2-512/224"
135 #define OSSL_DIGEST_NAME_SHA2_512_256   "SHA2-512/256"
136 #define OSSL_DIGEST_NAME_MD2            "MD2"
137 #define OSSL_DIGEST_NAME_MD4            "MD4"
138 #define OSSL_DIGEST_NAME_MDC2           "MDC2"
139 #define OSSL_DIGEST_NAME_RIPEMD160      "RIPEMD160"
140 #define OSSL_DIGEST_NAME_SHA3_224       "SHA3-224"
141 #define OSSL_DIGEST_NAME_SHA3_256       "SHA3-256"
142 #define OSSL_DIGEST_NAME_SHA3_384       "SHA3-384"
143 #define OSSL_DIGEST_NAME_SHA3_512       "SHA3-512"
144 #define OSSL_DIGEST_NAME_KECCAK_KMAC128 "KECCAK-KMAC-128"
145 #define OSSL_DIGEST_NAME_KECCAK_KMAC256 "KECCAK-KMAC-256"
146 #define OSSL_DIGEST_NAME_SM3            "SM3"
147
148 /* MAC parameters */
149 #define OSSL_MAC_PARAM_KEY          "key"        /* octet string */
150 #define OSSL_MAC_PARAM_IV           "iv"         /* octet string */
151 #define OSSL_MAC_PARAM_CUSTOM       "custom"     /* utf8 string */
152 #define OSSL_MAC_PARAM_SALT         "salt"       /* octet string */
153 #define OSSL_MAC_PARAM_XOF          "xof"        /* int, 0 or 1 */
154 #define OSSL_MAC_PARAM_FLAGS        "flags"      /* int */
155 /*
156  * If "engine" or "properties" are specified, they should always be paired
157  * with "cipher" or "digest".
158  */
159 #define OSSL_MAC_PARAM_CIPHER           OSSL_ALG_PARAM_CIPHER     /* utf8 string */
160 #define OSSL_MAC_PARAM_DIGEST           OSSL_ALG_PARAM_DIGEST     /* utf8 string */
161 #define OSSL_MAC_PARAM_PROPERTIES       OSSL_ALG_PARAM_PROPERTIES /* utf8 string */
162 #define OSSL_MAC_PARAM_SIZE             "size"                    /* size_t */
163 #define OSSL_MAC_PARAM_TLS_DATA_SIZE    "tls-data-size"           /* size_t */
164
165 /* Known MAC names */
166 #define OSSL_MAC_NAME_BLAKE2BMAC    "BLAKE2BMAC"
167 #define OSSL_MAC_NAME_BLAKE2SMAC    "BLAKE2SMAC"
168 #define OSSL_MAC_NAME_CMAC          "CMAC"
169 #define OSSL_MAC_NAME_GMAC          "GMAC"
170 #define OSSL_MAC_NAME_HMAC          "HMAC"
171 #define OSSL_MAC_NAME_KMAC128       "KMAC128"
172 #define OSSL_MAC_NAME_KMAC256       "KMAC256"
173 #define OSSL_MAC_NAME_POLY1305      "POLY1305"
174 #define OSSL_MAC_NAME_SIPHASH       "SIPHASH"
175
176 /* KDF / PRF parameters */
177 #define OSSL_KDF_PARAM_SECRET       "secret"    /* octet string */
178 #define OSSL_KDF_PARAM_KEY          "key"       /* octet string */
179 #define OSSL_KDF_PARAM_SALT         "salt"      /* octet string */
180 #define OSSL_KDF_PARAM_PASSWORD     "pass"      /* octet string */
181 #define OSSL_KDF_PARAM_DIGEST       OSSL_ALG_PARAM_DIGEST     /* utf8 string */
182 #define OSSL_KDF_PARAM_CIPHER       OSSL_ALG_PARAM_CIPHER     /* utf8 string */
183 #define OSSL_KDF_PARAM_MAC          OSSL_ALG_PARAM_MAC        /* utf8 string */
184 #define OSSL_KDF_PARAM_MAC_SIZE     "maclen"    /* size_t */
185 #define OSSL_KDF_PARAM_PROPERTIES   OSSL_ALG_PARAM_PROPERTIES /* utf8 string */
186 #define OSSL_KDF_PARAM_ITER         "iter"      /* unsigned int */
187 #define OSSL_KDF_PARAM_MODE         "mode"      /* utf8 string or int */
188 #define OSSL_KDF_PARAM_PKCS5        "pkcs5"     /* int */
189 #define OSSL_KDF_PARAM_UKM          "ukm"       /* octet string */
190 #define OSSL_KDF_PARAM_CEK_ALG      "cekalg"    /* utf8 string */
191 #define OSSL_KDF_PARAM_SCRYPT_N     "n"         /* uint64_t */
192 #define OSSL_KDF_PARAM_SCRYPT_R     "r"         /* uint32_t */
193 #define OSSL_KDF_PARAM_SCRYPT_P     "p"         /* uint32_t */
194 #define OSSL_KDF_PARAM_SCRYPT_MAXMEM "maxmem_bytes" /* uint64_t */
195 #define OSSL_KDF_PARAM_INFO         "info"      /* octet string */
196 #define OSSL_KDF_PARAM_SEED         "seed"      /* octet string */
197 #define OSSL_KDF_PARAM_SSHKDF_XCGHASH "xcghash" /* octet string */
198 #define OSSL_KDF_PARAM_SSHKDF_SESSION_ID "session_id" /* octet string */
199 #define OSSL_KDF_PARAM_SSHKDF_TYPE  "type"      /* int */
200 #define OSSL_KDF_PARAM_SIZE         "size"      /* size_t */
201 #define OSSL_KDF_PARAM_CIPHER       OSSL_ALG_PARAM_CIPHER     /* utf8 string */
202 #define OSSL_KDF_PARAM_CONSTANT     "constant"  /* octet string */
203 #define OSSL_KDF_PARAM_PKCS12_ID    "id"        /* int */
204 #define OSSL_KDF_PARAM_KBKDF_USE_L  "use-l"             /* int */
205 #define OSSL_KDF_PARAM_KBKDF_USE_SEPARATOR  "use-separator"     /* int */
206 #define OSSL_KDF_PARAM_X942_PARTYUINFO      "partyu-info"
207 #define OSSL_KDF_PARAM_X942_PARTYVINFO      "partyv-info"
208 #define OSSL_KDF_PARAM_X942_SUPP_PUBINFO    "supp-pubinfo"
209 #define OSSL_KDF_PARAM_X942_SUPP_PRIVINFO   "supp-privinfo"
210 #define OSSL_KDF_PARAM_X942_USE_KEYBITS     "use-keybits"
211
212 /* Known KDF names */
213 #define OSSL_KDF_NAME_HKDF           "HKDF"
214 #define OSSL_KDF_NAME_PBKDF2         "PBKDF2"
215 #define OSSL_KDF_NAME_SCRYPT         "SCRYPT"
216 #define OSSL_KDF_NAME_SSHKDF         "SSHKDF"
217 #define OSSL_KDF_NAME_SSKDF          "SSKDF"
218 #define OSSL_KDF_NAME_TLS1_PRF       "TLS1-PRF"
219 #define OSSL_KDF_NAME_X942KDF_ASN1   "X942KDF-ASN1"
220 #define OSSL_KDF_NAME_X942KDF_CONCAT "X942KDF-CONCAT"
221 #define OSSL_KDF_NAME_X963KDF        "X963KDF"
222 #define OSSL_KDF_NAME_KBKDF          "KBKDF"
223 #define OSSL_KDF_NAME_KRB5KDF        "KRB5KDF"
224
225 /* Known RAND names */
226 #define OSSL_RAND_PARAM_STATE                   "state"
227 #define OSSL_RAND_PARAM_STRENGTH                "strength"
228 #define OSSL_RAND_PARAM_MAX_REQUEST             "max_request"
229 #define OSSL_RAND_PARAM_TEST_ENTROPY            "test_entropy"
230 #define OSSL_RAND_PARAM_TEST_NONCE              "test_nonce"
231
232 /* RAND/DRBG names */
233 #define OSSL_DRBG_PARAM_RESEED_REQUESTS         "reseed_requests"
234 #define OSSL_DRBG_PARAM_RESEED_TIME_INTERVAL    "reseed_time_interval"
235 #define OSSL_DRBG_PARAM_MIN_ENTROPYLEN          "min_entropylen"
236 #define OSSL_DRBG_PARAM_MAX_ENTROPYLEN          "max_entropylen"
237 #define OSSL_DRBG_PARAM_MIN_NONCELEN            "min_noncelen"
238 #define OSSL_DRBG_PARAM_MAX_NONCELEN            "max_noncelen"
239 #define OSSL_DRBG_PARAM_MAX_PERSLEN             "max_perslen"
240 #define OSSL_DRBG_PARAM_MAX_ADINLEN             "max_adinlen"
241 #define OSSL_DRBG_PARAM_RESEED_COUNTER          "reseed_counter"
242 #define OSSL_DRBG_PARAM_RESEED_TIME             "reseed_time"
243 #define OSSL_DRBG_PARAM_PROPERTIES              OSSL_ALG_PARAM_PROPERTIES
244 #define OSSL_DRBG_PARAM_DIGEST                  OSSL_ALG_PARAM_DIGEST
245 #define OSSL_DRBG_PARAM_CIPHER                  OSSL_ALG_PARAM_CIPHER
246 #define OSSL_DRBG_PARAM_MAC                     OSSL_ALG_PARAM_MAC
247 #define OSSL_DRBG_PARAM_USE_DF                  "use_derivation_function"
248
249 /* DRBG call back parameters */
250 #define OSSL_DRBG_PARAM_ENTROPY_REQUIRED        "entropy_required"
251 #define OSSL_DRBG_PARAM_PREDICTION_RESISTANCE   "prediction_resistance"
252 #define OSSL_DRBG_PARAM_MIN_LENGTH              "minium_length"
253 #define OSSL_DRBG_PARAM_MAX_LENGTH              "maxium_length"
254 #define OSSL_DRBG_PARAM_RANDOM_DATA             "random_data"
255 #define OSSL_DRBG_PARAM_SIZE                    "size"
256
257 /* PKEY parameters */
258 /* Common PKEY parameters */
259 #define OSSL_PKEY_PARAM_BITS                "bits" /* integer */
260 #define OSSL_PKEY_PARAM_MAX_SIZE            "max-size" /* integer */
261 #define OSSL_PKEY_PARAM_SECURITY_BITS       "security-bits" /* integer */
262 #define OSSL_PKEY_PARAM_DIGEST              OSSL_ALG_PARAM_DIGEST
263 #define OSSL_PKEY_PARAM_CIPHER              OSSL_ALG_PARAM_CIPHER /* utf8 string */
264 #define OSSL_PKEY_PARAM_ENGINE              OSSL_ALG_PARAM_ENGINE /* utf8 string */
265 #define OSSL_PKEY_PARAM_PROPERTIES          OSSL_ALG_PARAM_PROPERTIES
266 #define OSSL_PKEY_PARAM_DEFAULT_DIGEST      "default-digest" /* utf8 string */
267 #define OSSL_PKEY_PARAM_MANDATORY_DIGEST    "mandatory-digest" /* utf8 string */
268 #define OSSL_PKEY_PARAM_PAD_MODE            "pad-mode"
269 #define OSSL_PKEY_PARAM_DIGEST_SIZE         "digest-size"
270 #define OSSL_PKEY_PARAM_MASKGENFUNC         "mgf"
271 #define OSSL_PKEY_PARAM_MGF1_DIGEST         "mgf1-digest"
272 #define OSSL_PKEY_PARAM_MGF1_PROPERTIES     "mgf1-properties"
273 #define OSSL_PKEY_PARAM_ENCODED_PUBLIC_KEY  "encoded-pub-key"
274 #define OSSL_PKEY_PARAM_GROUP_NAME          "group"
275 #define OSSL_PKEY_PARAM_DIST_ID             "distid"
276 #define OSSL_PKEY_PARAM_PUB_KEY             "pub"
277 #define OSSL_PKEY_PARAM_PRIV_KEY            "priv"
278
279 /* Diffie-Hellman/DSA Parameters */
280 #define OSSL_PKEY_PARAM_FFC_P               "p"
281 #define OSSL_PKEY_PARAM_FFC_G               "g"
282 #define OSSL_PKEY_PARAM_FFC_Q               "q"
283 #define OSSL_PKEY_PARAM_FFC_GINDEX          "gindex"
284 #define OSSL_PKEY_PARAM_FFC_PCOUNTER        "pcounter"
285 #define OSSL_PKEY_PARAM_FFC_SEED            "seed"
286 #define OSSL_PKEY_PARAM_FFC_COFACTOR        "j"
287 #define OSSL_PKEY_PARAM_FFC_H               "hindex"
288 #define OSSL_PKEY_PARAM_FFC_VALIDATE_TYPE   "valid-type"
289
290 /* Diffie-Hellman/DSA Parameters parameter validation types */
291 #define OSSL_FFC_PARAM_VALIDATE_PQ          "validate-pq"
292 #define OSSL_FFC_PARAM_VALIDATE_G           "validate-g"
293 #define OSSL_FFC_PARAM_VALIDATE_PQG         "validate-pqg"
294
295 /* Diffie-Hellman params */
296 #define OSSL_PKEY_PARAM_DH_GENERATOR        "safeprime-generator"
297 #define OSSL_PKEY_PARAM_DH_PRIV_LEN         "priv_len"
298
299 /* Elliptic Curve Domain Parameters */
300 #define OSSL_PKEY_PARAM_EC_PUB_X     "qx"
301 #define OSSL_PKEY_PARAM_EC_PUB_Y     "qy"
302
303 /* Elliptic Curve Explicit Domain Parameters */
304 #define OSSL_PKEY_PARAM_EC_FIELD_TYPE     "field-type"
305 #define OSSL_PKEY_PARAM_EC_P              "p"
306 #define OSSL_PKEY_PARAM_EC_A              "a"
307 #define OSSL_PKEY_PARAM_EC_B              "b"
308 #define OSSL_PKEY_PARAM_EC_GENERATOR      "generator"
309 #define OSSL_PKEY_PARAM_EC_ORDER          "order"
310 #define OSSL_PKEY_PARAM_EC_COFACTOR       "cofactor"
311 #define OSSL_PKEY_PARAM_EC_SEED           "seed"
312 #define OSSL_PKEY_PARAM_EC_CHAR2_M        "m"
313 #define OSSL_PKEY_PARAM_EC_CHAR2_TYPE     "basis-type"
314 #define OSSL_PKEY_PARAM_EC_CHAR2_TP_BASIS "tp"
315 #define OSSL_PKEY_PARAM_EC_CHAR2_PP_K1    "k1"
316 #define OSSL_PKEY_PARAM_EC_CHAR2_PP_K2    "k2"
317 #define OSSL_PKEY_PARAM_EC_CHAR2_PP_K3    "k3"
318
319 /* Elliptic Curve Key Parameters */
320 #define OSSL_PKEY_PARAM_USE_COFACTOR_FLAG "use-cofactor-flag"
321 #define OSSL_PKEY_PARAM_USE_COFACTOR_ECDH \
322     OSSL_PKEY_PARAM_USE_COFACTOR_FLAG
323
324 /* RSA Keys */
325 /*
326  * n, e, d are the usual public and private key components
327  *
328  * rsa-num is the number of factors, including p and q
329  * rsa-factor is used for each factor: p, q, r_i (i = 3, ...)
330  * rsa-exponent is used for each exponent: dP, dQ, d_i (i = 3, ...)
331  * rsa-coefficient is used for each coefficient: qInv, t_i (i = 3, ...)
332  *
333  * The number of rsa-factor items must be equal to the number of rsa-exponent
334  * items, and the number of rsa-coefficients must be one less.
335  * (the base i for the coefficients is 2, not 1, at least as implied by
336  * RFC 8017)
337  */
338 #define OSSL_PKEY_PARAM_RSA_N           "n"
339 #define OSSL_PKEY_PARAM_RSA_E           "e"
340 #define OSSL_PKEY_PARAM_RSA_D           "d"
341 #define OSSL_PKEY_PARAM_RSA_FACTOR      "rsa-factor"
342 #define OSSL_PKEY_PARAM_RSA_EXPONENT    "rsa-exponent"
343 #define OSSL_PKEY_PARAM_RSA_COEFFICIENT "rsa-coefficient"
344 #define OSSL_PKEY_PARAM_RSA_FACTOR1      OSSL_PKEY_PARAM_RSA_FACTOR"1"
345 #define OSSL_PKEY_PARAM_RSA_FACTOR2      OSSL_PKEY_PARAM_RSA_FACTOR"2"
346 #define OSSL_PKEY_PARAM_RSA_FACTOR3      OSSL_PKEY_PARAM_RSA_FACTOR"3"
347 #define OSSL_PKEY_PARAM_RSA_FACTOR4      OSSL_PKEY_PARAM_RSA_FACTOR"4"
348 #define OSSL_PKEY_PARAM_RSA_FACTOR5      OSSL_PKEY_PARAM_RSA_FACTOR"5"
349 #define OSSL_PKEY_PARAM_RSA_FACTOR6      OSSL_PKEY_PARAM_RSA_FACTOR"6"
350 #define OSSL_PKEY_PARAM_RSA_FACTOR7      OSSL_PKEY_PARAM_RSA_FACTOR"7"
351 #define OSSL_PKEY_PARAM_RSA_FACTOR8      OSSL_PKEY_PARAM_RSA_FACTOR"8"
352 #define OSSL_PKEY_PARAM_RSA_FACTOR9      OSSL_PKEY_PARAM_RSA_FACTOR"9"
353 #define OSSL_PKEY_PARAM_RSA_FACTOR10     OSSL_PKEY_PARAM_RSA_FACTOR"10"
354 #define OSSL_PKEY_PARAM_RSA_EXPONENT1    OSSL_PKEY_PARAM_RSA_EXPONENT"1"
355 #define OSSL_PKEY_PARAM_RSA_EXPONENT2    OSSL_PKEY_PARAM_RSA_EXPONENT"2"
356 #define OSSL_PKEY_PARAM_RSA_EXPONENT3    OSSL_PKEY_PARAM_RSA_EXPONENT"3"
357 #define OSSL_PKEY_PARAM_RSA_EXPONENT4    OSSL_PKEY_PARAM_RSA_EXPONENT"4"
358 #define OSSL_PKEY_PARAM_RSA_EXPONENT5    OSSL_PKEY_PARAM_RSA_EXPONENT"5"
359 #define OSSL_PKEY_PARAM_RSA_EXPONENT6    OSSL_PKEY_PARAM_RSA_EXPONENT"6"
360 #define OSSL_PKEY_PARAM_RSA_EXPONENT7    OSSL_PKEY_PARAM_RSA_EXPONENT"7"
361 #define OSSL_PKEY_PARAM_RSA_EXPONENT8    OSSL_PKEY_PARAM_RSA_EXPONENT"8"
362 #define OSSL_PKEY_PARAM_RSA_EXPONENT9    OSSL_PKEY_PARAM_RSA_EXPONENT"9"
363 #define OSSL_PKEY_PARAM_RSA_EXPONENT10   OSSL_PKEY_PARAM_RSA_EXPONENT"10"
364 #define OSSL_PKEY_PARAM_RSA_COEFFICIENT1 OSSL_PKEY_PARAM_RSA_COEFFICIENT"1"
365 #define OSSL_PKEY_PARAM_RSA_COEFFICIENT2 OSSL_PKEY_PARAM_RSA_COEFFICIENT"2"
366 #define OSSL_PKEY_PARAM_RSA_COEFFICIENT3 OSSL_PKEY_PARAM_RSA_COEFFICIENT"3"
367 #define OSSL_PKEY_PARAM_RSA_COEFFICIENT4 OSSL_PKEY_PARAM_RSA_COEFFICIENT"4"
368 #define OSSL_PKEY_PARAM_RSA_COEFFICIENT5 OSSL_PKEY_PARAM_RSA_COEFFICIENT"5"
369 #define OSSL_PKEY_PARAM_RSA_COEFFICIENT6 OSSL_PKEY_PARAM_RSA_COEFFICIENT"6"
370 #define OSSL_PKEY_PARAM_RSA_COEFFICIENT7 OSSL_PKEY_PARAM_RSA_COEFFICIENT"7"
371 #define OSSL_PKEY_PARAM_RSA_COEFFICIENT8 OSSL_PKEY_PARAM_RSA_COEFFICIENT"8"
372 #define OSSL_PKEY_PARAM_RSA_COEFFICIENT9 OSSL_PKEY_PARAM_RSA_COEFFICIENT"9"
373
374 /* RSA padding modes */
375 #define OSSL_PKEY_RSA_PAD_MODE_NONE    "none"
376 #define OSSL_PKEY_RSA_PAD_MODE_PKCSV15 "pkcs1"
377 #define OSSL_PKEY_RSA_PAD_MODE_SSLV23  "sslv23"
378 #define OSSL_PKEY_RSA_PAD_MODE_OAEP    "oaep"
379 #define OSSL_PKEY_RSA_PAD_MODE_X931    "x931"
380 #define OSSL_PKEY_RSA_PAD_MODE_PSS     "pss"
381
382 /* RSA pss padding salt length */
383 #define OSSL_PKEY_RSA_PSS_SALT_LEN_DIGEST "digest"
384 #define OSSL_PKEY_RSA_PSS_SALT_LEN_MAX    "max"
385 #define OSSL_PKEY_RSA_PSS_SALT_LEN_AUTO   "auto"
386
387 /* Key generation parameters */
388 #define OSSL_PKEY_PARAM_RSA_BITS            OSSL_PKEY_PARAM_BITS
389 #define OSSL_PKEY_PARAM_RSA_PRIMES          "primes"
390 #define OSSL_PKEY_PARAM_RSA_DIGEST          OSSL_PKEY_PARAM_DIGEST
391 #define OSSL_PKEY_PARAM_RSA_DIGEST_PROPS    OSSL_PKEY_PARAM_PROPERTIES
392 #define OSSL_PKEY_PARAM_RSA_MASKGENFUNC     OSSL_PKEY_PARAM_MASKGENFUNC
393 #define OSSL_PKEY_PARAM_RSA_MGF1_DIGEST     OSSL_PKEY_PARAM_MGF1_DIGEST
394 #define OSSL_PKEY_PARAM_RSA_PSS_SALTLEN     "saltlen"
395
396 /* Key generation parameters */
397 #define OSSL_PKEY_PARAM_FFC_TYPE         "type"
398 #define OSSL_PKEY_PARAM_FFC_PBITS        "pbits"
399 #define OSSL_PKEY_PARAM_FFC_QBITS        "qbits"
400 #define OSSL_PKEY_PARAM_FFC_DIGEST       OSSL_PKEY_PARAM_DIGEST
401 #define OSSL_PKEY_PARAM_FFC_DIGEST_PROPS OSSL_PKEY_PARAM_PROPERTIES
402
403 #define OSSL_PKEY_PARAM_EC_ENCODING      "encoding" /* utf8_string */
404
405 /* OSSL_PKEY_PARAM_EC_ENCODING values */
406 #define OSSL_PKEY_EC_ENCODING_EXPLICIT  "explicit"
407 #define OSSL_PKEY_EC_ENCODING_GROUP     "named_curve"
408
409 /* Key Exchange parameters */
410 #define OSSL_EXCHANGE_PARAM_PAD                   "pad" /* uint */
411 #define OSSL_EXCHANGE_PARAM_EC_ECDH_COFACTOR_MODE "ecdh-cofactor-mode" /* int */
412 #define OSSL_EXCHANGE_PARAM_KDF_TYPE              "kdf-type" /* utf8_string */
413 #define OSSL_EXCHANGE_PARAM_KDF_DIGEST            "kdf-digest" /* utf8_string */
414 #define OSSL_EXCHANGE_PARAM_KDF_DIGEST_PROPS      "kdf-digest-props" /* utf8_string */
415 #define OSSL_EXCHANGE_PARAM_KDF_OUTLEN            "kdf-outlen" /* size_t */
416
417 /*
418  * TODO(3.0): improve this pattern
419  *
420  * Currently the sole internal user of OSSL_EXCHANGE_PARAM_KDF_UKM is
421  * EVP_PKEY_CTX_{set0,get0}_ecdh_kdf_ukm():
422  *      OSSL_EXCHANGE_PARAM_KDF_UKM is handled as a octet_string on set0,
423  *      and as an octet_ptr on get0.
424  *
425  * This pattern is borrowed from the handling of
426  * OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL in
427  * EVP_PKEY_CTX_{set0,get0}_rsa_oaep_label().
428  */
429 #define OSSL_EXCHANGE_PARAM_KDF_UKM               "kdf-ukm" /* see note above */
430 #define OSSL_EXCHANGE_PARAM_KDF_UKM_LEN           "kdf-ukm-len" /* size_t */
431
432 /* Signature parameters */
433 #define OSSL_SIGNATURE_PARAM_ALGORITHM_ID       "algorithm-id"
434 #define OSSL_SIGNATURE_PARAM_PAD_MODE           OSSL_PKEY_PARAM_PAD_MODE
435 #define OSSL_SIGNATURE_PARAM_DIGEST             OSSL_PKEY_PARAM_DIGEST
436 #define OSSL_SIGNATURE_PARAM_PROPERTIES         OSSL_PKEY_PARAM_PROPERTIES
437 #define OSSL_SIGNATURE_PARAM_PSS_SALTLEN        "saltlen"
438 #define OSSL_SIGNATURE_PARAM_MGF1_DIGEST        OSSL_PKEY_PARAM_MGF1_DIGEST
439 #define OSSL_SIGNATURE_PARAM_MGF1_PROPERTIES    \
440     OSSL_PKEY_PARAM_MGF1_PROPERTIES
441 #define OSSL_SIGNATURE_PARAM_DIGEST_SIZE        OSSL_PKEY_PARAM_DIGEST_SIZE
442
443 /* Asym cipher parameters */
444 #define OSSL_ASYM_CIPHER_PARAM_DIGEST                   OSSL_PKEY_PARAM_DIGEST
445 #define OSSL_ASYM_CIPHER_PARAM_PROPERTIES               OSSL_PKEY_PARAM_PROPERTIES
446 #define OSSL_ASYM_CIPHER_PARAM_ENGINE                   OSSL_PKEY_PARAM_ENGINE
447 #define OSSL_ASYM_CIPHER_PARAM_PAD_MODE                 OSSL_PKEY_PARAM_PAD_MODE
448 #define OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST              \
449     OSSL_PKEY_PARAM_MGF1_DIGEST
450 #define OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS        \
451     OSSL_PKEY_PARAM_MGF1_PROPERTIES
452 #define OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST              OSSL_ALG_PARAM_DIGEST
453 #define OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS        "digest-props"
454 #define OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL               "oaep-label"
455 #define OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL_LEN           "oaep-label-len"
456 #define OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION       "tls-client-version"
457 #define OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION   "tls-negotiated-version"
458
459 /*
460  * Encoder / decoder parameters
461  */
462 #define OSSL_ENCODER_PARAM_CIPHER           OSSL_ALG_PARAM_CIPHER
463 #define OSSL_ENCODER_PARAM_PROPERTIES       OSSL_ALG_PARAM_PROPERTIES
464 #define OSSL_ENCODER_PARAM_INPUT_TYPE       "input-type"
465 #define OSSL_ENCODER_PARAM_OUTPUT_TYPE      "output-type"
466 #define OSSL_ENCODER_PARAM_OUTPUT_STRUCTURE "output-structure"
467
468 #define OSSL_DECODER_PARAM_PROPERTIES       OSSL_ALG_PARAM_PROPERTIES
469 #define OSSL_DECODER_PARAM_INPUT_TYPE       "input-type"
470 #define OSSL_DECODER_PARAM_INPUT_STRUCTURE  "input-structure"
471
472 /* Passphrase callback parameters */
473 #define OSSL_PASSPHRASE_PARAM_INFO      "info"
474
475 /* Keygen callback parameters, from provider to libcrypto */
476 #define OSSL_GEN_PARAM_POTENTIAL            "potential" /* integer */
477 #define OSSL_GEN_PARAM_ITERATION            "iteration" /* integer */
478
479 /* ACVP Test parameters : These should not be used normally */
480 #define OSSL_PKEY_PARAM_RSA_TEST_XP1 "xp1"
481 #define OSSL_PKEY_PARAM_RSA_TEST_XP2 "xp2"
482 #define OSSL_PKEY_PARAM_RSA_TEST_XP  "xp"
483 #define OSSL_PKEY_PARAM_RSA_TEST_XQ1 "xq1"
484 #define OSSL_PKEY_PARAM_RSA_TEST_XQ2 "xq2"
485 #define OSSL_PKEY_PARAM_RSA_TEST_XQ  "xq"
486 #define OSSL_PKEY_PARAM_RSA_TEST_P1  "p1"
487 #define OSSL_PKEY_PARAM_RSA_TEST_P2  "p2"
488 #define OSSL_PKEY_PARAM_RSA_TEST_Q1  "q1"
489 #define OSSL_PKEY_PARAM_RSA_TEST_Q2  "q2"
490 #define OSSL_SIGNATURE_PARAM_KAT "kat"
491
492 /* KEM parameters */
493 #define OSSL_KEM_PARAM_OPERATION            "operation"
494
495 /* OSSL_KEM_PARAM_OPERATION values */
496 #define OSSL_KEM_PARAM_OPERATION_RSASVE     "RSASVE"
497
498 /* Capabilities */
499
500 /* TLS-GROUP Capability */
501 #define OSSL_CAPABILITY_TLS_GROUP_NAME              "tls-group-name"
502 #define OSSL_CAPABILITY_TLS_GROUP_NAME_INTERNAL     "tls-group-name-internal"
503 #define OSSL_CAPABILITY_TLS_GROUP_ID                "tls-group-id"
504 #define OSSL_CAPABILITY_TLS_GROUP_ALG               "tls-group-alg"
505 #define OSSL_CAPABILITY_TLS_GROUP_SECURITY_BITS     "tls-group-sec-bits"
506 #define OSSL_CAPABILITY_TLS_GROUP_IS_KEM            "tls-group-is-kem"
507 #define OSSL_CAPABILITY_TLS_GROUP_MIN_TLS           "tls-min-tls"
508 #define OSSL_CAPABILITY_TLS_GROUP_MAX_TLS           "tls-max-tls"
509 #define OSSL_CAPABILITY_TLS_GROUP_MIN_DTLS          "tls-min-dtls"
510 #define OSSL_CAPABILITY_TLS_GROUP_MAX_DTLS          "tls-max-dtls"
511
512 /*-
513  * storemgmt parameters
514  */
515
516 /*
517  * Used by storemgmt_ctx_set_params():
518  *
519  * - OSSL_STORE_PARAM_EXPECT is an INTEGER, and the value is any of the
520  *   OSSL_STORE_INFO numbers.  This is used to set the expected type of
521  *   object loaded.
522  *
523  * - OSSL_STORE_PARAM_SUBJECT, OSSL_STORE_PARAM_ISSUER,
524  *   OSSL_STORE_PARAM_SERIAL, OSSL_STORE_PARAM_FINGERPRINT,
525  *   OSSL_STORE_PARAM_DIGEST, OSSL_STORE_PARAM_ALIAS
526  *   are used as search criteria.
527  *   (OSSL_STORE_PARAM_DIGEST is used with OSSL_STORE_PARAM_FINGERPRINT)
528  */
529 #define OSSL_STORE_PARAM_EXPECT     "expect"       /* INTEGER */
530 #define OSSL_STORE_PARAM_SUBJECT    "subject" /* DER blob => OCTET_STRING */
531 #define OSSL_STORE_PARAM_ISSUER     "name" /* DER blob => OCTET_STRING */
532 #define OSSL_STORE_PARAM_SERIAL     "serial"       /* INTEGER */
533 #define OSSL_STORE_PARAM_DIGEST     "digest"       /* UTF8_STRING */
534 #define OSSL_STORE_PARAM_FINGERPRINT "fingerprint" /* OCTET_STRING */
535 #define OSSL_STORE_PARAM_ALIAS      "alias"        /* UTF8_STRING */
536
537 /* You may want to pass properties for the provider implementation to use */
538 #define OSSL_STORE_PARAM_PROPERTIES "properties"   /* utf8_string */
539
540 # ifdef __cplusplus
541 }
542 # endif
543
544 #endif