summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgilles <>2019-06-05 15:41:33 +0000
committergilles <>2019-06-05 15:41:33 +0000
commit47eafa9f3ab473cf14319312cf30f3c8400f0b78 (patch)
tree946aa9d27a34e95cfd0b0f350d38ac577626558d
parenta7450720d741cb1de9f85ff969a0cc0510ce0202 (diff)
downloadopenbsd-47eafa9f3ab473cf14319312cf30f3c8400f0b78.tar.gz
openbsd-47eafa9f3ab473cf14319312cf30f3c8400f0b78.tar.bz2
openbsd-47eafa9f3ab473cf14319312cf30f3c8400f0b78.zip
provide getters and setters for the RSA_METHOD interface
ok tb@, jsing@, sthen@
-rw-r--r--src/lib/libcrypto/Symbols.list23
-rw-r--r--src/lib/libcrypto/rsa/rsa.h49
-rw-r--r--src/lib/libcrypto/rsa/rsa_meth.c173
-rw-r--r--src/lib/libcrypto/shlib_version2
-rw-r--r--src/lib/libssl/shlib_version2
-rw-r--r--src/lib/libtls/shlib_version2
6 files changed, 246 insertions, 5 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list
index 9a8eacc8e3..e56bb9ca5c 100644
--- a/src/lib/libcrypto/Symbols.list
+++ b/src/lib/libcrypto/Symbols.list
@@ -2313,12 +2313,35 @@ RSA_get_ex_new_index
2313RSA_get_method 2313RSA_get_method
2314RSA_meth_dup 2314RSA_meth_dup
2315RSA_meth_free 2315RSA_meth_free
2316RSA_meth_get0_app_data
2317RSA_meth_get0_name
2318RSA_meth_get_bn_mod_exp
2316RSA_meth_get_finish 2319RSA_meth_get_finish
2320RSA_meth_get_flags
2321RSA_meth_get_init
2322RSA_meth_get_keygen
2323RSA_meth_get_mod_exp
2324RSA_meth_get_priv_dec
2325RSA_meth_get_priv_enc
2326RSA_meth_get_pub_dec
2327RSA_meth_get_pub_enc
2328RSA_meth_get_sign
2329RSA_meth_get_verify
2317RSA_meth_new 2330RSA_meth_new
2331RSA_meth_set0_app_data
2318RSA_meth_set1_name 2332RSA_meth_set1_name
2333RSA_meth_set_bn_mod_exp
2319RSA_meth_set_finish 2334RSA_meth_set_finish
2335RSA_meth_set_flags
2336RSA_meth_set_init
2337RSA_meth_set_keygen
2338RSA_meth_set_mod_exp
2320RSA_meth_set_priv_dec 2339RSA_meth_set_priv_dec
2321RSA_meth_set_priv_enc 2340RSA_meth_set_priv_enc
2341RSA_meth_set_pub_dec
2342RSA_meth_set_pub_enc
2343RSA_meth_set_sign
2344RSA_meth_set_verify
2322RSA_new 2345RSA_new
2323RSA_new_method 2346RSA_new_method
2324RSA_padding_add_PKCS1_OAEP 2347RSA_padding_add_PKCS1_OAEP
diff --git a/src/lib/libcrypto/rsa/rsa.h b/src/lib/libcrypto/rsa/rsa.h
index d2df1a92d3..2aa472f501 100644
--- a/src/lib/libcrypto/rsa/rsa.h
+++ b/src/lib/libcrypto/rsa/rsa.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa.h,v 1.39 2018/09/12 06:35:38 djm Exp $ */ 1/* $OpenBSD: rsa.h,v 1.40 2019/06/05 15:41:33 gilles Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -440,6 +440,53 @@ int RSA_meth_set_priv_dec(RSA_METHOD *meth, int (*priv_dec)(int flen,
440 const unsigned char *from, unsigned char *to, RSA *rsa, int padding)); 440 const unsigned char *from, unsigned char *to, RSA *rsa, int padding));
441int (*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa); 441int (*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa);
442int RSA_meth_set_finish(RSA_METHOD *meth, int (*finish)(RSA *rsa)); 442int RSA_meth_set_finish(RSA_METHOD *meth, int (*finish)(RSA *rsa));
443int RSA_meth_set_pub_enc(RSA_METHOD *meth, int (*pub_enc)(int flen,
444 const unsigned char *from, unsigned char *to, RSA *rsa, int padding));
445int RSA_meth_set_pub_dec(RSA_METHOD *meth, int (*pub_dec)(int flen,
446 const unsigned char *from, unsigned char *to, RSA *rsa, int padding));
447int RSA_meth_set_mod_exp(RSA_METHOD *meth, int (*mod_exp)(BIGNUM *r0,
448 const BIGNUM *i, RSA *rsa, BN_CTX *ctx));
449int RSA_meth_set_bn_mod_exp(RSA_METHOD *meth, int (*bn_mod_exp)(BIGNUM *r,
450 const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
451 BN_MONT_CTX *m_ctx));
452int RSA_meth_set_init(RSA_METHOD *meth, int (*init)(RSA *rsa));
453int RSA_meth_set_keygen(RSA_METHOD *meth, int (*keygen)(RSA *rsa, int bits,
454 BIGNUM *e, BN_GENCB *cb));
455int RSA_meth_set_flags(RSA_METHOD *meth, int flags);
456int RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data);
457const char *RSA_meth_get0_name(const RSA_METHOD *);
458int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth))(int flen,
459 const unsigned char *from, unsigned char *to, RSA *rsa, int padding);
460int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth))(int flen,
461 const unsigned char *from, unsigned char *to, RSA *rsa, int padding);
462int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth))(int flen,
463 const unsigned char *from, unsigned char *to, RSA *rsa, int padding);
464int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth))(int flen,
465 const unsigned char *from, unsigned char *to, RSA *rsa, int padding);
466int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth))(BIGNUM *r0, const BIGNUM *i,
467 RSA *rsa, BN_CTX *ctx);
468int (*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth))(BIGNUM *r,
469 const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
470 BN_MONT_CTX *m_ctx);
471int (*RSA_meth_get_init(const RSA_METHOD *meth))(RSA *rsa);
472int (*RSA_meth_get_keygen(const RSA_METHOD *meth))(RSA *rsa, int bits, BIGNUM *e,
473 BN_GENCB *cb);
474int RSA_meth_get_flags(const RSA_METHOD *meth);
475void *RSA_meth_get0_app_data(const RSA_METHOD *meth);
476int (*RSA_meth_get_sign(const RSA_METHOD *meth))(int type,
477 const unsigned char *m, unsigned int m_length,
478 unsigned char *sigret, unsigned int *siglen,
479 const RSA *rsa);
480int RSA_meth_set_sign(RSA_METHOD *rsa, int (*sign)(int type,
481 const unsigned char *m, unsigned int m_length, unsigned char *sigret,
482 unsigned int *siglen, const RSA *rsa));
483int (*RSA_meth_get_verify(const RSA_METHOD *meth))(int dtype,
484 const unsigned char *m, unsigned int m_length, const unsigned char *sigbuf,
485 unsigned int siglen, const RSA *rsa);
486int RSA_meth_set_verify(RSA_METHOD *rsa, int (*verify)(int dtype,
487 const unsigned char *m, unsigned int m_length, const unsigned char *sigbuf,
488 unsigned int siglen, const RSA *rsa));
489
443 490
444/* BEGIN ERROR CODES */ 491/* BEGIN ERROR CODES */
445/* The following lines are auto generated by the script mkerr.pl. Any changes 492/* The following lines are auto generated by the script mkerr.pl. Any changes
diff --git a/src/lib/libcrypto/rsa/rsa_meth.c b/src/lib/libcrypto/rsa/rsa_meth.c
index ae613cc65c..095368b0cf 100644
--- a/src/lib/libcrypto/rsa/rsa_meth.c
+++ b/src/lib/libcrypto/rsa/rsa_meth.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_meth.c,v 1.2 2018/09/12 06:35:38 djm Exp $ */ 1/* $OpenBSD: rsa_meth.c,v 1.3 2019/06/05 15:41:33 gilles Exp $ */
2/* 2/*
3 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2018 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -102,3 +102,174 @@ RSA_meth_set_finish(RSA_METHOD *meth, int (*finish)(RSA *rsa))
102 meth->finish = finish; 102 meth->finish = finish;
103 return 1; 103 return 1;
104} 104}
105
106int
107RSA_meth_set_pub_enc(RSA_METHOD *meth, int (*pub_enc)(int flen,
108 const unsigned char *from, unsigned char *to, RSA *rsa, int padding))
109{
110 meth->rsa_pub_enc = pub_enc;
111 return 1;
112}
113
114int
115RSA_meth_set_pub_dec(RSA_METHOD *meth, int (*pub_dec)(int flen,
116 const unsigned char *from, unsigned char *to, RSA *rsa, int padding))
117{
118 meth->rsa_pub_dec = pub_dec;
119 return 1;
120}
121
122int
123RSA_meth_set_mod_exp(RSA_METHOD *meth, int (*mod_exp)(BIGNUM *r0,
124 const BIGNUM *i, RSA *rsa, BN_CTX *ctx))
125{
126 meth->rsa_mod_exp = mod_exp;
127 return 1;
128}
129
130int
131RSA_meth_set_bn_mod_exp(RSA_METHOD *meth, int (*bn_mod_exp)(BIGNUM *r,
132 const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
133 BN_MONT_CTX *m_ctx))
134{
135 meth->bn_mod_exp = bn_mod_exp;
136 return 1;
137}
138
139int
140RSA_meth_set_init(RSA_METHOD *meth, int (*init)(RSA *rsa))
141{
142 meth->init = init;
143 return 1;
144}
145
146int
147RSA_meth_set_keygen(RSA_METHOD *meth, int (*keygen)(RSA *rsa, int bits,
148 BIGNUM *e, BN_GENCB *cb))
149{
150 meth->rsa_keygen = keygen;
151 return 1;
152}
153
154int
155RSA_meth_set_flags(RSA_METHOD *meth, int flags)
156{
157 meth->flags = flags;
158 return 1;
159}
160
161int
162RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data)
163{
164 meth->app_data = app_data;
165 return 1;
166}
167
168const char *
169RSA_meth_get0_name(const RSA_METHOD *meth)
170{
171 return meth->name;
172}
173
174int
175(*RSA_meth_get_pub_enc(const RSA_METHOD *meth))(int flen,
176 const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
177{
178 return meth->rsa_pub_enc;
179}
180
181int
182(*RSA_meth_get_pub_dec(const RSA_METHOD *meth))(int flen,
183 const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
184{
185 return meth->rsa_pub_dec;
186}
187
188int
189(*RSA_meth_get_priv_enc(const RSA_METHOD *meth))(int flen,
190 const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
191{
192 return meth->rsa_priv_enc;
193}
194
195int
196(*RSA_meth_get_priv_dec(const RSA_METHOD *meth))(int flen,
197 const unsigned char *from, unsigned char *to, RSA *rsa, int padding)
198{
199 return meth->rsa_priv_dec;
200}
201
202int
203(*RSA_meth_get_mod_exp(const RSA_METHOD *meth))(BIGNUM *r0, const BIGNUM *i,
204 RSA *rsa, BN_CTX *ctx)
205{
206 return meth->rsa_mod_exp;
207}
208
209int
210(*RSA_meth_get_bn_mod_exp(const RSA_METHOD *meth))(BIGNUM *r,
211 const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,
212 BN_MONT_CTX *m_ctx)
213{
214 return meth->bn_mod_exp;
215}
216
217int
218(*RSA_meth_get_init(const RSA_METHOD *meth))(RSA *rsa)
219{
220 return meth->init;
221}
222
223int
224(*RSA_meth_get_keygen(const RSA_METHOD *meth))(RSA *rsa, int bits, BIGNUM *e,
225 BN_GENCB *cb)
226{
227 return meth->rsa_keygen;
228}
229
230int
231RSA_meth_get_flags(const RSA_METHOD *meth)
232{
233 return meth->flags;
234}
235
236void *
237RSA_meth_get0_app_data(const RSA_METHOD *meth)
238{
239 return meth->app_data;
240}
241
242int
243(*RSA_meth_get_sign(const RSA_METHOD *meth))(int type,
244 const unsigned char *m, unsigned int m_length,
245 unsigned char *sigret, unsigned int *siglen,
246 const RSA *rsa)
247{
248 return meth->rsa_sign;
249}
250
251int
252RSA_meth_set_sign(RSA_METHOD *meth, int (*sign)(int type,
253 const unsigned char *m, unsigned int m_length, unsigned char *sigret,
254 unsigned int *siglen, const RSA *rsa))
255{
256 meth->rsa_sign = sign;
257 return 1;
258}
259
260int
261(*RSA_meth_get_verify(const RSA_METHOD *meth))(int dtype,
262 const unsigned char *m, unsigned int m_length, const unsigned char *sigbuf,
263 unsigned int siglen, const RSA *rsa)
264{
265 return meth->rsa_verify;
266}
267
268int
269RSA_meth_set_verify(RSA_METHOD *meth, int (*verify)(int dtype,
270 const unsigned char *m, unsigned int m_length, const unsigned char *sigbuf,
271 unsigned int siglen, const RSA *rsa))
272{
273 meth->rsa_verify = verify;
274 return 1;
275}
diff --git a/src/lib/libcrypto/shlib_version b/src/lib/libcrypto/shlib_version
index 7fd5c8dff5..fba3a63c14 100644
--- a/src/lib/libcrypto/shlib_version
+++ b/src/lib/libcrypto/shlib_version
@@ -1,3 +1,3 @@
1# Don't forget to give libssl and libtls the same type of bump! 1# Don't forget to give libssl and libtls the same type of bump!
2major=45 2major=45
3minor=4 3minor=5
diff --git a/src/lib/libssl/shlib_version b/src/lib/libssl/shlib_version
index e62616fcc7..ca41197851 100644
--- a/src/lib/libssl/shlib_version
+++ b/src/lib/libssl/shlib_version
@@ -1,3 +1,3 @@
1# Don't forget to give libtls the same type of bump! 1# Don't forget to give libtls the same type of bump!
2major=47 2major=47
3minor=5 3minor=6
diff --git a/src/lib/libtls/shlib_version b/src/lib/libtls/shlib_version
index 162fae370d..14c02159bb 100644
--- a/src/lib/libtls/shlib_version
+++ b/src/lib/libtls/shlib_version
@@ -1,2 +1,2 @@
1major=19 1major=19
2minor=6 2minor=7