diff options
Diffstat (limited to 'scard.c')
-rw-r--r-- | scard.c | 21 |
1 files changed, 19 insertions, 2 deletions
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #ifdef SMARTCARD | 25 | #ifdef SMARTCARD |
26 | #include "includes.h" | 26 | #include "includes.h" |
27 | RCSID("$OpenBSD: scard.c,v 1.11 2001/08/01 22:03:33 markus Exp $"); | 27 | RCSID("$OpenBSD: scard.c,v 1.12 2001/08/01 23:38:45 markus Exp $"); |
28 | 28 | ||
29 | #include <openssl/engine.h> | 29 | #include <openssl/engine.h> |
30 | #include <sectok.h> | 30 | #include <sectok.h> |
@@ -262,6 +262,20 @@ err: | |||
262 | return (len >= 0 ? len : status); | 262 | return (len >= 0 ? len : status); |
263 | } | 263 | } |
264 | 264 | ||
265 | /* called on free */ | ||
266 | |||
267 | static int (*orig_finish)(RSA *rsa) = NULL; | ||
268 | |||
269 | static int | ||
270 | sc_finish(RSA *rsa) | ||
271 | { | ||
272 | if (orig_finish) | ||
273 | orig_finish(rsa); | ||
274 | sc_close(); | ||
275 | return 1; | ||
276 | } | ||
277 | |||
278 | |||
265 | /* engine for overloading private key operations */ | 279 | /* engine for overloading private key operations */ |
266 | 280 | ||
267 | static ENGINE *smart_engine = NULL; | 281 | static ENGINE *smart_engine = NULL; |
@@ -291,13 +305,16 @@ sc_get_engine(void) | |||
291 | smart_rsa.rsa_priv_enc = sc_private_encrypt; | 305 | smart_rsa.rsa_priv_enc = sc_private_encrypt; |
292 | smart_rsa.rsa_priv_dec = sc_private_decrypt; | 306 | smart_rsa.rsa_priv_dec = sc_private_decrypt; |
293 | 307 | ||
308 | /* save original */ | ||
309 | orig_finish = def->finish; | ||
310 | smart_rsa.finish = sc_finish; | ||
311 | |||
294 | /* just use the OpenSSL version */ | 312 | /* just use the OpenSSL version */ |
295 | smart_rsa.rsa_pub_enc = def->rsa_pub_enc; | 313 | smart_rsa.rsa_pub_enc = def->rsa_pub_enc; |
296 | smart_rsa.rsa_pub_dec = def->rsa_pub_dec; | 314 | smart_rsa.rsa_pub_dec = def->rsa_pub_dec; |
297 | smart_rsa.rsa_mod_exp = def->rsa_mod_exp; | 315 | smart_rsa.rsa_mod_exp = def->rsa_mod_exp; |
298 | smart_rsa.bn_mod_exp = def->bn_mod_exp; | 316 | smart_rsa.bn_mod_exp = def->bn_mod_exp; |
299 | smart_rsa.init = def->init; | 317 | smart_rsa.init = def->init; |
300 | smart_rsa.finish = def->finish; | ||
301 | smart_rsa.flags = def->flags; | 318 | smart_rsa.flags = def->flags; |
302 | smart_rsa.app_data = def->app_data; | 319 | smart_rsa.app_data = def->app_data; |
303 | smart_rsa.rsa_sign = def->rsa_sign; | 320 | smart_rsa.rsa_sign = def->rsa_sign; |