summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/doc/RSA_set_method.pod
diff options
context:
space:
mode:
authorbeck <>2000-03-19 11:13:58 +0000
committerbeck <>2000-03-19 11:13:58 +0000
commit796d609550df3a33fc11468741c5d2f6d3df4c11 (patch)
tree6c6d539061caa20372dad0ac4ddb1dfae2fbe7fe /src/lib/libcrypto/doc/RSA_set_method.pod
parent5be3114c1fd7e0dfea1e38d3abb4cbba75244419 (diff)
downloadopenbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.gz
openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.tar.bz2
openbsd-796d609550df3a33fc11468741c5d2f6d3df4c11.zip
OpenSSL 0.9.5 merge
*warning* this bumps shared lib minors for libssl and libcrypto from 2.1 to 2.2 if you are using the ssl26 packages for ssh and other things to work you will need to get new ones (see ~beck/libsslsnap/<arch>) on cvs or ~beck/src-patent.tar.gz on cvs
Diffstat (limited to 'src/lib/libcrypto/doc/RSA_set_method.pod')
-rw-r--r--src/lib/libcrypto/doc/RSA_set_method.pod153
1 files changed, 153 insertions, 0 deletions
diff --git a/src/lib/libcrypto/doc/RSA_set_method.pod b/src/lib/libcrypto/doc/RSA_set_method.pod
new file mode 100644
index 0000000000..deb1183a23
--- /dev/null
+++ b/src/lib/libcrypto/doc/RSA_set_method.pod
@@ -0,0 +1,153 @@
1=pod
2
3=head1 NAME
4
5RSA_set_default_method, RSA_get_default_method, RSA_set_method,
6RSA_get_method, RSA_PKCS1_SSLeay, RSA_PKCS1_RSAref,
7RSA_PKCS1_null_method, RSA_flags, RSA_new_method - select RSA method
8
9=head1 SYNOPSIS
10
11 #include <openssl/rsa.h>
12
13 void RSA_set_default_method(RSA_METHOD *meth);
14
15 RSA_METHOD *RSA_get_default_method(void);
16
17 RSA_METHOD *RSA_set_method(RSA *rsa, RSA_METHOD *meth);
18
19 RSA_METHOD *RSA_get_method(RSA *rsa);
20
21 RSA_METHOD *RSA_PKCS1_SSLeay(void);
22
23 RSA_METHOD *RSA_PKCS1_RSAref(void);
24
25 RSA_METHOD *RSA_null_method(void);
26
27 int RSA_flags(RSA *rsa);
28
29 RSA *RSA_new_method(RSA_METHOD *method);
30
31=head1 DESCRIPTION
32
33An B<RSA_METHOD> specifies the functions that OpenSSL uses for RSA
34operations. By modifying the method, alternative implementations
35such as hardware accelerators may be used.
36
37Initially, the default is to use the OpenSSL internal implementation,
38unless OpenSSL was configured with the C<rsaref> or C<-DRSA_NULL>
39options. RSA_PKCS1_SSLeay() returns a pointer to that method.
40
41RSA_PKCS1_RSAref() returns a pointer to a method that uses the RSAref
42library. This is the default method in the C<rsaref> configuration;
43the function is not available in other configurations.
44RSA_null_method() returns a pointer to a method that does not support
45the RSA transformation. It is the default if OpenSSL is compiled with
46C<-DRSA_NULL>. These methods may be useful in the USA because of a
47patent on the RSA cryptosystem.
48
49RSA_set_default_method() makes B<meth> the default method for all B<RSA>
50structures created later.
51
52RSA_get_default_method() returns a pointer to the current default
53method.
54
55RSA_set_method() selects B<meth> for all operations using the key
56B<rsa>.
57
58RSA_get_method() returns a pointer to the method currently selected
59for B<rsa>.
60
61RSA_flags() returns the B<flags> that are set for B<rsa>'s current method.
62
63RSA_new_method() allocates and initializes an B<RSA> structure so that
64B<method> will be used for the RSA operations. If B<method> is B<NULL>,
65the default method is used.
66
67=head1 THE RSA_METHOD STRUCTURE
68
69 typedef struct rsa_meth_st
70 {
71 /* name of the implementation */
72 const char *name;
73
74 /* encrypt */
75 int (*rsa_pub_enc)(int flen, unsigned char *from,
76 unsigned char *to, RSA *rsa, int padding);
77
78 /* verify arbitrary data */
79 int (*rsa_pub_dec)(int flen, unsigned char *from,
80 unsigned char *to, RSA *rsa, int padding);
81
82 /* sign arbitrary data */
83 int (*rsa_priv_enc)(int flen, unsigned char *from,
84 unsigned char *to, RSA *rsa, int padding);
85
86 /* decrypt */
87 int (*rsa_priv_dec)(int flen, unsigned char *from,
88 unsigned char *to, RSA *rsa, int padding);
89
90 /* compute r0 = r0 ^ I mod rsa->n. May be NULL */
91 int (*rsa_mod_exp)(BIGNUM *r0, BIGNUM *I, RSA *rsa);
92
93 /* compute r = a ^ p mod m. May be NULL */
94 int (*bn_mod_exp)(BIGNUM *r, BIGNUM *a, const BIGNUM *p,
95 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);
96
97 /* called at RSA_new */
98 int (*init)(RSA *rsa);
99
100 /* called at RSA_free */
101 int (*finish)(RSA *rsa);
102
103 /* RSA_FLAG_EXT_PKEY - rsa_mod_exp is called for private key
104 * operations, even if p,q,dmp1,dmq1,iqmp
105 * are NULL
106 * RSA_FLAG_SIGN_VER - enable rsa_sign and rsa_verify
107 * RSA_METHOD_FLAG_NO_CHECK - don't check pub/private match
108 */
109 int flags;
110
111 char *app_data; /* ?? */
112
113 /* sign. For backward compatibility, this is used only
114 * if (flags & RSA_FLAG_SIGN_VER)
115 */
116 int (*rsa_sign)(int type, unsigned char *m, unsigned int m_len,
117 unsigned char *sigret, unsigned int *siglen, RSA *rsa);
118
119 /* verify. For backward compatibility, this is used only
120 * if (flags & RSA_FLAG_SIGN_VER)
121 */
122 int (*rsa_verify)(int type, unsigned char *m, unsigned int m_len,
123 unsigned char *sigbuf, unsigned int siglen, RSA *rsa);
124
125 } RSA_METHOD;
126
127=head1 RETURN VALUES
128
129RSA_PKCS1_SSLeay(), RSA_PKCS1_RSAref(), RSA_PKCS1_null_method(),
130RSA_get_default_method() and RSA_get_method() return pointers to the
131respective B<RSA_METHOD>s.
132
133RSA_set_default_method() returns no value.
134
135RSA_set_method() returns a pointer to the B<RSA_METHOD> previously
136associated with B<rsa>.
137
138RSA_new_method() returns B<NULL> and sets an error code that can be
139obtained by L<ERR_get_error(3)|ERR_get_error(3)> if the allocation fails. Otherwise it
140returns a pointer to the newly allocated structure.
141
142=head1 SEE ALSO
143
144L<rsa(3)|rsa(3)>, L<RSA_new(3)|RSA_new(3)>
145
146=head1 HISTORY
147
148RSA_new_method() and RSA_set_default_method() appeared in SSLeay 0.8.
149RSA_get_default_method(), RSA_set_method() and RSA_get_method() as
150well as the rsa_sign and rsa_verify components of RSA_METHOD were
151added in OpenSSL 0.9.4.
152
153=cut