2 * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
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
11 * RSA low level APIs are deprecated for public use, but still ok for
14 #include "internal/deprecated.h"
16 #include <openssl/core_numbers.h>
17 #include <openssl/core_names.h>
18 #include <openssl/bn.h>
19 #include <openssl/err.h>
20 #include <openssl/rsa.h>
21 #include <openssl/evp.h>
22 #include "prov/implementations.h"
23 #include "prov/providercommon.h"
24 #include "prov/provider_ctx.h"
25 #include "crypto/rsa.h"
26 #include "internal/param_build_set.h"
28 static OSSL_OP_keymgmt_new_fn rsa_newdata
;
29 static OSSL_OP_keymgmt_new_fn rsapss_newdata
;
30 static OSSL_OP_keymgmt_gen_init_fn rsa_gen_init
;
31 static OSSL_OP_keymgmt_gen_init_fn rsapss_gen_init
;
32 static OSSL_OP_keymgmt_gen_set_params_fn rsa_gen_set_params
;
33 static OSSL_OP_keymgmt_gen_settable_params_fn rsa_gen_settable_params
;
34 static OSSL_OP_keymgmt_gen_settable_params_fn rsapss_gen_settable_params
;
35 static OSSL_OP_keymgmt_gen_fn rsa_gen
;
36 static OSSL_OP_keymgmt_gen_cleanup_fn rsa_gen_cleanup
;
37 static OSSL_OP_keymgmt_free_fn rsa_freedata
;
38 static OSSL_OP_keymgmt_get_params_fn rsa_get_params
;
39 static OSSL_OP_keymgmt_gettable_params_fn rsa_gettable_params
;
40 static OSSL_OP_keymgmt_has_fn rsa_has
;
41 static OSSL_OP_keymgmt_match_fn rsa_match
;
42 static OSSL_OP_keymgmt_validate_fn rsa_validate
;
43 static OSSL_OP_keymgmt_import_fn rsa_import
;
44 static OSSL_OP_keymgmt_import_types_fn rsa_import_types
;
45 static OSSL_OP_keymgmt_export_fn rsa_export
;
46 static OSSL_OP_keymgmt_export_types_fn rsa_export_types
;
47 static OSSL_OP_keymgmt_query_operation_name_fn rsapss_query_operation_name
;
49 #define RSA_DEFAULT_MD "SHA256"
50 #define RSA_PSS_DEFAULT_MD OSSL_DIGEST_NAME_SHA1
51 #define RSA_POSSIBLE_SELECTIONS \
52 (OSSL_KEYMGMT_SELECT_KEYPAIR | OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS)
54 DEFINE_STACK_OF(BIGNUM
)
55 DEFINE_SPECIAL_STACK_OF_CONST(BIGNUM_const
, BIGNUM
)
57 static int pss_params_fromdata(RSA_PSS_PARAMS_30
*pss_params
,
58 const OSSL_PARAM params
[], int rsa_type
,
61 if (!rsa_pss_params_30_fromdata(pss_params
, params
, libctx
))
64 /* If not a PSS type RSA, sending us PSS parameters is wrong */
65 if (rsa_type
!= RSA_FLAG_TYPE_RSASSAPSS
66 && !rsa_pss_params_30_is_unrestricted(pss_params
))
72 static void *rsa_newdata(void *provctx
)
74 OPENSSL_CTX
*libctx
= PROV_LIBRARY_CONTEXT_OF(provctx
);
75 RSA
*rsa
= rsa_new_with_ctx(libctx
);
78 RSA_clear_flags(rsa
, RSA_FLAG_TYPE_MASK
);
79 RSA_set_flags(rsa
, RSA_FLAG_TYPE_RSA
);
84 static void *rsapss_newdata(void *provctx
)
86 OPENSSL_CTX
*libctx
= PROV_LIBRARY_CONTEXT_OF(provctx
);
87 RSA
*rsa
= rsa_new_with_ctx(libctx
);
90 RSA_clear_flags(rsa
, RSA_FLAG_TYPE_MASK
);
91 RSA_set_flags(rsa
, RSA_FLAG_TYPE_RSASSAPSS
);
96 static void rsa_freedata(void *keydata
)
101 static int rsa_has(void *keydata
, int selection
)
107 if ((selection
& RSA_POSSIBLE_SELECTIONS
) != 0)
110 if ((selection
& OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS
) != 0)
111 /* This will change with OAEP */
112 ok
= ok
&& (RSA_test_flags(rsa
, RSA_FLAG_TYPE_RSASSAPSS
) != 0);
113 if ((selection
& OSSL_KEYMGMT_SELECT_KEYPAIR
) != 0)
114 ok
= ok
&& (RSA_get0_e(rsa
) != NULL
);
115 if ((selection
& OSSL_KEYMGMT_SELECT_PUBLIC_KEY
) != 0)
116 ok
= ok
&& (RSA_get0_n(rsa
) != NULL
);
117 if ((selection
& OSSL_KEYMGMT_SELECT_PRIVATE_KEY
) != 0)
118 ok
= ok
&& (RSA_get0_d(rsa
) != NULL
);
123 static int rsa_match(const void *keydata1
, const void *keydata2
, int selection
)
125 const RSA
*rsa1
= keydata1
;
126 const RSA
*rsa2
= keydata2
;
129 /* There is always an |e| */
130 ok
= ok
&& BN_cmp(RSA_get0_e(rsa1
), RSA_get0_e(rsa2
)) == 0;
131 if ((selection
& OSSL_KEYMGMT_SELECT_PUBLIC_KEY
) != 0)
132 ok
= ok
&& BN_cmp(RSA_get0_n(rsa1
), RSA_get0_n(rsa2
)) == 0;
133 if ((selection
& OSSL_KEYMGMT_SELECT_PRIVATE_KEY
) != 0)
134 ok
= ok
&& BN_cmp(RSA_get0_d(rsa1
), RSA_get0_d(rsa2
)) == 0;
138 static int rsa_import(void *keydata
, int selection
, const OSSL_PARAM params
[])
147 if ((selection
& RSA_POSSIBLE_SELECTIONS
) == 0)
150 rsa_type
= RSA_test_flags(rsa
, RSA_FLAG_TYPE_MASK
);
152 /* TODO(3.0) OAEP should bring on parameters as well */
154 if ((selection
& OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS
) != 0)
155 ok
= ok
&& pss_params_fromdata(rsa_get0_pss_params_30(rsa
), params
,
156 rsa_type
, rsa_get0_libctx(rsa
));
157 if ((selection
& OSSL_KEYMGMT_SELECT_KEYPAIR
) != 0)
158 ok
= ok
&& rsa_fromdata(rsa
, params
);
163 static int rsa_export(void *keydata
, int selection
,
164 OSSL_CALLBACK
*param_callback
, void *cbarg
)
167 const RSA_PSS_PARAMS_30
*pss_params
= rsa_get0_pss_params_30(rsa
);
168 OSSL_PARAM_BLD
*tmpl
;
169 OSSL_PARAM
*params
= NULL
;
175 /* TODO(3.0) OAEP should bring on parameters */
177 tmpl
= OSSL_PARAM_BLD_new();
181 if ((selection
& OSSL_KEYMGMT_SELECT_OTHER_PARAMETERS
) != 0)
182 ok
= ok
&& (rsa_pss_params_30_is_unrestricted(pss_params
)
183 || rsa_pss_params_30_todata(pss_params
, NULL
, tmpl
, NULL
));
184 if ((selection
& OSSL_KEYMGMT_SELECT_KEYPAIR
) != 0)
185 ok
= ok
&& rsa_todata(rsa
, tmpl
, NULL
);
188 || (params
= OSSL_PARAM_BLD_to_param(tmpl
)) == NULL
)
191 ok
= param_callback(params
, cbarg
);
192 OSSL_PARAM_BLD_free_params(params
);
194 OSSL_PARAM_BLD_free(tmpl
);
199 /* In fips mode there are no multi-primes. */
200 # define RSA_KEY_MP_TYPES() \
201 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_FACTOR1, NULL, 0), \
202 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_FACTOR2, NULL, 0), \
203 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_EXPONENT1, NULL, 0), \
204 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_EXPONENT2, NULL, 0), \
205 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_COEFFICIENT1, NULL, 0),
208 * We allow up to 10 prime factors (starting with p, q).
209 * NOTE: there is only 9 OSSL_PKEY_PARAM_RSA_COEFFICIENT
211 # define RSA_KEY_MP_TYPES() \
212 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_FACTOR1, NULL, 0), \
213 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_FACTOR2, NULL, 0), \
214 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_FACTOR3, NULL, 0), \
215 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_FACTOR4, NULL, 0), \
216 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_FACTOR5, NULL, 0), \
217 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_FACTOR6, NULL, 0), \
218 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_FACTOR7, NULL, 0), \
219 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_FACTOR8, NULL, 0), \
220 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_FACTOR9, NULL, 0), \
221 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_FACTOR10, NULL, 0), \
222 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_EXPONENT1, NULL, 0), \
223 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_EXPONENT2, NULL, 0), \
224 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_EXPONENT3, NULL, 0), \
225 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_EXPONENT4, NULL, 0), \
226 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_EXPONENT5, NULL, 0), \
227 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_EXPONENT6, NULL, 0), \
228 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_EXPONENT7, NULL, 0), \
229 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_EXPONENT8, NULL, 0), \
230 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_EXPONENT9, NULL, 0), \
231 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_EXPONENT10, NULL, 0), \
232 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_COEFFICIENT1, NULL, 0), \
233 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_COEFFICIENT2, NULL, 0), \
234 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_COEFFICIENT3, NULL, 0), \
235 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_COEFFICIENT4, NULL, 0), \
236 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_COEFFICIENT5, NULL, 0), \
237 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_COEFFICIENT6, NULL, 0), \
238 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_COEFFICIENT7, NULL, 0), \
239 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_COEFFICIENT8, NULL, 0), \
240 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_COEFFICIENT9, NULL, 0),
243 #define RSA_KEY_TYPES() \
244 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_N, NULL, 0), \
245 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_E, NULL, 0), \
246 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_D, NULL, 0), \
250 * This provider can export everything in an RSA key, so we use the exact
251 * same type description for export as for import. Other providers might
252 * choose to import full keys, but only export the public parts, and will
253 * therefore have the importkey_types and importkey_types functions return
256 static const OSSL_PARAM rsa_key_types
[] = {
261 * We lied about the amount of factors, exponents and coefficients, the
262 * export and import functions can really deal with an infinite amount
263 * of these numbers. However, RSA keys with too many primes are futile,
264 * so we at least pretend to have some limits.
267 static const OSSL_PARAM
*rsa_imexport_types(int selection
)
269 if ((selection
& OSSL_KEYMGMT_SELECT_KEYPAIR
) != 0)
270 return rsa_key_types
;
274 static const OSSL_PARAM
*rsa_import_types(int selection
)
276 return rsa_imexport_types(selection
);
279 static const OSSL_PARAM
*rsa_export_types(int selection
)
281 return rsa_imexport_types(selection
);
284 static int rsa_get_params(void *key
, OSSL_PARAM params
[])
287 const RSA_PSS_PARAMS_30
*pss_params
= rsa_get0_pss_params_30(rsa
);
288 int rsa_type
= RSA_test_flags(rsa
, RSA_FLAG_TYPE_MASK
);
291 if ((p
= OSSL_PARAM_locate(params
, OSSL_PKEY_PARAM_BITS
)) != NULL
292 && !OSSL_PARAM_set_int(p
, RSA_bits(rsa
)))
294 if ((p
= OSSL_PARAM_locate(params
, OSSL_PKEY_PARAM_SECURITY_BITS
)) != NULL
295 && !OSSL_PARAM_set_int(p
, RSA_security_bits(rsa
)))
297 if ((p
= OSSL_PARAM_locate(params
, OSSL_PKEY_PARAM_MAX_SIZE
)) != NULL
298 && !OSSL_PARAM_set_int(p
, RSA_size(rsa
)))
302 * For RSA-PSS keys, we ignore the default digest request
303 * TODO(3.0) with RSA-OAEP keys, this may need to be amended
305 if ((p
= OSSL_PARAM_locate(params
, OSSL_PKEY_PARAM_DEFAULT_DIGEST
)) != NULL
306 && rsa_type
!= RSA_FLAG_TYPE_RSASSAPSS
) {
307 if (!OSSL_PARAM_set_utf8_string(p
, RSA_DEFAULT_MD
))
312 * For non-RSA-PSS keys, we ignore the mandatory digest request
313 * TODO(3.0) with RSA-OAEP keys, this may need to be amended
315 if ((p
= OSSL_PARAM_locate(params
,
316 OSSL_PKEY_PARAM_MANDATORY_DIGEST
)) != NULL
317 && rsa_type
== RSA_FLAG_TYPE_RSASSAPSS
) {
318 const char *mdname
= RSA_PSS_DEFAULT_MD
;
320 if (!rsa_pss_params_30_is_unrestricted(pss_params
)) {
322 rsa_oaeppss_nid2name(rsa_pss_params_30_hashalg(pss_params
));
324 if (mdname
== NULL
|| !OSSL_PARAM_set_utf8_string(p
, mdname
))
328 return (rsa_type
!= RSA_FLAG_TYPE_RSASSAPSS
329 || rsa_pss_params_30_todata(pss_params
, NULL
, NULL
, params
))
330 && rsa_todata(rsa
, NULL
, params
);
333 static const OSSL_PARAM rsa_params
[] = {
334 OSSL_PARAM_int(OSSL_PKEY_PARAM_BITS
, NULL
),
335 OSSL_PARAM_int(OSSL_PKEY_PARAM_SECURITY_BITS
, NULL
),
336 OSSL_PARAM_int(OSSL_PKEY_PARAM_MAX_SIZE
, NULL
),
337 OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_DEFAULT_DIGEST
, NULL
, 0),
342 static const OSSL_PARAM
*rsa_gettable_params(void)
347 static int rsa_validate(void *keydata
, int selection
)
352 if ((selection
& RSA_POSSIBLE_SELECTIONS
) != 0)
355 /* If the whole key is selected, we do a pairwise validation */
356 if ((selection
& OSSL_KEYMGMT_SELECT_KEYPAIR
)
357 == OSSL_KEYMGMT_SELECT_KEYPAIR
) {
358 ok
= ok
&& rsa_validate_pairwise(rsa
);
360 if ((selection
& OSSL_KEYMGMT_SELECT_PRIVATE_KEY
) != 0)
361 ok
= ok
&& rsa_validate_private(rsa
);
362 if ((selection
& OSSL_KEYMGMT_SELECT_PUBLIC_KEY
) != 0)
363 ok
= ok
&& rsa_validate_public(rsa
);
378 RSA_PSS_PARAMS_30 pss_params
;
380 /* For generation callback */
384 #if defined(FIPS_MODULE) && !defined(OPENSSL_NO_ACVP_TESTS)
385 /* ACVP test parameters */
386 OSSL_PARAM
*acvp_test_params
;
390 static int rsa_gencb(int p
, int n
, BN_GENCB
*cb
)
392 struct rsa_gen_ctx
*gctx
= BN_GENCB_get_arg(cb
);
393 OSSL_PARAM params
[] = { OSSL_PARAM_END
, OSSL_PARAM_END
, OSSL_PARAM_END
};
395 params
[0] = OSSL_PARAM_construct_int(OSSL_GEN_PARAM_POTENTIAL
, &p
);
396 params
[1] = OSSL_PARAM_construct_int(OSSL_GEN_PARAM_ITERATION
, &n
);
397 return gctx
->cb(params
, gctx
->cbarg
);
400 static void *gen_init(void *provctx
, int selection
, int rsa_type
)
402 OPENSSL_CTX
*libctx
= PROV_LIBRARY_CONTEXT_OF(provctx
);
403 struct rsa_gen_ctx
*gctx
= NULL
;
405 if ((selection
& OSSL_KEYMGMT_SELECT_KEYPAIR
) == 0)
408 if ((gctx
= OPENSSL_zalloc(sizeof(*gctx
))) != NULL
) {
409 gctx
->libctx
= libctx
;
410 if ((gctx
->pub_exp
= BN_new()) == NULL
411 || !BN_set_word(gctx
->pub_exp
, RSA_F4
)) {
412 BN_free(gctx
->pub_exp
);
417 gctx
->primes
= RSA_DEFAULT_PRIME_NUM
;
418 gctx
->rsa_type
= rsa_type
;
424 static void *rsa_gen_init(void *provctx
, int selection
)
426 return gen_init(provctx
, selection
, RSA_FLAG_TYPE_RSA
);
429 static void *rsapss_gen_init(void *provctx
, int selection
)
431 return gen_init(provctx
, selection
, RSA_FLAG_TYPE_RSASSAPSS
);
435 * This function is common for all RSA sub-types, to detect possible
436 * misuse, such as PSS parameters being passed when a plain RSA key
439 static int rsa_gen_set_params(void *genctx
, const OSSL_PARAM params
[])
441 struct rsa_gen_ctx
*gctx
= genctx
;
444 if ((p
= OSSL_PARAM_locate_const(params
, OSSL_PKEY_PARAM_RSA_BITS
)) != NULL
445 && !OSSL_PARAM_get_size_t(p
, &gctx
->nbits
))
447 if ((p
= OSSL_PARAM_locate_const(params
, OSSL_PKEY_PARAM_RSA_PRIMES
)) != NULL
448 && !OSSL_PARAM_get_size_t(p
, &gctx
->primes
))
450 if ((p
= OSSL_PARAM_locate_const(params
, OSSL_PKEY_PARAM_RSA_E
)) != NULL
451 && !OSSL_PARAM_get_BN(p
, &gctx
->pub_exp
))
453 /* Only attempt to get PSS parameters when generating an RSA-PSS key */
454 if (gctx
->rsa_type
== RSA_FLAG_TYPE_RSASSAPSS
455 && !pss_params_fromdata(&gctx
->pss_params
, params
, gctx
->rsa_type
,
458 #if defined(FIPS_MODULE) && !defined(OPENSSL_NO_ACVP_TESTS)
459 /* Any ACVP test related parameters are copied into a params[] */
460 if (!rsa_acvp_test_gen_params_new(&gctx
->acvp_test_params
, params
))
466 #define rsa_gen_basic \
467 OSSL_PARAM_size_t(OSSL_PKEY_PARAM_RSA_BITS, NULL), \
468 OSSL_PARAM_size_t(OSSL_PKEY_PARAM_RSA_PRIMES, NULL), \
469 OSSL_PARAM_BN(OSSL_PKEY_PARAM_RSA_E, NULL, 0)
472 * The following must be kept in sync with rsa_pss_params_30_fromdata()
473 * in crypto/rsa/rsa_backend.c
475 #define rsa_gen_pss \
476 OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_RSA_DIGEST, NULL, 0), \
477 OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_RSA_MASKGENFUNC, NULL, 0), \
478 OSSL_PARAM_utf8_string(OSSL_PKEY_PARAM_RSA_MGF1_DIGEST, NULL, 0), \
479 OSSL_PARAM_int(OSSL_PKEY_PARAM_RSA_PSS_SALTLEN, NULL)
481 static const OSSL_PARAM
*rsa_gen_settable_params(void *provctx
)
483 static OSSL_PARAM settable
[] = {
491 static const OSSL_PARAM
*rsapss_gen_settable_params(void *provctx
)
493 static OSSL_PARAM settable
[] = {
502 static void *rsa_gen(void *genctx
, OSSL_CALLBACK
*osslcb
, void *cbarg
)
504 struct rsa_gen_ctx
*gctx
= genctx
;
505 RSA
*rsa
= NULL
, *rsa_tmp
= NULL
;
506 BN_GENCB
*gencb
= NULL
;
511 switch (gctx
->rsa_type
) {
512 case RSA_FLAG_TYPE_RSA
:
513 /* For plain RSA keys, PSS parameters must not be set */
514 if (!rsa_pss_params_30_is_unrestricted(&gctx
->pss_params
))
517 case RSA_FLAG_TYPE_RSASSAPSS
:
519 * For plain RSA-PSS keys, PSS parameters may be set but don't have
524 /* Unsupported RSA key sub-type... */
528 if ((rsa_tmp
= rsa_new_with_ctx(gctx
->libctx
)) == NULL
)
533 gencb
= BN_GENCB_new();
535 BN_GENCB_set(gencb
, rsa_gencb
, genctx
);
537 #if defined(FIPS_MODULE) && !defined(OPENSSL_NO_ACVP_TESTS)
538 if (gctx
->acvp_test_params
!= NULL
) {
539 if (!rsa_acvp_test_set_params(rsa_tmp
, gctx
->acvp_test_params
))
544 if (!RSA_generate_multi_prime_key(rsa_tmp
,
545 (int)gctx
->nbits
, (int)gctx
->primes
,
546 gctx
->pub_exp
, gencb
))
549 if (!rsa_pss_params_30_copy(rsa_get0_pss_params_30(rsa_tmp
),
553 RSA_clear_flags(rsa_tmp
, RSA_FLAG_TYPE_MASK
);
554 RSA_set_flags(rsa_tmp
, gctx
->rsa_type
);
559 BN_GENCB_free(gencb
);
564 static void rsa_gen_cleanup(void *genctx
)
566 struct rsa_gen_ctx
*gctx
= genctx
;
570 #if defined(FIPS_MODULE) && !defined(OPENSSL_NO_ACVP_TESTS)
571 rsa_acvp_test_gen_params_free(gctx
->acvp_test_params
);
572 gctx
->acvp_test_params
= NULL
;
574 BN_clear_free(gctx
->pub_exp
);
578 /* For any RSA key, we use the "RSA" algorithms regardless of sub-type. */
579 static const char *rsapss_query_operation_name(int operation_id
)
584 const OSSL_DISPATCH rsa_keymgmt_functions
[] = {
585 { OSSL_FUNC_KEYMGMT_NEW
, (void (*)(void))rsa_newdata
},
586 { OSSL_FUNC_KEYMGMT_GEN_INIT
, (void (*)(void))rsa_gen_init
},
587 { OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS
,
588 (void (*)(void))rsa_gen_set_params
},
589 { OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS
,
590 (void (*)(void))rsa_gen_settable_params
},
591 { OSSL_FUNC_KEYMGMT_GEN
, (void (*)(void))rsa_gen
},
592 { OSSL_FUNC_KEYMGMT_GEN_CLEANUP
, (void (*)(void))rsa_gen_cleanup
},
593 { OSSL_FUNC_KEYMGMT_FREE
, (void (*)(void))rsa_freedata
},
594 { OSSL_FUNC_KEYMGMT_GET_PARAMS
, (void (*) (void))rsa_get_params
},
595 { OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS
, (void (*) (void))rsa_gettable_params
},
596 { OSSL_FUNC_KEYMGMT_HAS
, (void (*)(void))rsa_has
},
597 { OSSL_FUNC_KEYMGMT_MATCH
, (void (*)(void))rsa_match
},
598 { OSSL_FUNC_KEYMGMT_VALIDATE
, (void (*)(void))rsa_validate
},
599 { OSSL_FUNC_KEYMGMT_IMPORT
, (void (*)(void))rsa_import
},
600 { OSSL_FUNC_KEYMGMT_IMPORT_TYPES
, (void (*)(void))rsa_import_types
},
601 { OSSL_FUNC_KEYMGMT_EXPORT
, (void (*)(void))rsa_export
},
602 { OSSL_FUNC_KEYMGMT_EXPORT_TYPES
, (void (*)(void))rsa_export_types
},
606 const OSSL_DISPATCH rsapss_keymgmt_functions
[] = {
607 { OSSL_FUNC_KEYMGMT_NEW
, (void (*)(void))rsapss_newdata
},
608 { OSSL_FUNC_KEYMGMT_GEN_INIT
, (void (*)(void))rsapss_gen_init
},
609 { OSSL_FUNC_KEYMGMT_GEN_SET_PARAMS
, (void (*)(void))rsa_gen_set_params
},
610 { OSSL_FUNC_KEYMGMT_GEN_SETTABLE_PARAMS
,
611 (void (*)(void))rsapss_gen_settable_params
},
612 { OSSL_FUNC_KEYMGMT_GEN
, (void (*)(void))rsa_gen
},
613 { OSSL_FUNC_KEYMGMT_GEN_CLEANUP
, (void (*)(void))rsa_gen_cleanup
},
614 { OSSL_FUNC_KEYMGMT_FREE
, (void (*)(void))rsa_freedata
},
615 { OSSL_FUNC_KEYMGMT_GET_PARAMS
, (void (*) (void))rsa_get_params
},
616 { OSSL_FUNC_KEYMGMT_GETTABLE_PARAMS
, (void (*) (void))rsa_gettable_params
},
617 { OSSL_FUNC_KEYMGMT_HAS
, (void (*)(void))rsa_has
},
618 { OSSL_FUNC_KEYMGMT_VALIDATE
, (void (*)(void))rsa_validate
},
619 { OSSL_FUNC_KEYMGMT_IMPORT
, (void (*)(void))rsa_import
},
620 { OSSL_FUNC_KEYMGMT_IMPORT_TYPES
, (void (*)(void))rsa_import_types
},
621 { OSSL_FUNC_KEYMGMT_EXPORT
, (void (*)(void))rsa_export
},
622 { OSSL_FUNC_KEYMGMT_EXPORT_TYPES
, (void (*)(void))rsa_export_types
},
623 { OSSL_FUNC_KEYMGMT_QUERY_OPERATION_NAME
,
624 (void (*)(void))rsapss_query_operation_name
},