X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=blobdiff_plain;f=lib%2Fsilccrypt%2Frsa_internal.h;h=425ce6a96e57b0359d4b75994248e23e0b560fbc;hp=22904bbfd1e70efa475cd59eae187c0efc0c980c;hb=c257b555225193e54d85daf541d29578b3c93882;hpb=f658940d02cf2fd893296b6a7825b42502573668 diff --git a/lib/silccrypt/rsa_internal.h b/lib/silccrypt/rsa_internal.h index 22904bbf..425ce6a9 100644 --- a/lib/silccrypt/rsa_internal.h +++ b/lib/silccrypt/rsa_internal.h @@ -2,15 +2,15 @@ rsa_internal.h - Author: Pekka Riikonen + Author: Pekka Riikonen - Copyright (C) 1997 - 2000 Pekka Riikonen + Copyright (C) 1997 - 2003 Pekka Riikonen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the @@ -24,17 +24,24 @@ /* RSA Keys, includes both Private and Public key */ typedef struct { int bits; /* bits in key */ - char pub_set; /* TRUE is n and e is set */ - char prv_set; /* TRUE if d is set */ SilcMPInt n; /* modulus */ SilcMPInt e; /* public exponent */ - SilcMPInt d; /* private exponent */ + SilcMPInt d; /* private exponent (no CRT) */ + SilcMPInt p; /* p */ + SilcMPInt q; /* q */ + SilcMPInt dP; /* CRT, d mod p - 1 */ + SilcMPInt dQ; /* CRT, d mod q - 1 */ + SilcMPInt pQ; /* CRT, p * (p ^ -1 mod q) mod n */ + SilcMPInt qP; /* CRT, q * (q ^ -1 mod p) mod n */ + unsigned int pub_set : 1; /* TRUE if n and e is set */ + unsigned int prv_set : 1; /* TRUE if d is set */ + unsigned int crt : 1; /* TRUE if CRT is used */ } RsaKey; -void rsa_generate_keys(RsaKey *key, SilcUInt32 bits, +bool rsa_generate_keys(RsaKey *key, SilcUInt32 bits, SilcMPInt *p, SilcMPInt *q); -void rsa_clear_keys(RsaKey *key); -void rsa_en_de_crypt(SilcMPInt *cm, SilcMPInt *mc, - SilcMPInt *expo, SilcMPInt *modu); +bool rsa_clear_keys(RsaKey *key); +bool rsa_public_operation(RsaKey *key, SilcMPInt *src, SilcMPInt *dst); +bool rsa_private_operation(RsaKey *key, SilcMPInt *src, SilcMPInt *dst); #endif