Move the PROV_R reason codes to a public header
[openssl.git] / providers / implementations / asymciphers / rsa_enc.c
1 /*
2  * Copyright 2019-2021 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 /*
11  * RSA low level APIs are deprecated for public use, but still ok for
12  * internal use.
13  */
14 #include "internal/deprecated.h"
15
16 #include <openssl/crypto.h>
17 #include <openssl/evp.h>
18 #include <openssl/core_dispatch.h>
19 #include <openssl/core_names.h>
20 #include <openssl/rsa.h>
21 #include <openssl/params.h>
22 #include <openssl/err.h>
23 #include <openssl/proverr.h>
24 /* Just for SSL_MAX_MASTER_KEY_LENGTH */
25 #include <openssl/ssl.h>
26 #include "internal/constant_time.h"
27 #include "internal/sizes.h"
28 #include "crypto/rsa.h"
29 #include "prov/provider_ctx.h"
30 #include "prov/implementations.h"
31 #include "prov/providercommon.h"
32 #include "prov/securitycheck.h"
33
34 #include <stdlib.h>
35
36 static OSSL_FUNC_asym_cipher_newctx_fn rsa_newctx;
37 static OSSL_FUNC_asym_cipher_encrypt_init_fn rsa_encrypt_init;
38 static OSSL_FUNC_asym_cipher_encrypt_fn rsa_encrypt;
39 static OSSL_FUNC_asym_cipher_decrypt_init_fn rsa_decrypt_init;
40 static OSSL_FUNC_asym_cipher_decrypt_fn rsa_decrypt;
41 static OSSL_FUNC_asym_cipher_freectx_fn rsa_freectx;
42 static OSSL_FUNC_asym_cipher_dupctx_fn rsa_dupctx;
43 static OSSL_FUNC_asym_cipher_get_ctx_params_fn rsa_get_ctx_params;
44 static OSSL_FUNC_asym_cipher_gettable_ctx_params_fn rsa_gettable_ctx_params;
45 static OSSL_FUNC_asym_cipher_set_ctx_params_fn rsa_set_ctx_params;
46 static OSSL_FUNC_asym_cipher_settable_ctx_params_fn rsa_settable_ctx_params;
47
48 static OSSL_ITEM padding_item[] = {
49     { RSA_PKCS1_PADDING,        OSSL_PKEY_RSA_PAD_MODE_PKCSV15 },
50     { RSA_SSLV23_PADDING,       OSSL_PKEY_RSA_PAD_MODE_SSLV23 },
51     { RSA_NO_PADDING,           OSSL_PKEY_RSA_PAD_MODE_NONE },
52     { RSA_PKCS1_OAEP_PADDING,   OSSL_PKEY_RSA_PAD_MODE_OAEP }, /* Correct spelling first */
53     { RSA_PKCS1_OAEP_PADDING,   "oeap"   },
54     { RSA_X931_PADDING,         OSSL_PKEY_RSA_PAD_MODE_X931 },
55     { 0,                        NULL     }
56 };
57
58 /*
59  * What's passed as an actual key is defined by the KEYMGMT interface.
60  * We happen to know that our KEYMGMT simply passes RSA structures, so
61  * we use that here too.
62  */
63
64 typedef struct {
65     OSSL_LIB_CTX *libctx;
66     RSA *rsa;
67     int pad_mode;
68     int operation;
69     /* OAEP message digest */
70     EVP_MD *oaep_md;
71     /* message digest for MGF1 */
72     EVP_MD *mgf1_md;
73     /* OAEP label */
74     unsigned char *oaep_label;
75     size_t oaep_labellen;
76     /* TLS padding */
77     unsigned int client_version;
78     unsigned int alt_version;
79 } PROV_RSA_CTX;
80
81 static void *rsa_newctx(void *provctx)
82 {
83     PROV_RSA_CTX *prsactx;
84
85     if (!ossl_prov_is_running())
86         return NULL;
87     prsactx = OPENSSL_zalloc(sizeof(PROV_RSA_CTX));
88     if (prsactx == NULL)
89         return NULL;
90     prsactx->libctx = PROV_LIBCTX_OF(provctx);
91
92     return prsactx;
93 }
94
95 static int rsa_init(void *vprsactx, void *vrsa, int operation)
96 {
97     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
98
99     if (!ossl_prov_is_running()
100             || prsactx == NULL
101             || vrsa == NULL
102             || !RSA_up_ref(vrsa))
103         return 0;
104     RSA_free(prsactx->rsa);
105     prsactx->rsa = vrsa;
106     prsactx->operation = operation;
107
108     switch (RSA_test_flags(prsactx->rsa, RSA_FLAG_TYPE_MASK)) {
109     case RSA_FLAG_TYPE_RSA:
110         prsactx->pad_mode = RSA_PKCS1_PADDING;
111         break;
112     default:
113         ERR_raise(ERR_LIB_PROV, PROV_R_OPERATION_NOT_SUPPORTED_FOR_THIS_KEYTYPE);
114         return 0;
115     }
116     if (!ossl_rsa_check_key(vrsa, operation == EVP_PKEY_OP_ENCRYPT)) {
117         ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH);
118         return 0;
119     }
120     return 1;
121 }
122
123 static int rsa_encrypt_init(void *vprsactx, void *vrsa)
124 {
125     return rsa_init(vprsactx, vrsa, EVP_PKEY_OP_ENCRYPT);
126 }
127
128 static int rsa_decrypt_init(void *vprsactx, void *vrsa)
129 {
130     return rsa_init(vprsactx, vrsa, EVP_PKEY_OP_DECRYPT);
131 }
132
133 static int rsa_encrypt(void *vprsactx, unsigned char *out, size_t *outlen,
134                        size_t outsize, const unsigned char *in, size_t inlen)
135 {
136     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
137     int ret;
138
139     if (!ossl_prov_is_running())
140         return 0;
141
142     if (out == NULL) {
143         size_t len = RSA_size(prsactx->rsa);
144
145         if (len == 0) {
146             ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY);
147             return 0;
148         }
149         *outlen = len;
150         return 1;
151     }
152
153     if (prsactx->pad_mode == RSA_PKCS1_OAEP_PADDING) {
154         int rsasize = RSA_size(prsactx->rsa);
155         unsigned char *tbuf;
156
157         if ((tbuf = OPENSSL_malloc(rsasize)) == NULL) {
158             ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
159             return 0;
160         }
161         if (prsactx->oaep_md == NULL) {
162             OPENSSL_free(tbuf);
163             prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, "SHA-1", NULL);
164             ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
165             return 0;
166         }
167         ret =
168             ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(prsactx->libctx, tbuf,
169                                                     rsasize, in, inlen,
170                                                     prsactx->oaep_label,
171                                                     prsactx->oaep_labellen,
172                                                     prsactx->oaep_md,
173                                                     prsactx->mgf1_md);
174
175         if (!ret) {
176             OPENSSL_free(tbuf);
177             return 0;
178         }
179         ret = RSA_public_encrypt(rsasize, tbuf, out, prsactx->rsa,
180                                  RSA_NO_PADDING);
181         OPENSSL_free(tbuf);
182     } else {
183         ret = RSA_public_encrypt(inlen, in, out, prsactx->rsa,
184                                  prsactx->pad_mode);
185     }
186     /* A ret value of 0 is not an error */
187     if (ret < 0)
188         return ret;
189     *outlen = ret;
190     return 1;
191 }
192
193 static int rsa_decrypt(void *vprsactx, unsigned char *out, size_t *outlen,
194                        size_t outsize, const unsigned char *in, size_t inlen)
195 {
196     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
197     int ret;
198     size_t len = RSA_size(prsactx->rsa);
199
200     if (!ossl_prov_is_running())
201         return 0;
202
203     if (prsactx->pad_mode == RSA_PKCS1_WITH_TLS_PADDING) {
204         if (out == NULL) {
205             *outlen = SSL_MAX_MASTER_KEY_LENGTH;
206             return 1;
207         }
208         if (outsize < SSL_MAX_MASTER_KEY_LENGTH) {
209             ERR_raise(ERR_LIB_PROV, PROV_R_BAD_LENGTH);
210             return 0;
211         }
212     } else {
213         if (out == NULL) {
214             if (len == 0) {
215                 ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY);
216                 return 0;
217             }
218             *outlen = len;
219             return 1;
220         }
221
222         if (outsize < len) {
223             ERR_raise(ERR_LIB_PROV, PROV_R_BAD_LENGTH);
224             return 0;
225         }
226     }
227
228     if (prsactx->pad_mode == RSA_PKCS1_OAEP_PADDING
229             || prsactx->pad_mode == RSA_PKCS1_WITH_TLS_PADDING) {
230         unsigned char *tbuf;
231
232         if ((tbuf = OPENSSL_malloc(len)) == NULL) {
233             ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
234             return 0;
235         }
236         ret = RSA_private_decrypt(inlen, in, tbuf, prsactx->rsa,
237                                   RSA_NO_PADDING);
238         /*
239          * With no padding then, on success ret should be len, otherwise an
240          * error occurred (non-constant time)
241          */
242         if (ret != (int)len) {
243             OPENSSL_free(tbuf);
244             ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_DECRYPT);
245             return 0;
246         }
247         if (prsactx->pad_mode == RSA_PKCS1_OAEP_PADDING) {
248             if (prsactx->oaep_md == NULL) {
249                 prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, "SHA-1", NULL);
250                 if (prsactx->oaep_md == NULL) {
251                     ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
252                     return 0;
253                 }
254             }
255             ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, outsize, tbuf,
256                                                     len, len,
257                                                     prsactx->oaep_label,
258                                                     prsactx->oaep_labellen,
259                                                     prsactx->oaep_md,
260                                                     prsactx->mgf1_md);
261         } else {
262             /* RSA_PKCS1_WITH_TLS_PADDING */
263             if (prsactx->client_version <= 0) {
264                 ERR_raise(ERR_LIB_PROV, PROV_R_BAD_TLS_CLIENT_VERSION);
265                 return 0;
266             }
267             ret = ossl_rsa_padding_check_PKCS1_type_2_TLS(
268                         prsactx->libctx, out, outsize, tbuf, len,
269                         prsactx->client_version, prsactx->alt_version);
270         }
271         OPENSSL_free(tbuf);
272     } else {
273         ret = RSA_private_decrypt(inlen, in, out, prsactx->rsa,
274                                   prsactx->pad_mode);
275     }
276     *outlen = constant_time_select_s(constant_time_msb_s(ret), *outlen, ret);
277     ret = constant_time_select_int(constant_time_msb(ret), 0, 1);
278     return ret;
279 }
280
281 static void rsa_freectx(void *vprsactx)
282 {
283     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
284
285     RSA_free(prsactx->rsa);
286
287     EVP_MD_free(prsactx->oaep_md);
288     EVP_MD_free(prsactx->mgf1_md);
289     OPENSSL_free(prsactx->oaep_label);
290
291     OPENSSL_free(prsactx);
292 }
293
294 static void *rsa_dupctx(void *vprsactx)
295 {
296     PROV_RSA_CTX *srcctx = (PROV_RSA_CTX *)vprsactx;
297     PROV_RSA_CTX *dstctx;
298
299     if (!ossl_prov_is_running())
300         return NULL;
301
302     dstctx = OPENSSL_zalloc(sizeof(*srcctx));
303     if (dstctx == NULL)
304         return NULL;
305
306     *dstctx = *srcctx;
307     if (dstctx->rsa != NULL && !RSA_up_ref(dstctx->rsa)) {
308         OPENSSL_free(dstctx);
309         return NULL;
310     }
311
312     if (dstctx->oaep_md != NULL && !EVP_MD_up_ref(dstctx->oaep_md)) {
313         RSA_free(dstctx->rsa);
314         OPENSSL_free(dstctx);
315         return NULL;
316     }
317
318     if (dstctx->mgf1_md != NULL && !EVP_MD_up_ref(dstctx->mgf1_md)) {
319         RSA_free(dstctx->rsa);
320         EVP_MD_free(dstctx->oaep_md);
321         OPENSSL_free(dstctx);
322         return NULL;
323     }
324
325     return dstctx;
326 }
327
328 static int rsa_get_ctx_params(void *vprsactx, OSSL_PARAM *params)
329 {
330     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
331     OSSL_PARAM *p;
332
333     if (prsactx == NULL || params == NULL)
334         return 0;
335
336     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_PAD_MODE);
337     if (p != NULL)
338         switch (p->data_type) {
339         case OSSL_PARAM_INTEGER: /* Support for legacy pad mode number */
340             if (!OSSL_PARAM_set_int(p, prsactx->pad_mode))
341                 return 0;
342             break;
343         case OSSL_PARAM_UTF8_STRING:
344             {
345                 int i;
346                 const char *word = NULL;
347
348                 for (i = 0; padding_item[i].id != 0; i++) {
349                     if (prsactx->pad_mode == (int)padding_item[i].id) {
350                         word = padding_item[i].ptr;
351                         break;
352                     }
353                 }
354
355                 if (word != NULL) {
356                     if (!OSSL_PARAM_set_utf8_string(p, word))
357                         return 0;
358                 } else {
359                     ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
360                 }
361             }
362             break;
363         default:
364             return 0;
365         }
366
367     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST);
368     if (p != NULL && !OSSL_PARAM_set_utf8_string(p, prsactx->oaep_md == NULL
369                                                     ? ""
370                                                     : EVP_MD_name(prsactx->oaep_md)))
371         return 0;
372
373     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST);
374     if (p != NULL) {
375         EVP_MD *mgf1_md = prsactx->mgf1_md == NULL ? prsactx->oaep_md
376                                                    : prsactx->mgf1_md;
377
378         if (!OSSL_PARAM_set_utf8_string(p, mgf1_md == NULL
379                                            ? ""
380                                            : EVP_MD_name(mgf1_md)))
381         return 0;
382     }
383
384     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL);
385     if (p != NULL &&
386         !OSSL_PARAM_set_octet_ptr(p, prsactx->oaep_label,
387                                   prsactx->oaep_labellen))
388         return 0;
389
390     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION);
391     if (p != NULL && !OSSL_PARAM_set_uint(p, prsactx->client_version))
392         return 0;
393
394     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION);
395     if (p != NULL && !OSSL_PARAM_set_uint(p, prsactx->alt_version))
396         return 0;
397
398     return 1;
399 }
400
401 static const OSSL_PARAM known_gettable_ctx_params[] = {
402     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST, NULL, 0),
403     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_PAD_MODE, NULL, 0),
404     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST, NULL, 0),
405     OSSL_PARAM_DEFN(OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL, OSSL_PARAM_OCTET_PTR,
406                     NULL, 0),
407     OSSL_PARAM_uint(OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION, NULL),
408     OSSL_PARAM_uint(OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION, NULL),
409     OSSL_PARAM_END
410 };
411
412 static const OSSL_PARAM *rsa_gettable_ctx_params(ossl_unused void *provctx)
413 {
414     return known_gettable_ctx_params;
415 }
416
417 static int rsa_set_ctx_params(void *vprsactx, const OSSL_PARAM params[])
418 {
419     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
420     const OSSL_PARAM *p;
421     char mdname[OSSL_MAX_NAME_SIZE];
422     char mdprops[OSSL_MAX_PROPQUERY_SIZE] = { '\0' };
423     char *str = mdname;
424
425     if (prsactx == NULL || params == NULL)
426         return 0;
427
428     p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST);
429     if (p != NULL) {
430         if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdname)))
431             return 0;
432
433         str = mdprops;
434         p = OSSL_PARAM_locate_const(params,
435                                     OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS);
436         if (p != NULL) {
437             if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdprops)))
438                 return 0;
439         }
440
441         EVP_MD_free(prsactx->oaep_md);
442         prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, mdname, mdprops);
443
444         if (prsactx->oaep_md == NULL)
445             return 0;
446     }
447
448     p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_PAD_MODE);
449     if (p != NULL) {
450         int pad_mode = 0;
451
452         switch (p->data_type) {
453         case OSSL_PARAM_INTEGER: /* Support for legacy pad mode number */
454             if (!OSSL_PARAM_get_int(p, &pad_mode))
455                 return 0;
456             break;
457         case OSSL_PARAM_UTF8_STRING:
458             {
459                 int i;
460
461                 if (p->data == NULL)
462                     return 0;
463
464                 for (i = 0; padding_item[i].id != 0; i++) {
465                     if (strcmp(p->data, padding_item[i].ptr) == 0) {
466                         pad_mode = padding_item[i].id;
467                         break;
468                     }
469                 }
470             }
471             break;
472         default:
473             return 0;
474         }
475
476         /*
477          * PSS padding is for signatures only so is not compatible with
478          * asymmetric cipher use.
479          */
480         if (pad_mode == RSA_PKCS1_PSS_PADDING)
481             return 0;
482         if (pad_mode == RSA_PKCS1_OAEP_PADDING && prsactx->oaep_md == NULL) {
483             prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, "SHA1", mdprops);
484             if (prsactx->oaep_md == NULL)
485                 return 0;
486         }
487         prsactx->pad_mode = pad_mode;
488     }
489
490     p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST);
491     if (p != NULL) {
492         if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdname)))
493             return 0;
494
495         str = mdprops;
496         p = OSSL_PARAM_locate_const(params,
497                                     OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS);
498         if (p != NULL) {
499             if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdprops)))
500                 return 0;
501         } else {
502             str = NULL;
503         }
504
505         EVP_MD_free(prsactx->mgf1_md);
506         prsactx->mgf1_md = EVP_MD_fetch(prsactx->libctx, mdname, str);
507
508         if (prsactx->mgf1_md == NULL)
509             return 0;
510     }
511
512     p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL);
513     if (p != NULL) {
514         void *tmp_label = NULL;
515         size_t tmp_labellen;
516
517         if (!OSSL_PARAM_get_octet_string(p, &tmp_label, 0, &tmp_labellen))
518             return 0;
519         OPENSSL_free(prsactx->oaep_label);
520         prsactx->oaep_label = (unsigned char *)tmp_label;
521         prsactx->oaep_labellen = tmp_labellen;
522     }
523
524     p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION);
525     if (p != NULL) {
526         unsigned int client_version;
527
528         if (!OSSL_PARAM_get_uint(p, &client_version))
529             return 0;
530         prsactx->client_version = client_version;
531     }
532
533     p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION);
534     if (p != NULL) {
535         unsigned int alt_version;
536
537         if (!OSSL_PARAM_get_uint(p, &alt_version))
538             return 0;
539         prsactx->alt_version = alt_version;
540     }
541
542     return 1;
543 }
544
545 static const OSSL_PARAM known_settable_ctx_params[] = {
546     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST, NULL, 0),
547     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_PAD_MODE, NULL, 0),
548     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST, NULL, 0),
549     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS, NULL, 0),
550     OSSL_PARAM_octet_string(OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL, NULL, 0),
551     OSSL_PARAM_uint(OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION, NULL),
552     OSSL_PARAM_uint(OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION, NULL),
553     OSSL_PARAM_END
554 };
555
556 static const OSSL_PARAM *rsa_settable_ctx_params(ossl_unused void *provctx)
557 {
558     return known_settable_ctx_params;
559 }
560
561 const OSSL_DISPATCH ossl_rsa_asym_cipher_functions[] = {
562     { OSSL_FUNC_ASYM_CIPHER_NEWCTX, (void (*)(void))rsa_newctx },
563     { OSSL_FUNC_ASYM_CIPHER_ENCRYPT_INIT, (void (*)(void))rsa_encrypt_init },
564     { OSSL_FUNC_ASYM_CIPHER_ENCRYPT, (void (*)(void))rsa_encrypt },
565     { OSSL_FUNC_ASYM_CIPHER_DECRYPT_INIT, (void (*)(void))rsa_decrypt_init },
566     { OSSL_FUNC_ASYM_CIPHER_DECRYPT, (void (*)(void))rsa_decrypt },
567     { OSSL_FUNC_ASYM_CIPHER_FREECTX, (void (*)(void))rsa_freectx },
568     { OSSL_FUNC_ASYM_CIPHER_DUPCTX, (void (*)(void))rsa_dupctx },
569     { OSSL_FUNC_ASYM_CIPHER_GET_CTX_PARAMS,
570       (void (*)(void))rsa_get_ctx_params },
571     { OSSL_FUNC_ASYM_CIPHER_GETTABLE_CTX_PARAMS,
572       (void (*)(void))rsa_gettable_ctx_params },
573     { OSSL_FUNC_ASYM_CIPHER_SET_CTX_PARAMS,
574       (void (*)(void))rsa_set_ctx_params },
575     { OSSL_FUNC_ASYM_CIPHER_SETTABLE_CTX_PARAMS,
576       (void (*)(void))rsa_settable_ctx_params },
577     { 0, NULL }
578 };