VirtualBox

source: vbox/trunk/src/libs/openssl-3.4.1/include/crypto/rsa.h

Last change on this file was 109052, checked in by vboxsync, 3 weeks ago

openssl-3.4.1: Applied our changes, regenerated files, added missing files and functions. This time with a three way merge. ​bugref:10890

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.9 KB
Line 
1/*
2 * Copyright 2019-2024 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# ifndef RT_WITHOUT_PRAGMA_ONCE /* VBOX */
13# pragma once
14# endif /* VBOX */
15
16# include <openssl/core.h>
17# include <openssl/rsa.h>
18# include "crypto/types.h"
19
20#define RSA_MIN_MODULUS_BITS 512
21
22typedef struct rsa_pss_params_30_st {
23 int hash_algorithm_nid;
24 struct {
25 int algorithm_nid; /* Currently always NID_mgf1 */
26 int hash_algorithm_nid;
27 } mask_gen;
28 int salt_len;
29 int trailer_field;
30} RSA_PSS_PARAMS_30;
31
32RSA_PSS_PARAMS_30 *ossl_rsa_get0_pss_params_30(RSA *r);
33int ossl_rsa_pss_params_30_set_defaults(RSA_PSS_PARAMS_30 *rsa_pss_params);
34int ossl_rsa_pss_params_30_copy(RSA_PSS_PARAMS_30 *to,
35 const RSA_PSS_PARAMS_30 *from);
36int ossl_rsa_pss_params_30_is_unrestricted(const RSA_PSS_PARAMS_30 *rsa_pss_params);
37int ossl_rsa_pss_params_30_set_hashalg(RSA_PSS_PARAMS_30 *rsa_pss_params,
38 int hashalg_nid);
39int ossl_rsa_pss_params_30_set_maskgenhashalg(RSA_PSS_PARAMS_30 *rsa_pss_params,
40 int maskgenhashalg_nid);
41int ossl_rsa_pss_params_30_set_saltlen(RSA_PSS_PARAMS_30 *rsa_pss_params,
42 int saltlen);
43int ossl_rsa_pss_params_30_set_trailerfield(RSA_PSS_PARAMS_30 *rsa_pss_params,
44 int trailerfield);
45int ossl_rsa_pss_params_30_hashalg(const RSA_PSS_PARAMS_30 *rsa_pss_params);
46int ossl_rsa_pss_params_30_maskgenalg(const RSA_PSS_PARAMS_30 *rsa_pss_params);
47int ossl_rsa_pss_params_30_maskgenhashalg(const RSA_PSS_PARAMS_30 *rsa_pss_params);
48int ossl_rsa_pss_params_30_saltlen(const RSA_PSS_PARAMS_30 *rsa_pss_params);
49int ossl_rsa_pss_params_30_trailerfield(const RSA_PSS_PARAMS_30 *rsa_pss_params);
50
51int ossl_rsa_verify_PKCS1_PSS_mgf1(RSA *rsa, const unsigned char *mHash,
52 const EVP_MD *Hash, const EVP_MD *mgf1Hash,
53 const unsigned char *EM, int *sLenOut);
54int ossl_rsa_padding_add_PKCS1_PSS_mgf1(RSA *rsa, unsigned char *EM,
55 const unsigned char *mHash,
56 const EVP_MD *Hash, const EVP_MD *mgf1Hash,
57 int *sLenOut);
58
59const char *ossl_rsa_mgf_nid2name(int mgf);
60int ossl_rsa_oaeppss_md2nid(const EVP_MD *md);
61const char *ossl_rsa_oaeppss_nid2name(int md);
62
63RSA *ossl_rsa_new_with_ctx(OSSL_LIB_CTX *libctx);
64OSSL_LIB_CTX *ossl_rsa_get0_libctx(RSA *r);
65void ossl_rsa_set0_libctx(RSA *r, OSSL_LIB_CTX *libctx);
66
67int ossl_rsa_set0_all_params(RSA *r, STACK_OF(BIGNUM) *primes,
68 STACK_OF(BIGNUM) *exps,
69 STACK_OF(BIGNUM) *coeffs);
70int ossl_rsa_get0_all_params(RSA *r, STACK_OF(BIGNUM_const) *primes,
71 STACK_OF(BIGNUM_const) *exps,
72 STACK_OF(BIGNUM_const) *coeffs);
73int ossl_rsa_is_foreign(const RSA *rsa);
74RSA *ossl_rsa_dup(const RSA *rsa, int selection);
75
76int ossl_rsa_todata(RSA *rsa, OSSL_PARAM_BLD *bld, OSSL_PARAM params[],
77 int include_private);
78int ossl_rsa_fromdata(RSA *rsa, const OSSL_PARAM params[], int include_private);
79int ossl_rsa_pss_params_30_todata(const RSA_PSS_PARAMS_30 *pss,
80 OSSL_PARAM_BLD *bld, OSSL_PARAM params[]);
81int ossl_rsa_pss_params_30_fromdata(RSA_PSS_PARAMS_30 *pss_params,
82 int *defaults_set,
83 const OSSL_PARAM params[],
84 OSSL_LIB_CTX *libctx);
85int ossl_rsa_set0_pss_params(RSA *r, RSA_PSS_PARAMS *pss);
86int ossl_rsa_pss_get_param_unverified(const RSA_PSS_PARAMS *pss,
87 const EVP_MD **pmd, const EVP_MD **pmgf1md,
88 int *psaltlen, int *ptrailerField);
89RSA_PSS_PARAMS *ossl_rsa_pss_decode(const X509_ALGOR *alg);
90int ossl_rsa_param_decode(RSA *rsa, const X509_ALGOR *alg);
91RSA *ossl_rsa_key_from_pkcs8(const PKCS8_PRIV_KEY_INFO *p8inf,
92 OSSL_LIB_CTX *libctx, const char *propq);
93
94int ossl_rsa_padding_check_PKCS1_type_2(OSSL_LIB_CTX *ctx,
95 unsigned char *to, int tlen,
96 const unsigned char *from, int flen,
97 int num, unsigned char *kdk);
98int ossl_rsa_padding_check_PKCS1_type_2_TLS(OSSL_LIB_CTX *ctx, unsigned char *to,
99 size_t tlen,
100 const unsigned char *from,
101 size_t flen, int client_version,
102 int alt_version);
103int ossl_rsa_padding_add_PKCS1_OAEP_mgf1_ex(OSSL_LIB_CTX *libctx,
104 unsigned char *to, int tlen,
105 const unsigned char *from, int flen,
106 const unsigned char *param,
107 int plen, const EVP_MD *md,
108 const EVP_MD *mgf1md);
109
110int ossl_rsa_validate_public(const RSA *key);
111int ossl_rsa_validate_private(const RSA *key);
112int ossl_rsa_validate_pairwise(const RSA *key);
113
114int ossl_rsa_verify(int dtype, const unsigned char *m,
115 unsigned int m_len, unsigned char *rm,
116 size_t *prm_len, const unsigned char *sigbuf,
117 size_t siglen, RSA *rsa);
118
119const unsigned char *ossl_rsa_digestinfo_encoding(int md_nid, size_t *len);
120
121extern const char *ossl_rsa_mp_factor_names[];
122extern const char *ossl_rsa_mp_exp_names[];
123extern const char *ossl_rsa_mp_coeff_names[];
124
125ASN1_STRING *ossl_rsa_ctx_to_pss_string(EVP_PKEY_CTX *pkctx);
126int ossl_rsa_pss_to_ctx(EVP_MD_CTX *ctx, EVP_PKEY_CTX *pkctx,
127 const X509_ALGOR *sigalg, EVP_PKEY *pkey);
128
129# if defined(FIPS_MODULE) && !defined(OPENSSL_NO_ACVP_TESTS)
130int ossl_rsa_acvp_test_gen_params_new(OSSL_PARAM **dst, const OSSL_PARAM src[]);
131void ossl_rsa_acvp_test_gen_params_free(OSSL_PARAM *dst);
132
133int ossl_rsa_acvp_test_set_params(RSA *r, const OSSL_PARAM params[]);
134int ossl_rsa_acvp_test_get_params(RSA *r, OSSL_PARAM params[]);
135typedef struct rsa_acvp_test_st RSA_ACVP_TEST;
136void ossl_rsa_acvp_test_free(RSA_ACVP_TEST *t);
137# else
138# define RSA_ACVP_TEST void
139# endif
140int ossl_rsa_check_factors(RSA *r);
141
142RSA *evp_pkey_get1_RSA_PSS(EVP_PKEY *pkey);
143#endif
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette