--- pgp/src/mpilib.c 2018/04/24 16:38:25 1.1.1.2 +++ pgp/src/mpilib.c 2018/04/24 16:40:00 1.1.1.4 @@ -58,7 +58,11 @@ #ifdef DEBUG #ifdef MSDOS +#ifdef __GO32__ /* DJGPP */ +#include +#else #include +#endif /* __GO32__ */ #define poll_for_break() {while (kbhit()) getch();} #endif /* MSDOS */ #endif /* DEBUG */ @@ -534,13 +538,18 @@ int mp_mult(register unitptr prod, C9AB 6095 C62F 3756 3843 E4D0 3950 7AD9 We'll have to fix this some day. In the meantime, we'll just have the compiler skip over this code. + + BUG NOTE: Possibly fixed. Needs testing. */ int bits; register unit bitmask; unitptr product, mplier, temp; short mprec,mprec2; unit mplicand[MAX_UNIT_PRECISION]; - mp_init(prod,0); /* better clear full width--double precision */ + + /* better clear full width--double precision */ + mp_init(prod+tohigher(global_precision),0); + if (testeq(multiplicand,0)) return(0); /* zero multiplicand means zero product */ @@ -1292,7 +1301,6 @@ void upton_burn(void) so that no sensitive data is left in memory after the program exits. */ -static unit ALIGN modulus[MAX_UNIT_PRECISION]; static unit ALIGN ds_data[MAX_UNIT_PRECISION*2+2]; static unit mod_quotient [4]; @@ -1762,107 +1770,112 @@ int mp_modexp(register unitptr expout,re return(0); /* normal return */ } /* mp_modexp */ - - - -/********************************************************************* - RSA-specific routines follow. These are the only functions that - are specific to the RSA public key cryptosystem. The other - multiprecision integer math functions may be used for non-RSA - applications. - - The RSA public key cryptosystem is patented by the Massachusetts - Institute of Technology (U.S. patent #4,405,829). This patent does - not apply outside the USA. Public Key Partners (PKP) holds the - exclusive commercial license to sell and sub-license the RSA public - key cryptosystem. The author of this software implementation of the - RSA algorithm is providing this software for educational use only. - Licensing this algorithm from PKP is the responsibility of you, the - user, not Philip Zimmermann, the author of this software. The author - assumes no liability for any breach of patent law resulting from the - unlicensed use of this software by the user. -*********************************************************************/ - - -int rsa_decrypt(unitptr M, unitptr C, - unitptr d, unitptr p, unitptr q, unitptr u) - /* Uses Quisquater's Chinese Remainder Theorem shortcut - for RSA decryption. - M is the output plaintext message. - C is the input ciphertext message. - d is the secret decryption exponent. - p and q are the secret prime factors of n. - u is the multiplicative inverse of p, mod q. - Note that u is precomputed on the assumption that p= 0) /* ensure that p