Граф коммитов

381 Коммитов

Автор SHA1 Сообщение Дата
mcgreer%netscape.com d27b33644d handle leading zeroes in q bug (66558). suggested by nicolson; r=mcgreer,a=wtc 2001-01-29 14:24:57 +00:00
wtc%netscape.com 752be879db Bugzilla bug #66286: link libnss3.so with -R '$ORIGIN' on Solaris so that
it searches for libfreebl_*.so in the same directory where it resides.
As a result, libnss3.so, not libnspr4.so, must be the one calling dlopen,
so libnss3.so can't call PR_LoadLibraryWithFlags.
Modified files: lib/freebl/loader.c, lib/nss/config.mk
2001-01-24 05:26:19 +00:00
mcgreer%netscape.com 73586118bb fixes for prime generatation:
1.  Increase maximum tries to 600 (based on 2*(approx. frequency of 1024-bit primes))
2.  Lower the number of Miller-Rabin iterations for p and q based on HAC table 4.4
r=nelsonb,a=wtc
2001-01-18 16:39:10 +00:00
nelsonb%netscape.com fe9fa27179 When searching for a prime, the number of Miller-Rabin tests to be
performed will be done in accordance with a table published in the
Handbook of Applied Cryptography.  See Bug 65151.  Also, changes to
test program for this function.
2001-01-18 01:39:17 +00:00
mcgreer%netscape.com 03f5d37be2 remove unspecified arg check (bug 65122) 2001-01-12 14:30:44 +00:00
mcgreer%netscape.com 3f0e83ae0c bug 64706
when prime generation step fails, retry up to a specified number of times
2001-01-12 14:29:47 +00:00
nelsonb%netscape.com a6efa3c2c5 Save and restore %ebx register in all functions. Fixes bug 64940. 2001-01-12 01:37:02 +00:00
nelsonb%netscape.com 729c505bf3 Changed HP assembler routine multacc512 in hpma512.s so that it
propagates carries exactly the same way that maxpy_little does.
Re-enabled use of multacc512 in mpi_hp.c.
2001-01-08 05:58:34 +00:00
nelsonb%netscape.com c974f7d877 Fix infinite loop by making "i" be signed again.
Also match up braces for vi editor.
2001-01-08 03:26:50 +00:00
nelsonb%netscape.com 1f1f72480e Generation of prime numbers has been failing on HP since MPI began to
use the newest HP assembler function, multacc512.  So, that function
has been disabled.  Further investigation is needed.
2001-01-08 01:01:35 +00:00
mcgreer%netscape.com a12fc02b67 reflect function declaration changes to loader module (const stuff) 2001-01-06 17:07:07 +00:00
mcgreer%netscape.com ffeb56bbd2 on hypbrid cpu models (except sparc), use long long instead of long 2001-01-06 17:06:26 +00:00
mcgreer%netscape.com 50c492d08c fix broken build on bigendian platforms 2001-01-06 16:34:23 +00:00
mcgreer%netscape.com ec87616c36 widespread changes to reduce compiler warnings. liberal application of const. 2001-01-05 22:37:50 +00:00
nelsonb%netscape.com 97cc48fda6 Reduce warnings by adding missing #includes to eliminate calls to
undeclared functions.
2001-01-04 08:21:15 +00:00
larryh%netscape.com 351f30a205 Bugzilla: 64132. NSS lock instrumentation 2001-01-03 19:51:22 +00:00
mcgreer%netscape.com 2266954d60 fix problem in decrypt 2001-01-02 16:57:47 +00:00
nelsonb%netscape.com dfe078513f Don't build libfreebl_*_3.a . Just build the .so's. 2000-12-29 23:21:51 +00:00
nelsonb%netscape.com 16a28a548d This file has been superseded by mpv_sparcv8.s and mpv_sparcv9.s 2000-12-29 01:07:00 +00:00
nelsonb%netscape.com 165ce1171a Implement new mpi function mpi_read_variable_radix(). It's like
mpi_read_radix(), except that if the input stream begins with a leading
zero or "0x", it will interpret the input as octal or hex, respectively.
2000-12-29 01:01:37 +00:00
nelsonb%netscape.com 99f5c067fe Optimized version of these functions, contributed by Sun. 2000-12-29 00:36:31 +00:00
nelsonb%netscape.com 2701ecb476 Add missing release_md target. This will cause the new DSOs to be
included in the released jar files.
2000-12-28 21:35:55 +00:00
nelsonb%netscape.com 30ce773929 Define NSS_USE_HYBRID in hybrid builds. 2000-12-28 04:13:02 +00:00
nelsonb%netscape.com 19aaa707ef Separate the floating point and integer implementations of modular
exponentiation into two functions that can be chosen at run time.
2000-12-28 03:41:50 +00:00
nelsonb%netscape.com d84a97a8ac Radical change to freebl "32-bit" builds on Solaris and HP-UX "32-bit".
Build two DSOs, both conforming to the platform's 32-bit ABI, one of
which uses only 32-bit instructions, the other uses 64-bit instructions.
Then load the best one for the local CPU at run time.  This allows
greatly enhanced performance on 64-bit CPUs while still supporting older
32-bit CPUs.
2000-12-28 03:39:01 +00:00
nelsonb%netscape.com 3cf4961be7 mapfile defines the public ABI for the new freebl DSOs. 2000-12-28 03:35:43 +00:00
nelsonb%netscape.com 4a9ba412bb Verify vector version and length before relying on the DSO's vector. 2000-12-28 03:26:29 +00:00
wtc%netscape.com 46ef2e65b7 Bugzilla bug #63807: fixed function prototype of SHA1_TraceState. 2000-12-27 18:47:57 +00:00
nelsonb%netscape.com b41b82ce9d This code permits multiple implementations of freebl to coexist for a
single platform.  The best implementation for the local CPU is dynamicly
loaded at run time.  Requires DSOs to be in the LD_LIBRARY_PATH or
equivalent (e.g. SHLIB_PATH).
2000-12-27 03:20:04 +00:00
nelsonb%netscape.com 855cec4af9 Stubs for RC5 functions. This is NOT a working implementation of RC5. 2000-12-27 03:16:59 +00:00
nelsonb%netscape.com f7c24847c7 Attempt to clarify code to reduce confusion about side effect of
MP_CHECKOK macro.
2000-12-27 03:14:28 +00:00
nelsonb%netscape.com 29c09b0208 Ensure function SHA1_TraceState is always defined, even when TRACING_SSL
is not defined.
2000-12-27 02:41:59 +00:00
nelsonb%netscape.com 3dc39fe215 Change HP 64-bit and hybrid builds to use new HP assembly code.
Fix uses of $(LIB).
2000-12-27 02:08:54 +00:00
nelsonb%netscape.com 9e517f5d33 The Initial Developer of the Original Code is Netscape
Communications Corporation.  Portions created by Netscape are
Copyright (C) 2000 Netscape Communications Corporation.  All Rights
Reserved.
2000-12-27 01:48:25 +00:00
nelsonb%netscape.com ed7c69d604 The Initial Developer of the Original Code is the Hewlett-Packard Company.
Portions created by Hewlett-Packard Company are
Copyright (C) 1999 Hewlett-Packard Company.  All Rights Reserved.
2000-12-27 01:45:23 +00:00
nelsonb%netscape.com 14f9d75af8 The Initial Developer of the Original Code is the Hewlett-Packard Company.
Portions created by Hewlett-Packard Company are
Copyright (C) 1997 Hewlett-Packard Company.  All Rights Reserved.
2000-12-27 01:44:44 +00:00
nelsonb%netscape.com 2b04b7346c Revise mp_div and s_mp_div substantially. Reduce the number of temporary
variables.  Eliminate inner loop of shifts from s_mp_div.
2000-12-20 05:54:18 +00:00
mcgreer%netscape.com 49ed8cb93a initial checkin of Rijndael (AES) implementation. Only blocksize == 128 bits
has been tested on this checkin.
Added make target "rijndael_tables", which will generate rijndael32.tab.
2000-12-19 23:43:12 +00:00
nelsonb%netscape.com f6d5a84b79 Correct make variable name for AIX. 2000-12-15 06:00:55 +00:00
nelsonb%netscape.com a758f782ec Change AIX 32-bit options to use new fine-grained feature test macros. 2000-12-15 05:54:08 +00:00
nelsonb%netscape.com fd321489ff Implement new feature test macros for controlling the use of mp_word over
individual types of operations, e.g., multiply, divide, add, subtract.
Use a specific combination of these for 32-bit on AIX.
2000-12-15 05:38:09 +00:00
nelsonb%netscape.com cbcc0658f2 Add missing Makefile lines to build mpi optimally for AIX 32 and 64-bit. 2000-12-15 03:01:23 +00:00
nelsonb%netscape.com a99008bc8d Fix mpi-test for machines that have long or long long digits. 2000-12-15 03:00:00 +00:00
nelsonb%netscape.com 6502891944 Fix hybrid model builds for HP-UX. 2000-12-13 04:36:28 +00:00
nelsonb%netscape.com 3be31901cc Start building freebl with MPI's new floating point acceleration code. 2000-12-13 01:26:48 +00:00
nelsonb%netscape.com d50f40cfc7 Add support for unsigned long long mp_digits.
Revise and simplify the scheme of feature test macros used in mpi.h.
Remove all NSS_ and SOLARIS ifdefs from the source.
2000-12-13 01:22:22 +00:00
nelsonb%netscape.com 18d92f7b48 This file is the output of Sun's WorkShop 5.0 compiler for mpv_sparc.c,
when compiled for the v8+ or v9 architecture.  This file may be built
with WorkShop 4.2 and will produce the same .o as WorkShop 5.0.
2000-12-13 01:19:55 +00:00
nelsonb%netscape.com 5073b4c76e On DEC Alpha/OSF1, following the examples in <c_asm.h>, use inline
assembly code to get 64-bit products and squares from 32-bit multipliers
in just two instructions.  Speeds up multiplication and squaring a lot.
2000-12-09 03:36:41 +00:00
nelsonb%netscape.com 04688e0249 When building without the inline assembly macros, use a simple cast
rather than the math lib's floor() function.  Also, don't and with a
mask of all 1 bits when casting to a smaller unsigned type will suffice.
2000-12-09 03:32:41 +00:00
nelsonb%netscape.com 7a0b5a0ef2 This modification, contributed by Sun, avoids computing values >= 2^52.
This code runs much faster than the previous version on UltraSparc-3 CPUs,
and slightly slower than the previous version on UltraSparc-II CPUs.
2000-12-08 00:20:36 +00:00
nelsonb%netscape.com 885d29d0b4 Use the new floating point Montgomery multiply code from Sun on Solaris. 2000-12-02 02:37:22 +00:00
nelsonb%netscape.com f49b012cd4 Back out a previous change to one line of this code for performance. 2000-12-01 03:58:17 +00:00
nelsonb%netscape.com 6abe6c9e6c Add new optional third argument which specifies modulus size in bytes.
Don't print values for powers 0, 1, and 2 unless the repetition count
(the optional second argument) is 1.
2000-12-01 03:56:12 +00:00
nelsonb%netscape.com 32b43a3ae6 Replace compiler-generated inner loop code with optimized code.
This optimized code was contributed by Sun Microsystems Inc.
2000-12-01 03:53:13 +00:00
nelsonb%netscape.com 196b9b582c * The Original Code is SPARC hand-optimized Montgomery multiply functions.
*
* The Initial Developer of the Original Code is Sun Microsystems Inc.
* Portions created by Sun Microsystems Inc. are
* Copyright (C) 1999-2000 Sun Microsystems Inc. All Rights Reserved.
2000-12-01 03:18:27 +00:00
nelsonb%netscape.com 291aa8039a * inline macros for SPARC Montgomery multiply functions.
*
* The Initial Developer of the Original Code is Sun Microsystems Inc.
* Portions created by Sun Microsystems Inc. are
* Copyright (C) 1999-2000 Sun Microsystems Inc. All Rights Reserved.
2000-12-01 03:17:53 +00:00
nelsonb%netscape.com 8f9113a6de Add missing error detection to identest. Change the order in which
mp_ints are destroyed to make debugging easier.  These changes
facilitated detecting and fixing bug 61394.
2000-11-29 04:07:10 +00:00
nelsonb%netscape.com 4a90b4de0b Fix bug 61394. Don't increase length of input vector by 1. Avoid
copying the vector twice.
2000-11-29 01:30:28 +00:00
nelsonb%netscape.com 2889df8598 Get the montmulf code to build, in preparation for integration into MPI. 2000-11-17 20:15:29 +00:00
mcgreer%netscape.com 1342aa1546 checkin of blinding implementation 2000-11-17 17:58:35 +00:00
mcgreer%netscape.com a5f98d63db return SEC_ERR_NEED_RANDOM when the RNG does not have sufficient seeding data to proceed. 2000-11-17 01:01:36 +00:00
mcgreer%netscape.com 0c02bcc920 these functions should be static 2000-11-17 00:59:51 +00:00
nelsonb%netscape.com 7a6c3be3e4 Add values for test modulus and exponent for benchmarking purposes. 2000-11-08 02:44:17 +00:00
nelsonb%netscape.com c029359f7f Fix mpp_pprime (Miller-Rabin Pseudo Primality test) to report MP_NO,
instead of MP_OKAY, for numbers == 3 mod 4 that are composite.
Also added two test cases to mpi-test.c.  Fixes bug 59438.
2000-11-08 01:52:52 +00:00
javi%netscape.com ae93637c3d Make this file buildable on Mac 2000-11-08 01:11:23 +00:00
mcgreer%netscape.com 0bc2e73f90 Changes to RSA keygen:
* use mp_invmod instead of mp_xgcd.  nelsonb optimized mp_invmod for even moduli, and this will take advantage of it.
* Assure that p > q.
* Assure that n is actually keysizeInBits long by setting the two high-order bits of p and q during generation.  Previously, it was possible for n to be 1 bit short.
2000-10-31 16:52:31 +00:00
nelsonb%netscape.com 575f23cc64 Performance benchmark for modular exponentiation.
Test modulus and exponent to be added later.
2000-10-26 23:30:50 +00:00
nelsonb%netscape.com 667d4a7e36 New implementation of mp_invmod for even moduli. 3x-500x faster than
xgcd for even moduli.
2000-10-24 21:32:53 +00:00
mcgreer%netscape.com e7bf810f5e fix for 64-bit platforms. 2000-10-18 15:41:23 +00:00
nelsonb%netscape.com 6534f684da * The Original Code is SPARC hand-optimized Montgomery multiply functions.
*
* The Initial Developer of the Original Code is Sun Microsystems Inc.
* Portions created by Sun Microsystems Inc. are
* Copyright (C) 1999-2000 Sun Microsystems Inc. All Rights Reserved.
2000-10-13 00:30:36 +00:00
nelsonb%netscape.com 00b0412ddb * inline macros for SPARC Montgomery multiply functions.
*
* The Initial Developer of the Original Code is Sun Microsystems Inc.
* Portions created by Sun Microsystems Inc. are
* Copyright (C) 1999-2000 Sun Microsystems Inc. All Rights Reserved.
2000-10-13 00:28:48 +00:00
nelsonb%netscape.com 67dc4d8c49 * interface file for SPARC Montgomery multiply functions.
*
* The Initial Developer of the Original Code is Sun Microsystems Inc.
* Portions created by Sun Microsystems Inc. are
* Copyright (C) 1999-2000 Sun Microsystems Inc. All Rights Reserved.
2000-10-13 00:28:08 +00:00
nelsonb%netscape.com 5e81658537 * The Original Code is SPARC optimized Montgomery multiply functions.
*
* The Initial Developer of the Original Code is Sun Microsystems Inc.
* Portions created by Sun Microsystems Inc. are
* Copyright (C) 1999-2000 Sun Microsystems Inc. All Rights Reserved.
2000-10-13 00:27:04 +00:00
mcgreer%netscape.com 8882eb9358 HPUX 64-bit also failed. 2000-10-05 02:47:43 +00:00
mcgreer%netscape.com 4979496e5a workaround for bug #55234. optimized arcfour is not working on solaris 64-bit. 2000-10-05 01:33:54 +00:00
wtc%netscape.com 1f2ad178df Bugzilla bug #54869: support gcc for 32-bit Solaris/SPARC build. 2000-10-02 22:52:43 +00:00
mcgreer%netscape.com 544ec0f11a fix 3.1 bugs: change && to || for arg check, two new functions are static 2000-10-02 17:39:37 +00:00
wtc%netscape.com 2444aa8c5e Added missing closing comment delimiter "*/". 2000-09-30 04:30:08 +00:00
nelsonb%netscape.com e118ef4f63 Incorporate multiplication performance enhancements for UltraSparc CPUs
with the VIS instructions.
2000-09-30 01:46:30 +00:00
nelsonb%netscape.com c206d3e3c8 The Initial Developer of the Original Code is Netscape Communications
Corporation.  Portions created by Netscape are
Copyright (C) 2000 Netscape Communications Corporation.
All Rights Reserved.
2000-09-30 01:43:27 +00:00
nelsonb%netscape.com 191a128491 The Initial Developer of the Original Code is Sun Microsystems Inc.
Portions created by Sun Microsystems Inc. are
Copyright (C) 1999-2000 Sun Microsystems Inc.  All Rights Reserved.
2000-09-29 23:39:30 +00:00
nelsonb%netscape.com 431bb85395 The Initial Developer of the Original Code is Sun Microsystems Inc.
Portions created by Sun Microsystems Inc. are
Copyright (C) 1995-2000 Sun Microsystems Inc.  All Rights Reserved.
2000-09-29 23:38:05 +00:00
mcgreer%netscape.com 81cb1fd3ce change for BSAFE. on windows, nsinstall will do copy instead of link.
need to forcibly remove library before attempting to reinstall.
2000-09-29 22:30:09 +00:00
nelsonb%netscape.com 9b1d01f3fd Don't use type "ulong". Use "unsigned long" instead. 2000-09-29 19:51:32 +00:00
nelsonb%netscape.com 50098f2c22 Fix some bugs from the last checkin. 2000-09-29 04:03:34 +00:00
mcgreer%netscape.com 5a93a08faa changes to allow build with RSA BSAFE Crypto-C library 2000-09-29 02:15:42 +00:00
mcgreer%netscape.com 181442bd0a fixes based on review by nelsonb:
use mp_sub instead of mp_mod when possible.
increment generator candidate for DH instead of creating a new random one each time.
fix potential bugs when DH_Derive and KEA_Derive, where the secret is longer than the buffer the user requests.
check input key size to RSA_NewKey.
implement private key op with no CRT for PKCS12.
reduce base mod p and q before using mp_exptmod.
use mpl_lsh in pqg code (in place of exponent and multiply).
change PQG_Verify to return SECSuccess unless there is a library failure (not if verification fails).
2000-09-29 02:10:24 +00:00
nelsonb%netscape.com 58b6dcc398 Add mp_set_long and mp_set_ulong to the public API. 2000-09-28 22:53:45 +00:00
mcgreer%netscape.com 96a66d4965 revert changes to DH param gen. MPI does compute q=2p+1 for strong primes, but returns q not p. #ifdef in rsa for testing mp_exptmod_d vs. mp_exptmod, mp_exptmod is considerably faster. 2000-09-22 16:24:16 +00:00
mcgreer%netscape.com 2195f46fe1 Fix DH param gen, MPI returns Sophie-Germain prime q, then compute 2q + 1. Initial checkin of two KEA functions. 2000-09-21 23:45:24 +00:00
relyea%netscape.com 9bd5c43fa0 OS/2 build changes. 2000-09-20 17:07:22 +00:00
mcgreer%netscape.com 7d42df7e4b don't set modulus octets until good primes are generated. 2000-09-19 06:18:04 +00:00
mcgreer%netscape.com d5a2efabb1 don't set prime data until good primes are generated. 2000-09-19 06:03:52 +00:00
wtc%netscape.com 82b40af680 Bugzilla bug #53143: removed the definition of NSPR internal macros.
Modified files: FreeBSD.mk, HP-UXB.10.10.mk, HP-UXB.10.20.mk, Linux.mk,
OSF1.mk, SunOS5.mk, cmd/SSLsample/Makefile.NSS, lib/freebl/Makefile.
2000-09-19 02:24:31 +00:00
mcgreer%netscape.com c620564ee8 just some general cleanup 2000-09-16 15:56:06 +00:00
nelsonb%netscape.com 082f53f177 Eliminate extraneous "oop!" output at end of script on some platforms. 2000-09-14 00:32:24 +00:00
nelsonb%netscape.com c4fe227bb9 Changes to make mpi use 64-bit digits on machines where unsigned longs
are 64-bits.  Renamed s_mp_invmod_32b to s_mp_invmod_radix since radix
can now exceed 32 bits.  Improved performance on all platforms except
MIPS and X86.
2000-09-14 00:31:01 +00:00
mcgreer%netscape.com bdcc2c1a39 fix incorrect buffer zero 2000-09-13 18:44:11 +00:00
jgmyers%netscape.com 3d68e7a779 failure to save cx->i and cx->j caused second arcfour encrypt/decrypt to return garbage: bug 52192 r=mcgreer 2000-09-12 23:02:24 +00:00
mcgreer%netscape.com 4d941adcb4 leading zero problems fixed; thanks to nelsonb for pointing out that I needed mp_to_fixlen_octets 2000-09-12 20:32:43 +00:00
nelsonb%netscape.com cac7876f1e Fix two bugs in mp_invmod: a) returned wrong result if output var is also
one of the input vars, b) sometimes returned negative answer. Added a test
case to mpi-test.c with a value that previously produced a negative answer.
2000-09-12 00:41:09 +00:00
mcgreer%netscape.com 527ef9f038 initial checkin of Diffie-Hellman implementation 2000-09-11 17:11:50 +00:00
wtc%netscape.com 9aeb25aa0d Changed the PR_GetError() call to PORT_GetError() because we use
PORT_SetError() to set error codes.
Modified files: dsa.c, rsa.c
2000-09-11 04:17:02 +00:00
mcgreer%netscape.com d236df63ea fix bugs where some nss code expects leading 0's (once used for signs). allows pkcs11 pairwise consistency check to operate correctly. 2000-09-08 22:41:51 +00:00
wtc%netscape.com d57dc8ee4e gcc does not recognize the -xchip=ultra2 option on Solaris/Sparc. 2000-09-08 01:05:23 +00:00
mcgreer%netscape.com 3e85ae179d make compare_key do something (even if it will go away soon) 2000-09-07 23:18:40 +00:00
mcgreer%netscape.com 4135f08e8f first draft of rsa CRT decryption 2000-09-07 16:29:23 +00:00
mcgreer%netscape.com 2230de4f0a separate keygen from primegen, to facilitate testing (by using the self-test key from blapitest). using this verified the keygen process (against that self-test, anyway). leaving a testing function in temporarily. 2000-09-07 07:33:34 +00:00
mcgreer%netscape.com 8ddaa1f3d0 fix bad change made in keygen 2000-09-07 06:44:57 +00:00
mcgreer%netscape.com 112bbb432e call extended euclidean algorithm directly instead of using mp_invmod 2000-09-07 03:14:16 +00:00
nelsonb%netscape.com 6e7fa5d7ee Remove PQG_DestroyParams(), PQG_DestroyVerify from pqg.c because they
duplicate the functions in lib/util/pqgutil.c.  Also, the functions in
pqgutil correctly handle the case where the Params or Verify was
constructed without an arena (a fact which is now more obvious when
reading the code there).
2000-09-07 01:24:52 +00:00
mcgreer%netscape.com 6db674e674 first draft of rsa public key op (tested against blapi self-test) 2000-09-06 23:58:41 +00:00
mcgreer%netscape.com 61e4b81333 first draft of rsa keygen
secmpi.h is defines used by nss code calling mpi
2000-09-06 23:27:34 +00:00
mcgreer%netscape.com 5de79419b1 private header file to talk between mpi and nss 2000-09-06 21:46:43 +00:00
mcgreer%netscape.com 865fd868f2 *added pqg code based on fips 186-1
*added stubs to rsa functions
2000-09-06 17:43:42 +00:00
nelsonb%netscape.com fa26c513b0 When building on NT for X86, use new mpi_x86.asm implementation. 2000-09-02 05:41:21 +00:00
nelsonb%netscape.com 54ce559f68 Makefile.win - gmake Makefile for building MPI with MSVC on NT. 2000-09-02 05:38:51 +00:00
nelsonb%netscape.com dab570427d mpi_x86.asm - assembly language implementation of s_mpv_ functions. 2000-09-02 05:33:15 +00:00
nelsonb%netscape.com 0bbb06a9ca Use new assembler files.
Define MP_NO_MP_WORD on platforms that don't have 64-bit registers.
2000-09-02 01:40:41 +00:00
nelsonb%netscape.com 5fe44c9349 Checkin a big speedup for sparc v8 CPUs when compiled with Workshop
compilers.  Be sure to use -DMP_NO_MP_WORD with v8 CPUs.
2000-08-31 04:59:05 +00:00
nelsonb%netscape.com eb2a2982e3 Fix mpi.h so that it compiles when MP_NO_MP_WORD is defined on the command
line (or prior to including mpi.h).
2000-08-31 03:59:48 +00:00
nelsonb%netscape.com 1b6110f143 Add missing copyright notice. Doh! 2000-08-31 03:45:39 +00:00
nelsonb%netscape.com 9b2c335e20 Some cleanup. Check error codes for all functions that return them. 2000-08-31 02:52:23 +00:00
nelsonb%netscape.com 8b0c1dcf1e Big changes for performance. mp_digits are now always unsigned ints.
mp_words are used only on machines that support long long arithmetic.
s_mp_mod_d() was deleted.  It was not being used and was not part of the
public API. The code that computes squares in s_mp_sqr was broken out
into a separate new function s_mpv_sqr_add_prop(), which is a target for
assembly language optimization.  New function s_mpv_div_2dx1d(), also a
target for assembly optimization.  These changes made X86 benchmark time
go from 22.5 seconds to 8.3 seconds on my reference test system.
2000-08-31 02:51:23 +00:00
nelsonb%netscape.com 52652e08a5 Add support for Linux on X86 CPUs. Use assembler code on MIPS CPUs. 2000-08-31 02:43:56 +00:00
nelsonb%netscape.com 5e06b71329 Gnu assembler implementations of all s_mpv_ functions for Intel X86 CPUs. 2000-08-31 02:41:20 +00:00
nelsonb%netscape.com 118024af9e Add implementation of s_mpv_sqr_add_prop. 2000-08-31 02:40:32 +00:00
nelsonb%netscape.com 41b3d16d17 Change mpi-test to check the return values from most functions-under-test
explicitly for errors.
2000-08-29 04:26:23 +00:00
nelsonb%netscape.com bb088780f3 Initial Checkin. 2000-08-26 23:50:58 +00:00
mcgreer%netscape.com 609c9bf7d4 don't zero input to random update (RNG_SystemInfoForRNG uses environment as input). Fix for bug 49898. 2000-08-23 18:11:47 +00:00
nelsonb%netscape.com 3431bd1245 Fix two uninitialized variables, found while porting to Linux. 2000-08-23 01:20:15 +00:00
nelsonb%netscape.com 7c623513e6 des.c wants _X86_ defined for intel CPUs.
coreconf does this for windows, but not for Linux, FreeBSD, etc.
2000-08-23 00:06:08 +00:00
nelsonb%netscape.com f28d74b9ab Big changes for performance.
- In mpi-priv.h, declare new 3 argument versions of s_mp_add and s_mp_sub.
Also declare new set of s_mpv_ functions that operate on vectors (arrays)
of mp_digits instead of on mp_ints.  These functions are candidates for
implementation in assembler.
- In mpi.c reimplement mp_add and mp_sub using the new 3arg functions.
Implement 3 argument versions of s_mp_add and s_mp_sub.
This eliminates all need for temporary variables in mp_add and mp_sub.
Implement c language reference implementations of new s_mpv vector multiply
and multiply and add functions.  Change mp_mul and mp_sqr so they no longer
pre-zero the output variable.  It's no longer nececssary with the new s_mpv
functions.  s_mp_pad no longer zeros out the new padded space.
-In mpmontg.c, implement variable width exponetiation windows.  Implement
a new function to compute the multiply and Montgomery reduction in a
single pass.  This is "Improvement 2" from Dusse' and Kaliski's paper
"A Cryptographic Library for the Motorola DSP56000".  Performance impact
is negligible in this c implementation.  However, this function is another
target for assembly language optimization.
2000-08-22 01:57:34 +00:00
nelsonb%netscape.com a61f1b73ab Overhaul Makefile. Change it to use gmake's "static pattern rules",
instead of having explicit individual rules for every program. Also,
build .o files for programs, and link them in a separate step. This
speeds building after changing a .c file in the library.
2000-08-22 01:45:25 +00:00
nelsonb%netscape.com 4cf2feb015 Get these tests to build with the current mpi API. 2000-08-22 01:19:26 +00:00
nelsonb%netscape.com 67da52ab59 Go back to using gmake. 2000-08-22 01:15:41 +00:00
nelsonb%netscape.com ddb4786c4a MIPS assembler code to optimize inner multiply loops for mips3 CPUs. 2000-08-22 00:55:10 +00:00
mcgreer%netscape.com 5585f66cd2 initial checkin of DSA implementation. 2000-08-18 18:32:33 +00:00
nelsonb%netscape.com 99c2fa3f33 Build des.c and desblapi.c. 2000-08-14 22:28:10 +00:00
nelsonb%netscape.com 792d99fbaa The Initial Developer of the Original Code is Nelson B. Bolyard,
nelsonb@iname.com.  Portions created by Nelson B. Bolyard are
Copyright (C) 1990, 2000  Nelson B. Bolyard, All Rights Reserved.
2000-08-14 22:27:20 +00:00
nelsonb%netscape.com 9cc24caab8 "clean" target will also remove primes.c from mpi. 2000-08-14 21:04:46 +00:00
nelsonb%netscape.com c8c44aff3b Add commented-out lines to build on other platforms.
Clean target now removes libmpi.a also.
2000-08-11 05:01:59 +00:00
nelsonb%netscape.com 8f6b77ce4d Change mp_add and mp_sub to not allocate a temporary variable unless it's
really necessary.
2000-08-11 01:58:20 +00:00
nelsonb%netscape.com d2a30db497 Replace s_mp_ispow2d with faster version. Change s_mp_mul_d to detect
multiplication by 0, 1, and powers of 2, and handle them without actual
multiplication.
2000-08-10 21:43:16 +00:00
nelsonb%netscape.com 67cf3588f2 Eliminate one more warning. Add missing f suffix to float constant. 2000-08-09 22:45:51 +00:00
nelsonb%netscape.com 5826c388d2 - Change mp_mul to minimize number of outer loops when multipliers are
of unequal length.
- Fix s_mp_fixup_reciprocal to not truncate the result.
- Use new macros in mpi-priv.h
2000-08-09 20:55:39 +00:00
nelsonb%netscape.com 203d540004 Use new MP_HOWMANY macro instead of equivalent code. 2000-08-09 20:53:25 +00:00
nelsonb%netscape.com 3f16031cb2 Comment out call to unimplemented function, so this will compile. 2000-08-09 20:46:59 +00:00
nelsonb%netscape.com 60e7af5b8b Some unix platform kshells don't understand export VAR=value
So instead use                                VAR=value; export VAR
2000-08-09 20:44:05 +00:00
nelsonb%netscape.com 6e65d05e51 Add new macros: MP_MIN, MP_MAX, MP_HOWMANY, MP_ROUNDUP. 2000-08-09 20:42:18 +00:00
mcgreer%netscape.com a4c0bd7e17 zero the correct amount of input bytes 2000-08-08 20:30:56 +00:00
nelsonb%netscape.com 1a81db9b8a Fix crash caused by zeroing a larger buffer than the caller passed in. 2000-08-08 05:56:56 +00:00
nelsonb%netscape.com 53ac6c5c98 - Change mpi private function s_mp_mul_d_add_offset into a macro.
- Declare and implement new function s_mp_mul_add, which is a candidate
  for replacement with assembler code.
- Convert mp_mul, mp_sqr, etc. to use s_mp_mul_add.
- New implementation of mp_invmod for odd moduli. Algorithm from paper
  "Fast Modular Reciprocals" by Richard Schroeppel (a.k.a. Captain Nemo).
- New function s_mp_invmod_32b in mpi.c, computes inverse mod 2**32, also
  from same paper. Used in mp_invmod and mp_exptmod.
2000-08-08 03:20:35 +00:00
nelsonb%netscape.com 0bade04ba3 Platform independent performance enhancements to functions that multiply,
square, subtract, right shift, compare, mul_d_add_offset.  This lib's
Modular Exponentiation performance now compares favorably with most (not
all) other open source bignum libs on IRIX/R5000.  No assembler code is
presently being used.  Comparison on other platforms will now commence.
2000-08-05 03:37:46 +00:00
nelsonb%netscape.com e30a05c7bf Minor performance tweaks. 2000-08-04 19:58:20 +00:00
nelsonb%netscape.com f5478e8ae0 Add new signed mp_word type, mp_sword. Used to get arithmetic right
shifts when doing subtraction.
2000-08-04 19:57:24 +00:00
nelsonb%netscape.com a8b9681335 mpl_rsh now calls s_mp_div_2d instead of duplicating its logic.
mpl_lsh now calls s_mp_mul_2d instead of duplicating its logic.
2000-08-02 20:52:17 +00:00
nelsonb%netscape.com 26a0e342f4 - Implement s_mp_mul_2d, which complements s_mp_div_2d.
- Rewrite and speed up mp_sqr, most-frequently used in mp_exptmod().
- Speed up mp_sqrt by starting with a much better initial estimate.
2000-08-02 20:50:57 +00:00
nelsonb%netscape.com da54a36647 Accept input args in hex, not decimal. Line up output into columns. 2000-08-02 20:48:28 +00:00
nelsonb%netscape.com 9620ef0ca4 Declare s_mp_mul_2d(), which is complementary to s_mp_div_2d(). 2000-08-02 20:47:05 +00:00
nelsonb%netscape.com 886543402f Reduced the number of temporary variables allocated and freed during a
modular exponentiation by over 99%.  Modified mp_mul and mp_sqr to only
allocate temporary variables when absolutely needed.  Changed mp_copy
and mp_init_copy to allocate space according to the amount allocated
in the source, reducing the need to grow the variable later.
2000-08-02 01:03:14 +00:00
nelsonb%netscape.com 147b7451ec Investigating allocation of temporary variables. 2000-08-02 01:01:01 +00:00
nelsonb%netscape.com e24f34f2c8 Declare mp_int function arguments "const" as appropriate. 2000-08-01 01:38:30 +00:00
nelsonb%netscape.com 9caea97bd1 Change default value for MP_ARGCHK to depend on whether or not DEBUG is
defined.  Raise the default "precision" to reduce reallocations.
2000-08-01 01:36:30 +00:00
nelsonb%netscape.com cb72925c4a Fix initalizers in logtab.h to be "float" values, not "double" values. 2000-07-31 20:36:41 +00:00
nelsonb%netscape.com 1ebd55b401 Fix build problem caused by the fact that including stdlib.h implicitly
includes stdio.h on some platforms, but not on others.
2000-07-31 20:08:46 +00:00
nelsonb%netscape.com 4e92230a97 Use Windowed computation of exponent in mp_exptmod(). 2000-07-30 06:37:14 +00:00
nelsonb%netscape.com 71be9cf03c Add function mpl_get_bits(). Returns value of contiguous subset of bits
of bignum.  Useful for windowed modular exponentiation.
2000-07-30 06:35:38 +00:00
nelsonb%netscape.com 78256a8fa7 MPI Arbitrary Precision Integer Arithmetic library.
The Initial Developer of the Original Code is
Michael J. Fromberger <sting@linguist.dartmouth.edu>
2000-07-30 02:05:19 +00:00
nelsonb%netscape.com 97ef19c3b8 MPI Arbitrary Precision Integer Arithmetic library.
The Initial Developer of the Original Code is
Michael J. Fromberger <sting@linguist.dartmouth.edu>
2000-07-30 01:56:35 +00:00
nelsonb%netscape.com 792ad45230 Build mpi library files in freebl. 2000-07-29 19:07:22 +00:00
nelsonb%netscape.com df9c21a9de Separate DH implementation for use with BSAFE and mpi-based implementation
into two files.
2000-07-29 19:06:54 +00:00
nelsonb%netscape.com 534ec52daa Build libmpi.a. Include mpmontg.o in libmpi.a. Build programs with
libmpi.a.  Fix dependencies so lib is rebuilt when headers change.
2000-07-28 23:11:12 +00:00
nelsonb%netscape.com 6b24794435 Modular exponentiation with Montgomery reduction for MPI.
The Initial Developer of the Original Code is
Netscape Communications Corporation.  Portions created by Netscape are
Copyright (C) 2000 Netscape Communications Corporation.
All Rights Reserved.
2000-07-28 23:09:02 +00:00
nelsonb%netscape.com 71fb2fa5e4 Disambiguoate error messages in mod-expt test. 2000-07-28 23:04:23 +00:00
nelsonb%netscape.com 385fd4fc86 - Renamed mp_exptmod to s_mp_exptmod. This function is now used only in
when the modulus is even. mp_exptmod is now in mpmontg.c.
- Declare and define new function s_mp_mul_d_add_offset(), which computes
the product of an mp_digit and an mp_int, shifts the product to the left
by a number of digits, and adds the shifted product to another mp_int.
Used in multiplication and Montgomery reduction.  Numerous platform
vendors have assembly language versions of this function.
- Removed some ANDs with DIGIT_MAX.  Casting to mp_digit is necessary
and sufficient.  The AND doesn't help.
2000-07-28 23:03:12 +00:00
nelsonb%netscape.com f554a212b4 Use unsigned int for mp_digit instead of unsigned long when both are
32-bits.  This reduced warnings.  Use mp_size instead of unsigned int
in function declarations. Fix MP_DIGIT_FMT for 32-bit digits.
2000-07-28 22:55:56 +00:00
nelsonb%netscape.com a38b5ec52f Use mp_size instead of unsigned int in function prototypes. 2000-07-28 22:49:42 +00:00
nelsonb%netscape.com 99f3a8bf86 Add new function s_mp_add_offset().
Very handy in Montgomery reduction using Dusse' and Kalski's method.
2000-07-27 03:02:42 +00:00
nelsonb%netscape.com b05581f7ec Moved the declarations of many private defines and functions out of mpi.c
and into mpi-priv.h.  Previously, mplogic.c and mpprime.c had duplicate
copies of some of those declarations.  Now, they include mpi-priv.h
2000-07-27 02:38:54 +00:00
nelsonb%netscape.com bf4e60e7b3 Fix sprintf format, can't use DIGIT_FMT. 2000-07-27 00:23:17 +00:00
nelsonb%netscape.com ba8b232867 Move enhanced prime finder function mpp_make_prime from primegen utility
program into mpprime.c.  declared in mpprime.h.
2000-07-26 05:41:59 +00:00
nelsonb%netscape.com 8bf87ce6bb Fix bug in mp_div_2d that set r = q % d when a and q are the same mp_int.
Minor performance enhancement to s_mp_div_2d when DIGIT_BIT divides d.
2000-07-26 05:39:53 +00:00
nelsonb%netscape.com 7bb8634a3c Fix a bug in recently added function mp_set_bit(). 2000-07-26 05:32:30 +00:00
nelsonb%netscape.com b9d1a404d2 Update nTires via a pointer argument to mpp_make_prime().
Change some printfs.
2000-07-25 00:16:57 +00:00
nelsonb%netscape.com aef9190b64 Add new function mpp_fermat_list, which performs the fermat test on a
list of "witness" numbers.  Simplify and accelerate mpp_pprime().
2000-07-25 00:15:06 +00:00
nelsonb%netscape.com cbc85c762b Fix assertion. Comparison sense was inverted. 2000-07-25 00:12:57 +00:00
nelsonb%netscape.com f16cc60f1a Add -fullwarn to some build flags. Change dependencies for primegen. 2000-07-22 07:22:37 +00:00
nelsonb%netscape.com 175cab0f15 Implement sieving to accelerate elimination of composites.
This sieve eliminates all but about 3500 numbers from each range of 64k.
2000-07-22 05:54:21 +00:00
nelsonb%netscape.com 1f040d3f9f Use large prime table for faster prime gen. Make prime table "const".
Change functions that use prime table to use const arguments.
2000-07-22 05:36:45 +00:00
nelsonb%netscape.com 41121574a7 Change s_mp_norm to always use a power of two as the normalizing factor.
This enhancement performance by turning the normalizing and denormalizing
operations into shifts.
2000-07-21 21:06:08 +00:00
nelsonb%netscape.com 4b4e6bccd9 Implement mpl_get_bit, mpl_set_bit, mpl_significant_bits. 2000-07-21 21:04:14 +00:00
nelsonb%netscape.com 3b292e3f60 Fix symbol prefixes in some comments. 2000-07-21 20:50:31 +00:00
mcgreer%netscape.com 36c22a2a15 some compilers don't like the void* arithmetic 2000-07-20 16:58:32 +00:00
nelsonb%netscape.com 350eea5535 Use unsigned ints for length parameters to "octets" functions. 2000-07-20 04:47:24 +00:00
nelsonb%netscape.com 7f70f07983 Eliminate lots of warnings found by -fullwarn.
Add sanity test to s_mp_div().
2000-07-20 04:21:37 +00:00
nelsonb%netscape.com 04007f8bb5 Eliminate warnings found with -fullwarn. 2000-07-20 04:20:21 +00:00
mcgreer%netscape.com dbede1a951 Change the startup/shutdown procedure. Now a minimum amount of seed bytes, MIN_SEED_COUNT, are required before output bytes can be extracted. Also, it is possible to do a full restart by calling RNG_RNGInit() and RNG_RNGShutdown() in succession. This is noted in the blapi.h comments for those functions. 2000-07-19 23:54:43 +00:00
nelsonb%netscape.com 5a1cb37329 Build all mpi .c files with -DMP_API_COMPATIBLE 2000-07-19 23:23:24 +00:00
nelsonb%netscape.com 94e36d6f32 Implement 5 new functions for dealing with variable length integers
represented as unsigned and signed octet strings.
mp_read_unsigned_octets(), mp_unsigned_octet_size(),
mp_to_unsigned_octets(), mp_to_signed_octets(), mp_to_fixlen_octets()
See mpi.h for more info.
2000-07-19 23:22:43 +00:00