summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_local.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/libcrypto/rsa/rsa_local.h154
1 files changed, 0 insertions, 154 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_local.h b/src/lib/libcrypto/rsa/rsa_local.h
deleted file mode 100644
index 3f88b952a2..0000000000
--- a/src/lib/libcrypto/rsa/rsa_local.h
+++ /dev/null
@@ -1,154 +0,0 @@
1/* $OpenBSD: rsa_local.h,v 1.10 2025/01/05 15:39:12 tb Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58
59__BEGIN_HIDDEN_DECLS
60
61#define RSA_MIN_MODULUS_BITS 512
62
63struct rsa_meth_st {
64 char *name;
65 int (*rsa_pub_enc)(int flen, const unsigned char *from,
66 unsigned char *to, RSA *rsa, int padding);
67 int (*rsa_pub_dec)(int flen, const unsigned char *from,
68 unsigned char *to, RSA *rsa, int padding);
69 int (*rsa_priv_enc)(int flen, const unsigned char *from,
70 unsigned char *to, RSA *rsa, int padding);
71 int (*rsa_priv_dec)(int flen, const unsigned char *from,
72 unsigned char *to, RSA *rsa, int padding);
73 int (*rsa_mod_exp)(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
74 BN_CTX *ctx); /* Can be null */
75 int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
76 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); /* Can be null */
77 int (*init)(RSA *rsa); /* called at new */
78 int (*finish)(RSA *rsa); /* called at free */
79 int flags; /* RSA_METHOD_FLAG_* things */
80 char *app_data; /* may be needed! */
81/* New sign and verify functions: some libraries don't allow arbitrary data
82 * to be signed/verified: this allows them to be used. Note: for this to work
83 * the RSA_public_decrypt() and RSA_private_encrypt() should *NOT* be used
84 * RSA_sign(), RSA_verify() should be used instead.
85 */
86 int (*rsa_sign)(int type, const unsigned char *m, unsigned int m_length,
87 unsigned char *sigret, unsigned int *siglen, const RSA *rsa);
88 int (*rsa_verify)(int dtype, const unsigned char *m,
89 unsigned int m_length, const unsigned char *sigbuf,
90 unsigned int siglen, const RSA *rsa);
91/* If this callback is NULL, the builtin software RSA key-gen will be used. This
92 * is for behavioural compatibility whilst the code gets rewired, but one day
93 * it would be nice to assume there are no such things as "builtin software"
94 * implementations. */
95 int (*rsa_keygen)(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb);
96};
97
98struct rsa_st {
99 long version;
100 const RSA_METHOD *meth;
101
102 BIGNUM *n;
103 BIGNUM *e;
104 BIGNUM *d;
105 BIGNUM *p;
106 BIGNUM *q;
107 BIGNUM *dmp1;
108 BIGNUM *dmq1;
109 BIGNUM *iqmp;
110
111 /* Parameter restrictions for PSS only keys. */
112 RSA_PSS_PARAMS *pss;
113
114 /* be careful using this if the RSA structure is shared */
115 CRYPTO_EX_DATA ex_data;
116 int references;
117 int flags;
118
119 /* Used to cache montgomery values */
120 BN_MONT_CTX *_method_mod_n;
121 BN_MONT_CTX *_method_mod_p;
122 BN_MONT_CTX *_method_mod_q;
123
124 /* all BIGNUM values are actually in the following data, if it is not
125 * NULL */
126 BN_BLINDING *blinding;
127 BN_BLINDING *mt_blinding;
128};
129
130RSA_PSS_PARAMS *rsa_pss_params_create(const EVP_MD *sigmd, const EVP_MD *mgf1md,
131 int saltlen);
132int rsa_pss_get_param(const RSA_PSS_PARAMS *pss, const EVP_MD **pmd,
133 const EVP_MD **pmgf1md, int *psaltlen);
134
135extern int int_rsa_verify(int dtype, const unsigned char *m,
136 unsigned int m_len, unsigned char *rm, size_t *prm_len,
137 const unsigned char *sigbuf, size_t siglen, RSA *rsa);
138
139int RSA_padding_add_X931(unsigned char *to, int tlen,
140 const unsigned char *f, int fl);
141int RSA_padding_check_X931(unsigned char *to, int tlen,
142 const unsigned char *f, int fl, int rsa_len);
143int RSA_X931_hash_id(int nid);
144
145BN_BLINDING *BN_BLINDING_new(const BIGNUM *e, const BIGNUM *mod, BN_CTX *ctx,
146 int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
147 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), BN_MONT_CTX *m_ctx);
148void BN_BLINDING_free(BN_BLINDING *b);
149int BN_BLINDING_convert(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
150int BN_BLINDING_invert(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *);
151int BN_BLINDING_is_local(BN_BLINDING *b);
152BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *ctx);
153
154__END_HIDDEN_DECLS