Use gcc -ansi -pedantic in 9c. Fix many non-C89-isms.
This commit is contained in:
parent
226d80b821
commit
cbeb0b26e4
492 changed files with 3218 additions and 3167 deletions
|
|
@ -2,9 +2,9 @@
|
|||
#include <mp.h>
|
||||
#include <libsec.h>
|
||||
|
||||
// decrypt rsa using garner's algorithm for the chinese remainder theorem
|
||||
// seminumerical algorithms, knuth, pp 253-254
|
||||
// applied cryptography, menezes et al, pg 612
|
||||
/* decrypt rsa using garner's algorithm for the chinese remainder theorem */
|
||||
/* seminumerical algorithms, knuth, pp 253-254 */
|
||||
/* applied cryptography, menezes et al, pg 612 */
|
||||
mpint*
|
||||
rsadecrypt(RSApriv *rsa, mpint *in, mpint *out)
|
||||
{
|
||||
|
|
@ -13,17 +13,17 @@ rsadecrypt(RSApriv *rsa, mpint *in, mpint *out)
|
|||
if(out == nil)
|
||||
out = mpnew(0);
|
||||
|
||||
// convert in to modular representation
|
||||
/* convert in to modular representation */
|
||||
v1 = mpnew(0);
|
||||
mpmod(in, rsa->p, v1);
|
||||
v2 = mpnew(0);
|
||||
mpmod(in, rsa->q, v2);
|
||||
|
||||
// exponentiate the modular rep
|
||||
/* exponentiate the modular rep */
|
||||
mpexp(v1, rsa->kp, rsa->p, v1);
|
||||
mpexp(v2, rsa->kq, rsa->q, v2);
|
||||
|
||||
// out = v1 + p*((v2-v1)*c2 mod q)
|
||||
/* out = v1 + p*((v2-v1)*c2 mod q) */
|
||||
mpsub(v2, v1, v2);
|
||||
mpmul(v2, rsa->c2, v2);
|
||||
mpmod(v2, rsa->q, v2);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue