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