1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Make the frankly ridiculous prototypes for modpow() and modmul() more sane

[originally from svn r752]
This commit is contained in:
Simon Tatham
2000-10-23 16:11:31 +00:00
parent bf2744aabf
commit e51b4da9f7
6 changed files with 33 additions and 34 deletions

View File

@ -65,7 +65,6 @@ void rsaencrypt(unsigned char *data, int length, struct RSAKey *key) {
w = (key->bytes+1)/2;
b1 = newbn(w);
b2 = newbn(w);
p = data;
for (i=1; i<=w; i++)
@ -78,7 +77,7 @@ void rsaencrypt(unsigned char *data, int length, struct RSAKey *key) {
b1[1+i/2] |= byte;
}
modpow(b1, key->exponent, key->modulus, b2);
b2 = modpow(b1, key->exponent, key->modulus);
p = data;
for (i=key->bytes; i-- ;) {
@ -96,8 +95,7 @@ void rsaencrypt(unsigned char *data, int length, struct RSAKey *key) {
Bignum rsadecrypt(Bignum input, struct RSAKey *key) {
Bignum ret;
ret = newbn(key->modulus[0]);
modpow(input, key->private_exponent, key->modulus, ret);
ret = modpow(input, key->private_exponent, key->modulus);
return ret;
}