Run the withlibctx.pl script
[openssl.git] / providers / implementations / asymciphers / rsa_enc.c
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 /*
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 /* Just for SSL_MAX_MASTER_KEY_LENGTH */
24 #include <openssl/ssl.h>
25 #include "internal/constant_time.h"
26 #include "internal/sizes.h"
27 #include "crypto/rsa.h"
28 #include "prov/providercommonerr.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     OPENSSL_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_LIBRARY_CONTEXT_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 (!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             PROVerr(0, 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             PROVerr(0, ERR_R_INTERNAL_ERROR);
165             return 0;
166         }
167         ret =
168             rsa_padding_add_PKCS1_OAEP_mgf1_ex(prsactx->libctx, tbuf, rsasize,
169                                                in, inlen, prsactx->oaep_label,
170                                                prsactx->oaep_labellen,
171                                                prsactx->oaep_md,
172                                                prsactx->mgf1_md);
173
174         if (!ret) {
175             OPENSSL_free(tbuf);
176             return 0;
177         }
178         ret = RSA_public_encrypt(rsasize, tbuf, out, prsactx->rsa,
179                                  RSA_NO_PADDING);
180         OPENSSL_free(tbuf);
181     } else {
182         ret = RSA_public_encrypt(inlen, in, out, prsactx->rsa,
183                                  prsactx->pad_mode);
184     }
185     /* A ret value of 0 is not an error */
186     if (ret < 0)
187         return ret;
188     *outlen = ret;
189     return 1;
190 }
191
192 static int rsa_decrypt(void *vprsactx, unsigned char *out, size_t *outlen,
193                        size_t outsize, const unsigned char *in, size_t inlen)
194 {
195     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
196     int ret;
197     size_t len = RSA_size(prsactx->rsa);
198
199     if (!ossl_prov_is_running())
200         return 0;
201
202     if (prsactx->pad_mode == RSA_PKCS1_WITH_TLS_PADDING) {
203         if (out == NULL) {
204             *outlen = SSL_MAX_MASTER_KEY_LENGTH;
205             return 1;
206         }
207         if (outsize < SSL_MAX_MASTER_KEY_LENGTH) {
208             ERR_raise(ERR_LIB_PROV, PROV_R_BAD_LENGTH);
209             return 0;
210         }
211     } else {
212         if (out == NULL) {
213             if (len == 0) {
214                 ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY);
215                 return 0;
216             }
217             *outlen = len;
218             return 1;
219         }
220
221         if (outsize < len) {
222             ERR_raise(ERR_LIB_PROV, PROV_R_BAD_LENGTH);
223             return 0;
224         }
225     }
226
227     if (prsactx->pad_mode == RSA_PKCS1_OAEP_PADDING
228             || prsactx->pad_mode == RSA_PKCS1_WITH_TLS_PADDING) {
229         unsigned char *tbuf;
230
231         if ((tbuf = OPENSSL_malloc(len)) == NULL) {
232             PROVerr(0, ERR_R_MALLOC_FAILURE);
233             return 0;
234         }
235         ret = RSA_private_decrypt(inlen, in, tbuf, prsactx->rsa,
236                                   RSA_NO_PADDING);
237         /*
238          * With no padding then, on success ret should be len, otherwise an
239          * error occurred (non-constant time)
240          */
241         if (ret != (int)len) {
242             OPENSSL_free(tbuf);
243             ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_DECRYPT);
244             return 0;
245         }
246         if (prsactx->pad_mode == RSA_PKCS1_OAEP_PADDING) {
247             if (prsactx->oaep_md == NULL) {
248                 prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, "SHA-1", NULL);
249                 if (prsactx->oaep_md == NULL) {
250                     PROVerr(0, ERR_R_INTERNAL_ERROR);
251                     return 0;
252                 }
253             }
254             ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, outsize, tbuf,
255                                                     len, len,
256                                                     prsactx->oaep_label,
257                                                     prsactx->oaep_labellen,
258                                                     prsactx->oaep_md,
259                                                     prsactx->mgf1_md);
260         } else {
261             /* RSA_PKCS1_WITH_TLS_PADDING */
262             if (prsactx->client_version <= 0) {
263                 ERR_raise(ERR_LIB_PROV, PROV_R_BAD_TLS_CLIENT_VERSION);
264                 return 0;
265             }
266             ret = rsa_padding_check_PKCS1_type_2_TLS(prsactx->libctx, out,
267                                                      outsize,
268                                                      tbuf, len,
269                                                      prsactx->client_version,
270                                                      prsactx->alt_version);
271         }
272         OPENSSL_free(tbuf);
273     } else {
274         ret = RSA_private_decrypt(inlen, in, out, prsactx->rsa,
275                                   prsactx->pad_mode);
276     }
277     *outlen = constant_time_select_s(constant_time_msb_s(ret), *outlen, ret);
278     ret = constant_time_select_int(constant_time_msb(ret), 0, 1);
279     return ret;
280 }
281
282 static void rsa_freectx(void *vprsactx)
283 {
284     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
285
286     RSA_free(prsactx->rsa);
287
288     EVP_MD_free(prsactx->oaep_md);
289     EVP_MD_free(prsactx->mgf1_md);
290     OPENSSL_free(prsactx->oaep_label);
291
292     OPENSSL_free(prsactx);
293 }
294
295 static void *rsa_dupctx(void *vprsactx)
296 {
297     PROV_RSA_CTX *srcctx = (PROV_RSA_CTX *)vprsactx;
298     PROV_RSA_CTX *dstctx;
299
300     if (!ossl_prov_is_running())
301         return NULL;
302
303     dstctx = OPENSSL_zalloc(sizeof(*srcctx));
304     if (dstctx == NULL)
305         return NULL;
306
307     *dstctx = *srcctx;
308     if (dstctx->rsa != NULL && !RSA_up_ref(dstctx->rsa)) {
309         OPENSSL_free(dstctx);
310         return NULL;
311     }
312
313     if (dstctx->oaep_md != NULL && !EVP_MD_up_ref(dstctx->oaep_md)) {
314         RSA_free(dstctx->rsa);
315         OPENSSL_free(dstctx);
316         return NULL;
317     }
318
319     if (dstctx->mgf1_md != NULL && !EVP_MD_up_ref(dstctx->mgf1_md)) {
320         RSA_free(dstctx->rsa);
321         EVP_MD_free(dstctx->oaep_md);
322         OPENSSL_free(dstctx);
323         return NULL;
324     }
325
326     return dstctx;
327 }
328
329 static int rsa_get_ctx_params(void *vprsactx, OSSL_PARAM *params)
330 {
331     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
332     OSSL_PARAM *p;
333
334     if (prsactx == NULL || params == NULL)
335         return 0;
336
337     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_PAD_MODE);
338     if (p != NULL)
339         switch (p->data_type) {
340         case OSSL_PARAM_INTEGER: /* Support for legacy pad mode number */
341             if (!OSSL_PARAM_set_int(p, prsactx->pad_mode))
342                 return 0;
343             break;
344         case OSSL_PARAM_UTF8_STRING:
345             {
346                 int i;
347                 const char *word = NULL;
348
349                 for (i = 0; padding_item[i].id != 0; i++) {
350                     if (prsactx->pad_mode == (int)padding_item[i].id) {
351                         word = padding_item[i].ptr;
352                         break;
353                     }
354                 }
355
356                 if (word != NULL) {
357                     if (!OSSL_PARAM_set_utf8_string(p, word))
358                         return 0;
359                 } else {
360                     ERR_raise(ERR_LIB_PROV, ERR_R_INTERNAL_ERROR);
361                 }
362             }
363             break;
364         default:
365             return 0;
366         }
367
368     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST);
369     if (p != NULL && !OSSL_PARAM_set_utf8_string(p, prsactx->oaep_md == NULL
370                                                     ? ""
371                                                     : EVP_MD_name(prsactx->oaep_md)))
372         return 0;
373
374     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST);
375     if (p != NULL) {
376         EVP_MD *mgf1_md = prsactx->mgf1_md == NULL ? prsactx->oaep_md
377                                                    : prsactx->mgf1_md;
378
379         if (!OSSL_PARAM_set_utf8_string(p, mgf1_md == NULL
380                                            ? ""
381                                            : EVP_MD_name(mgf1_md)))
382         return 0;
383     }
384
385     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL);
386     if (p != NULL && !OSSL_PARAM_set_octet_ptr(p, prsactx->oaep_label, 0))
387         return 0;
388
389     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL_LEN);
390     if (p != NULL && !OSSL_PARAM_set_size_t(p, prsactx->oaep_labellen))
391         return 0;
392
393     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION);
394     if (p != NULL && !OSSL_PARAM_set_uint(p, prsactx->client_version))
395         return 0;
396
397     p = OSSL_PARAM_locate(params, OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION);
398     if (p != NULL && !OSSL_PARAM_set_uint(p, prsactx->alt_version))
399         return 0;
400
401     return 1;
402 }
403
404 static const OSSL_PARAM known_gettable_ctx_params[] = {
405     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST, NULL, 0),
406     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_PAD_MODE, NULL, 0),
407     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST, NULL, 0),
408     OSSL_PARAM_DEFN(OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL, OSSL_PARAM_OCTET_PTR,
409                     NULL, 0),
410     OSSL_PARAM_size_t(OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL_LEN, NULL),
411     OSSL_PARAM_uint(OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION, NULL),
412     OSSL_PARAM_uint(OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION, NULL),
413     OSSL_PARAM_END
414 };
415
416 static const OSSL_PARAM *rsa_gettable_ctx_params(ossl_unused void *provctx)
417 {
418     return known_gettable_ctx_params;
419 }
420
421 static int rsa_set_ctx_params(void *vprsactx, const OSSL_PARAM params[])
422 {
423     PROV_RSA_CTX *prsactx = (PROV_RSA_CTX *)vprsactx;
424     const OSSL_PARAM *p;
425     char mdname[OSSL_MAX_NAME_SIZE];
426     char mdprops[OSSL_MAX_PROPQUERY_SIZE] = { '\0' };
427     char *str = mdname;
428
429     if (prsactx == NULL || params == NULL)
430         return 0;
431
432     p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST);
433     if (p != NULL) {
434         if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdname)))
435             return 0;
436
437         str = mdprops;
438         p = OSSL_PARAM_locate_const(params,
439                                     OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST_PROPS);
440         if (p != NULL) {
441             if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdprops)))
442                 return 0;
443         }
444
445         EVP_MD_free(prsactx->oaep_md);
446         prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, mdname, mdprops);
447
448         if (prsactx->oaep_md == NULL)
449             return 0;
450     }
451
452     p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_PAD_MODE);
453     if (p != NULL) {
454         int pad_mode = 0;
455
456         switch (p->data_type) {
457         case OSSL_PARAM_INTEGER: /* Support for legacy pad mode number */
458             if (!OSSL_PARAM_get_int(p, &pad_mode))
459                 return 0;
460             break;
461         case OSSL_PARAM_UTF8_STRING:
462             {
463                 int i;
464
465                 if (p->data == NULL)
466                     return 0;
467
468                 for (i = 0; padding_item[i].id != 0; i++) {
469                     if (strcmp(p->data, padding_item[i].ptr) == 0) {
470                         pad_mode = padding_item[i].id;
471                         break;
472                     }
473                 }
474             }
475             break;
476         default:
477             return 0;
478         }
479
480         /*
481          * PSS padding is for signatures only so is not compatible with
482          * asymmetric cipher use.
483          */
484         if (pad_mode == RSA_PKCS1_PSS_PADDING)
485             return 0;
486         if (pad_mode == RSA_PKCS1_OAEP_PADDING && prsactx->oaep_md == NULL) {
487             prsactx->oaep_md = EVP_MD_fetch(prsactx->libctx, "SHA1", mdprops);
488             if (prsactx->oaep_md == NULL)
489                 return 0;
490         }
491         prsactx->pad_mode = pad_mode;
492     }
493
494     p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST);
495     if (p != NULL) {
496         if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdname)))
497             return 0;
498
499         str = mdprops;
500         p = OSSL_PARAM_locate_const(params,
501                                     OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS);
502         if (p != NULL) {
503             if (!OSSL_PARAM_get_utf8_string(p, &str, sizeof(mdprops)))
504                 return 0;
505         } else {
506             str = NULL;
507         }
508
509         EVP_MD_free(prsactx->mgf1_md);
510         prsactx->mgf1_md = EVP_MD_fetch(prsactx->libctx, mdname, str);
511
512         if (prsactx->mgf1_md == NULL)
513             return 0;
514     }
515
516     p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL);
517     if (p != NULL) {
518         void *tmp_label = NULL;
519         size_t tmp_labellen;
520
521         if (!OSSL_PARAM_get_octet_string(p, &tmp_label, 0, &tmp_labellen))
522             return 0;
523         OPENSSL_free(prsactx->oaep_label);
524         prsactx->oaep_label = (unsigned char *)tmp_label;
525         prsactx->oaep_labellen = tmp_labellen;
526     }
527
528     p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION);
529     if (p != NULL) {
530         unsigned int client_version;
531
532         if (!OSSL_PARAM_get_uint(p, &client_version))
533             return 0;
534         prsactx->client_version = client_version;
535     }
536
537     p = OSSL_PARAM_locate_const(params, OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION);
538     if (p != NULL) {
539         unsigned int alt_version;
540
541         if (!OSSL_PARAM_get_uint(p, &alt_version))
542             return 0;
543         prsactx->alt_version = alt_version;
544     }
545
546     return 1;
547 }
548
549 static const OSSL_PARAM known_settable_ctx_params[] = {
550     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_OAEP_DIGEST, NULL, 0),
551     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_PAD_MODE, NULL, 0),
552     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST, NULL, 0),
553     OSSL_PARAM_utf8_string(OSSL_ASYM_CIPHER_PARAM_MGF1_DIGEST_PROPS, NULL, 0),
554     OSSL_PARAM_octet_string(OSSL_ASYM_CIPHER_PARAM_OAEP_LABEL, NULL, 0),
555     OSSL_PARAM_uint(OSSL_ASYM_CIPHER_PARAM_TLS_CLIENT_VERSION, NULL),
556     OSSL_PARAM_uint(OSSL_ASYM_CIPHER_PARAM_TLS_NEGOTIATED_VERSION, NULL),
557     OSSL_PARAM_END
558 };
559
560 static const OSSL_PARAM *rsa_settable_ctx_params(ossl_unused void *provctx)
561 {
562     return known_settable_ctx_params;
563 }
564
565 const OSSL_DISPATCH ossl_rsa_asym_cipher_functions[] = {
566     { OSSL_FUNC_ASYM_CIPHER_NEWCTX, (void (*)(void))rsa_newctx },
567     { OSSL_FUNC_ASYM_CIPHER_ENCRYPT_INIT, (void (*)(void))rsa_encrypt_init },
568     { OSSL_FUNC_ASYM_CIPHER_ENCRYPT, (void (*)(void))rsa_encrypt },
569     { OSSL_FUNC_ASYM_CIPHER_DECRYPT_INIT, (void (*)(void))rsa_decrypt_init },
570     { OSSL_FUNC_ASYM_CIPHER_DECRYPT, (void (*)(void))rsa_decrypt },
571     { OSSL_FUNC_ASYM_CIPHER_FREECTX, (void (*)(void))rsa_freectx },
572     { OSSL_FUNC_ASYM_CIPHER_DUPCTX, (void (*)(void))rsa_dupctx },
573     { OSSL_FUNC_ASYM_CIPHER_GET_CTX_PARAMS,
574       (void (*)(void))rsa_get_ctx_params },
575     { OSSL_FUNC_ASYM_CIPHER_GETTABLE_CTX_PARAMS,
576       (void (*)(void))rsa_gettable_ctx_params },
577     { OSSL_FUNC_ASYM_CIPHER_SET_CTX_PARAMS,
578       (void (*)(void))rsa_set_ctx_params },
579     { OSSL_FUNC_ASYM_CIPHER_SETTABLE_CTX_PARAMS,
580       (void (*)(void))rsa_settable_ctx_params },
581     { 0, NULL }
582 };