RSA: Add rsa_schemes.c, to store scheme data and translator functions
[oweals/openssl.git] / include / crypto / rsa.h
1 /*
2  * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License 2.0 (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 #ifndef OSSL_INTERNAL_RSA_H
11 # define OSSL_INTERNAL_RSA_H
12
13 #include <openssl/core.h>
14 #include <openssl/rsa.h>
15
16 const char *rsa_mgf_nid2name(int mgf);
17 int rsa_oaeppss_md2nid(const EVP_MD *md);
18 const char *rsa_oaeppss_nid2name(int md);
19
20 RSA *rsa_new_with_ctx(OPENSSL_CTX *libctx);
21
22 int rsa_set0_all_params(RSA *r, const STACK_OF(BIGNUM) *primes,
23                         const STACK_OF(BIGNUM) *exps,
24                         const STACK_OF(BIGNUM) *coeffs);
25 int rsa_get0_all_params(RSA *r, STACK_OF(BIGNUM_const) *primes,
26                         STACK_OF(BIGNUM_const) *exps,
27                         STACK_OF(BIGNUM_const) *coeffs);
28
29 int rsa_todata(RSA *rsa, OSSL_PARAM_BLD *bld, OSSL_PARAM params[]);
30 int rsa_fromdata(RSA *rsa, const OSSL_PARAM params[]);
31
32 int rsa_padding_check_PKCS1_type_2_TLS(OPENSSL_CTX *ctx, unsigned char *to,
33                                        size_t tlen, const unsigned char *from,
34                                        size_t flen, int client_version,
35                                        int alt_version);
36
37 int rsa_validate_public(const RSA *key);
38 int rsa_validate_private(const RSA *key);
39 int rsa_validate_pairwise(const RSA *key);
40
41 int int_rsa_verify(int dtype, const unsigned char *m,
42                    unsigned int m_len, unsigned char *rm,
43                    size_t *prm_len, const unsigned char *sigbuf,
44                    size_t siglen, RSA *rsa);
45
46 const unsigned char *rsa_digestinfo_encoding(int md_nid, size_t *len);
47 const unsigned char *rsa_algorithmidentifier_encoding(int md_nid, size_t *len);
48
49 extern const char *rsa_mp_factor_names[];
50 extern const char *rsa_mp_exp_names[];
51 extern const char *rsa_mp_coeff_names[];
52
53 #endif