diff options
author | gilles <> | 2019-06-05 15:41:33 +0000 |
---|---|---|
committer | gilles <> | 2019-06-05 15:41:33 +0000 |
commit | 47eafa9f3ab473cf14319312cf30f3c8400f0b78 (patch) | |
tree | 946aa9d27a34e95cfd0b0f350d38ac577626558d | |
parent | a7450720d741cb1de9f85ff969a0cc0510ce0202 (diff) | |
download | openbsd-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.list | 23 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa.h | 49 | ||||
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_meth.c | 173 | ||||
-rw-r--r-- | src/lib/libcrypto/shlib_version | 2 | ||||
-rw-r--r-- | src/lib/libssl/shlib_version | 2 | ||||
-rw-r--r-- | src/lib/libtls/shlib_version | 2 |
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 | |||
2313 | RSA_get_method | 2313 | RSA_get_method |
2314 | RSA_meth_dup | 2314 | RSA_meth_dup |
2315 | RSA_meth_free | 2315 | RSA_meth_free |
2316 | RSA_meth_get0_app_data | ||
2317 | RSA_meth_get0_name | ||
2318 | RSA_meth_get_bn_mod_exp | ||
2316 | RSA_meth_get_finish | 2319 | RSA_meth_get_finish |
2320 | RSA_meth_get_flags | ||
2321 | RSA_meth_get_init | ||
2322 | RSA_meth_get_keygen | ||
2323 | RSA_meth_get_mod_exp | ||
2324 | RSA_meth_get_priv_dec | ||
2325 | RSA_meth_get_priv_enc | ||
2326 | RSA_meth_get_pub_dec | ||
2327 | RSA_meth_get_pub_enc | ||
2328 | RSA_meth_get_sign | ||
2329 | RSA_meth_get_verify | ||
2317 | RSA_meth_new | 2330 | RSA_meth_new |
2331 | RSA_meth_set0_app_data | ||
2318 | RSA_meth_set1_name | 2332 | RSA_meth_set1_name |
2333 | RSA_meth_set_bn_mod_exp | ||
2319 | RSA_meth_set_finish | 2334 | RSA_meth_set_finish |
2335 | RSA_meth_set_flags | ||
2336 | RSA_meth_set_init | ||
2337 | RSA_meth_set_keygen | ||
2338 | RSA_meth_set_mod_exp | ||
2320 | RSA_meth_set_priv_dec | 2339 | RSA_meth_set_priv_dec |
2321 | RSA_meth_set_priv_enc | 2340 | RSA_meth_set_priv_enc |
2341 | RSA_meth_set_pub_dec | ||
2342 | RSA_meth_set_pub_enc | ||
2343 | RSA_meth_set_sign | ||
2344 | RSA_meth_set_verify | ||
2322 | RSA_new | 2345 | RSA_new |
2323 | RSA_new_method | 2346 | RSA_new_method |
2324 | RSA_padding_add_PKCS1_OAEP | 2347 | RSA_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)); |
441 | int (*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa); | 441 | int (*RSA_meth_get_finish(const RSA_METHOD *meth))(RSA *rsa); |
442 | int RSA_meth_set_finish(RSA_METHOD *meth, int (*finish)(RSA *rsa)); | 442 | int RSA_meth_set_finish(RSA_METHOD *meth, int (*finish)(RSA *rsa)); |
443 | int 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)); | ||
445 | int 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)); | ||
447 | int RSA_meth_set_mod_exp(RSA_METHOD *meth, int (*mod_exp)(BIGNUM *r0, | ||
448 | const BIGNUM *i, RSA *rsa, BN_CTX *ctx)); | ||
449 | int 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)); | ||
452 | int RSA_meth_set_init(RSA_METHOD *meth, int (*init)(RSA *rsa)); | ||
453 | int RSA_meth_set_keygen(RSA_METHOD *meth, int (*keygen)(RSA *rsa, int bits, | ||
454 | BIGNUM *e, BN_GENCB *cb)); | ||
455 | int RSA_meth_set_flags(RSA_METHOD *meth, int flags); | ||
456 | int RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data); | ||
457 | const char *RSA_meth_get0_name(const RSA_METHOD *); | ||
458 | int (*RSA_meth_get_pub_enc(const RSA_METHOD *meth))(int flen, | ||
459 | const unsigned char *from, unsigned char *to, RSA *rsa, int padding); | ||
460 | int (*RSA_meth_get_pub_dec(const RSA_METHOD *meth))(int flen, | ||
461 | const unsigned char *from, unsigned char *to, RSA *rsa, int padding); | ||
462 | int (*RSA_meth_get_priv_enc(const RSA_METHOD *meth))(int flen, | ||
463 | const unsigned char *from, unsigned char *to, RSA *rsa, int padding); | ||
464 | int (*RSA_meth_get_priv_dec(const RSA_METHOD *meth))(int flen, | ||
465 | const unsigned char *from, unsigned char *to, RSA *rsa, int padding); | ||
466 | int (*RSA_meth_get_mod_exp(const RSA_METHOD *meth))(BIGNUM *r0, const BIGNUM *i, | ||
467 | RSA *rsa, BN_CTX *ctx); | ||
468 | int (*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); | ||
471 | int (*RSA_meth_get_init(const RSA_METHOD *meth))(RSA *rsa); | ||
472 | int (*RSA_meth_get_keygen(const RSA_METHOD *meth))(RSA *rsa, int bits, BIGNUM *e, | ||
473 | BN_GENCB *cb); | ||
474 | int RSA_meth_get_flags(const RSA_METHOD *meth); | ||
475 | void *RSA_meth_get0_app_data(const RSA_METHOD *meth); | ||
476 | int (*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); | ||
480 | int 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)); | ||
483 | int (*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); | ||
486 | int 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 | |||
106 | int | ||
107 | RSA_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 | |||
114 | int | ||
115 | RSA_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 | |||
122 | int | ||
123 | RSA_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 | |||
130 | int | ||
131 | RSA_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 | |||
139 | int | ||
140 | RSA_meth_set_init(RSA_METHOD *meth, int (*init)(RSA *rsa)) | ||
141 | { | ||
142 | meth->init = init; | ||
143 | return 1; | ||
144 | } | ||
145 | |||
146 | int | ||
147 | RSA_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 | |||
154 | int | ||
155 | RSA_meth_set_flags(RSA_METHOD *meth, int flags) | ||
156 | { | ||
157 | meth->flags = flags; | ||
158 | return 1; | ||
159 | } | ||
160 | |||
161 | int | ||
162 | RSA_meth_set0_app_data(RSA_METHOD *meth, void *app_data) | ||
163 | { | ||
164 | meth->app_data = app_data; | ||
165 | return 1; | ||
166 | } | ||
167 | |||
168 | const char * | ||
169 | RSA_meth_get0_name(const RSA_METHOD *meth) | ||
170 | { | ||
171 | return meth->name; | ||
172 | } | ||
173 | |||
174 | int | ||
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 | |||
181 | int | ||
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 | |||
188 | int | ||
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 | |||
195 | int | ||
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 | |||
202 | int | ||
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 | |||
209 | int | ||
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 | |||
217 | int | ||
218 | (*RSA_meth_get_init(const RSA_METHOD *meth))(RSA *rsa) | ||
219 | { | ||
220 | return meth->init; | ||
221 | } | ||
222 | |||
223 | int | ||
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 | |||
230 | int | ||
231 | RSA_meth_get_flags(const RSA_METHOD *meth) | ||
232 | { | ||
233 | return meth->flags; | ||
234 | } | ||
235 | |||
236 | void * | ||
237 | RSA_meth_get0_app_data(const RSA_METHOD *meth) | ||
238 | { | ||
239 | return meth->app_data; | ||
240 | } | ||
241 | |||
242 | int | ||
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 | |||
251 | int | ||
252 | RSA_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 | |||
260 | int | ||
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 | |||
268 | int | ||
269 | RSA_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! |
2 | major=45 | 2 | major=45 |
3 | minor=4 | 3 | minor=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! |
2 | major=47 | 2 | major=47 |
3 | minor=5 | 3 | minor=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 @@ | |||
1 | major=19 | 1 | major=19 |
2 | minor=6 | 2 | minor=7 |