X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=sshrsa.c;h=14cf09a6ba496213caf3e56e48df51f073dceaa1;hb=0990485276f7ea807da27d8f637dfab207f98a3b;hp=d39f8462f1f5743430431c15f6d168b787d3a2ba;hpb=aad0a52dfb453b77fa6c0b36fadf16ae4b19a30c;p=PuTTY.git diff --git a/sshrsa.c b/sshrsa.c index d39f8462..14cf09a6 100644 --- a/sshrsa.c +++ b/sshrsa.c @@ -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; } @@ -171,5 +169,5 @@ void freersakey(struct RSAKey *key) { if (key->modulus) freebn(key->modulus); if (key->exponent) freebn(key->exponent); if (key->private_exponent) freebn(key->private_exponent); - if (key->comment) free(key->comment); + if (key->comment) sfree(key->comment); }