diff options
Diffstat (limited to 'rsa.c')
-rw-r--r-- | rsa.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -60,7 +60,7 @@ | |||
60 | */ | 60 | */ |
61 | 61 | ||
62 | #include "includes.h" | 62 | #include "includes.h" |
63 | RCSID("$OpenBSD: rsa.c,v 1.19 2001/01/21 19:05:54 markus Exp $"); | 63 | RCSID("$OpenBSD: rsa.c,v 1.20 2001/01/29 19:47:30 markus Exp $"); |
64 | 64 | ||
65 | #include "rsa.h" | 65 | #include "rsa.h" |
66 | #include "log.h" | 66 | #include "log.h" |
@@ -94,7 +94,7 @@ rsa_public_encrypt(BIGNUM *out, BIGNUM *in, RSA *key) | |||
94 | xfree(inbuf); | 94 | xfree(inbuf); |
95 | } | 95 | } |
96 | 96 | ||
97 | void | 97 | int |
98 | rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *key) | 98 | rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *key) |
99 | { | 99 | { |
100 | u_char *inbuf, *outbuf; | 100 | u_char *inbuf, *outbuf; |
@@ -108,13 +108,14 @@ rsa_private_decrypt(BIGNUM *out, BIGNUM *in, RSA *key) | |||
108 | BN_bn2bin(in, inbuf); | 108 | BN_bn2bin(in, inbuf); |
109 | 109 | ||
110 | if ((len = RSA_private_decrypt(ilen, inbuf, outbuf, key, | 110 | if ((len = RSA_private_decrypt(ilen, inbuf, outbuf, key, |
111 | RSA_PKCS1_PADDING)) <= 0) | 111 | RSA_PKCS1_PADDING)) <= 0) { |
112 | fatal("rsa_private_decrypt() failed"); | 112 | error("rsa_private_decrypt() failed"); |
113 | 113 | } else { | |
114 | BN_bin2bn(outbuf, len, out); | 114 | BN_bin2bn(outbuf, len, out); |
115 | 115 | } | |
116 | memset(outbuf, 0, olen); | 116 | memset(outbuf, 0, olen); |
117 | memset(inbuf, 0, ilen); | 117 | memset(inbuf, 0, ilen); |
118 | xfree(outbuf); | 118 | xfree(outbuf); |
119 | xfree(inbuf); | 119 | xfree(inbuf); |
120 | return len; | ||
120 | } | 121 | } |