summaryrefslogtreecommitdiffstats
path: root/crypto/bn
AgeCommit message (Collapse)Author
2004-11-02Don't use $(EXHEADER) directly in for loops, as most shells will breakRichard Levitte
if $(EXHEADER) is empty. Notified by many, solution suggested by Carson Gaspar <carson@taltos.org>
2004-09-19Two TODO comments taken care of. Nils pointed out that one of them had alreadyGeoff Thorpe
been done, and took care of the other one (which hadn't). Submitted by: Nils Larsch Reviewed by: Geoff Thorpe
2004-08-29Proper support for OpenBSD-i386 shared build, including assember modules!Andy Polyakov
"Proper" means "compiles and passes test." Versioning is broken (I think).
2004-08-29OPENSSL_ia32cap final touches. Note that OPENSSL_ia32cap is no longer aAndy Polyakov
symbol, but a macro expanded as (*(OPENSSL_ia32cap_loc())). The latter is the only one to be exported to application.
2004-08-01OpenBSD fix-up for new a.out targets. OpenBSD .s.o rule is busted...Andy Polyakov
2004-08-01Clean-up GAS targets: get rid of "cpp" stuff and replace it with "purified"Andy Polyakov
COFF and a.out targets [similar to ELF targets]. You might notice some rudementary support for shared mingw builds under cygwin. It works (it produces cryptoeay32.dll and ssleay32.dll with everything exported by name), but it's primarily for testing/debugging purposes, at least for now...
2004-07-23Build-n-link new IA-64 modules on Linux and HP-UX.Andy Polyakov
2004-07-22All SIXTY_FOUR_BIT platforms (mind the difference between SIXTY_FOUR_BIT andAndy Polyakov
SIXTY_FOUR_BIT_LONG) were failing to pass 'cd test; make test_bn'.
2004-07-18Anchor AES and SHA-256/-512 assembler from C.Andy Polyakov
2004-07-18Add anchors for AES, SHA-256/-512 assembler modules and SSE2 code pathes.Andy Polyakov
I also used this opportunity to clean up some out-of-date targets and re-group targets by OS.
2004-07-06Improve error handling if decompression of an ec point fails, and cleanupGeoff Thorpe
ec_curve.c (unify comments, etc). Submitted by: Nils Larsch Reviewed by: Bodo Moeller, Geoff Thorpe
2004-07-01New scalable bn_mul_add_words loop, which provides up to >20% overallAndy Polyakov
performance improvement. Make module more gcc friendly and clarify copyright issues for division routine.
2004-06-20Tidy up, including;Geoff Thorpe
- Remove unused and unuseful debug cruft. - Remove unnecessary 'top' fudging from BN_copy(). - Fix a potential memory leak and simplify the expansion logic in BN_bin2bn(). Submitted by: Nils Larsch Reviewed by: Geoff Thorpe
2004-06-17Deprecate unused cruft, and "make update".Geoff Thorpe
2004-06-17Actually, that last change to BN_get_word() was a little too simple.Geoff Thorpe
2004-06-17As Nils put it;Geoff Thorpe
Yet another question: some time ago you changed BN_set_word. Why didn't you change BN_get_word as well? Quite. I'm also removing the older commented-out implementations to improve readability. This complex stuff seems to date from a time when the types didn't match up well. Submitted by: Nils Larsch, Geoff Thorpe
2004-06-17BN_div_word() was breaking when called from BN_bn2dec() (actually, this isGeoff Thorpe
the only function that uses it) because it would trip up an assertion in bn_div_words() when first invoked. This also adds BN_div_word() testing to bntest. Submitted by: Nils Larsch Reviewed by: Geoff Thorpe
2004-05-28Eliminate compiler warnings and throw in performance table.Andy Polyakov
2004-05-15Make some more API types opaquely available from ossl_typ.h, meaning theGeoff Thorpe
corresponding headers are only required for API functions or structure details. This now includes the bignum types and BUF_MEM. Subsequent commits will remove various dependencies on bn.h and buffer.h and update the makefile dependencies.
2004-05-06SSE2 accelerated bn_mul_add_words. Code is currently disabled till properAndy Polyakov
config and run-time support is added. PR: 788 Submitted by: <dean@arctic.org> Reviewed by: <appro> Obtained from: http://arctic.org/~dean/crypto/rsa.html
2004-04-27Improved PowerPC support. Proper ./config support for ppc targets,Andy Polyakov
especially for AIX. But most important BIGNUM assembler implementation submitted by IBM. Submitted by: Peter Waltenberg <pwalten@au1.ibm.com> Reviewed by: appro
2004-04-20Print the debug thingies on stderr instead of stdout. If for nothingRichard Levitte
else then at least so bc doesn't have problems parsing the output from bntest :-).
2004-04-19make updateGeoff Thorpe
2004-03-25RAND_add() wants a double as it's last argument.Richard Levitte
2004-03-25Adjust various bignum functions to use BN_CTX for variables instead ofGeoff Thorpe
locally initialising their own. NB: I've removed the "BN_clear_free()" loops for the exit-paths in some of these functions, and that may be a major part of the performance improvements we're seeing. The "free" part can be removed because we're using BN_CTX. The "clear" part OTOH can be removed because BN_CTX destruction automatically performs this task, so performing it inside functions that may be called repeatedly is wasteful. This is currently safe within openssl due to the fact that BN_CTX objects are never created for longer than a single high-level operation. However, that is only because there's currently no mechanism in openssl for thread-local storage. Beyond that, this might be an issue for applications using the bignum API directly and caching their own BN_CTX objects. The solution is to introduce a flag to BN_CTX_start() that allows its variables to be automatically sanitised on release during BN_CTX_end(). This way any higher-level function (and perhaps the application) can specify this flag in its own BN_CTX_start()/BN_CTX_end() pair, and this will cause inner-loop functions specifying the flag to be ignored so that sanitisation is handled only once back out at the higher level. I will be implementing this in the near future.
2004-03-25Replace the BN_CTX implementation with my current work. I'm leaving theGeoff Thorpe
little TODO list in there as well as the debugging code (only enabled if BN_CTX_DEBUG is defined). I'd appreciate as much review and testing as can be spared for this. I'll commit some changes to other parts of the bignum code shortly to make better use of this implementation (no more fixed size limitations). Note also that under identical optimisations, I'm seeing a noticable speed increase over openssl-0.9.7 - so any feedback to confirm/deny this on other systems would also be most welcome.
2004-03-17Variety of belt-tightenings in the bignum code. (Please help test this!)Geoff Thorpe
- Remove some unnecessary "+1"-like fudges. Sizes should be handled exactly, as enlarging size parameters causes needless bloat and may just make bugs less likely rather than fixing them: bn_expand() macro, bn_expand_internal(), and BN_sqr(). - Deprecate bn_dup_expand() - it's new since 0.9.7, unused, and not that useful. - Remove unnecessary zeroing of unused bytes in bn_expand2(). - Rewrite BN_set_word() - it should be much simpler, the previous complexities probably date from old mismatched type issues. - Add missing bn_check_top() macros in bn_word.c - Improve some degenerate case handling in BN_[add|sub]_word(), add comments, and avoid a bignum expansion if an overflow isn't possible.
2004-03-13Convert openssl code not to assume the deprecated form of BN_zero().Geoff Thorpe
Remove certain redundant BN_zero() initialisations, because BN_CTX_get(), BN_init(), [etc] already initialise to zero. Correct error checking in bn_sqr.c, and be less wishy-wash about how/why the result's 'top' value is set (note also, 'max' is always > 0 at this point).
2004-03-13The efforts to eliminate the dual-representation of zero and to ensureGeoff Thorpe
bignums are passed in and out of functions and APIs in a consistent form has highlighted that zero-valued bignums don't need any allocated word data. The use of BN_set_word() to initialise a bignum to zero causes needless allocation and gives it a return value that must be checked. This change converts BN_zero() to a self-contained macro that has no return/expression value and does not cause any expansion of bignum data. Note, it would be tempting to rewrite the deprecated version as a success-valued comma expression, such as; #define BN_zero(a) ((a)->top = (a)->neg = 0, 1) However, this evaluates 'a' twice and would confuse initialisation loops (eg. while(..) { BN_zero(bn++) } ). As such, the deprecated version continues to use BN_set_word().
2004-03-13Document a change I'd already made, and at the same time, correct theGeoff Thorpe
change to work properly; BN_zero() should set 'neg' to zero as well as 'top' to match the behaviour of BN_new().
2004-03-09Minimise the amount of code dependent on BN_DEBUG_RAND. In particular,Geoff Thorpe
redefine bn_clear_top2max() to be a NOP in the non-debugging case, and remove some unnecessary usages in bn_nist.c. Submitted by: Nils Larsch Reviewed by: Geoff Thorpe, Ulf Möller
2004-03-09More changes coming out of the bignum auditing. BN_CTX_get() should ideallyGeoff Thorpe
return a "zero" bignum as BN_new() does - so reset 'top'. During BN_CTX_end(), released bignums should be consistent so enforce this in debug builds. Also, reduce the number of wasted BN_clear_free() calls from BN_CTX_end() (typically by 75% or so). Submitted by: Nils Larsch Reviewed by: Geoff Thorpe, Ulf Möller
2004-02-22When adding positive elements, we can use BN_uadd() instead of BN_add().Geoff Thorpe
Submitted by: Nils Larsch Reviewed by: Geoff Thorpe
2004-02-07Typo in crypto/bn/asm/x86_64.c, bn_div_words().Andy Polyakov
PR: 821
2004-01-30Typo in PA-RISC 2 rules in crypto/bn/Makefile.sslAndy Polyakov
2004-01-29HP/UX PA-RISC 2 targets update.Andy Polyakov
2004-01-28make updateRichard Levitte
2004-01-25Even though C specification explicitly says that constant type "stretches"Andy Polyakov
automatically to accomodate the value, some compilers fail to do so. Most notably 0x0123456789ABCDEF should come out as long long in 32-bit context, but HP compiler truncates it to 32-bit value. Which in turn breaks GF(2^m) arithmetics in hpux-parisc2-cc build. Therefore this fix...
2003-12-27Use sh explicitely to run point.shRichard Levitte
This is part of a large change submitted by Markus Friedl <markus@openbsd.org>
2003-12-27Use BUF_strlcpy() instead of strcpy().Richard Levitte
Use BUF_strlcat() instead of strcat(). Use BIO_snprintf() instead of sprintf(). In some cases, keep better track of buffer lengths. This is part of a large change submitted by Markus Friedl <markus@openbsd.org>
2003-12-06Add "dif" variable to clean up the loop implementations.Ulf Möller
Submitted by: Nils Larsch
2003-12-06Avoid segfault if ret==0.Ulf Möller
Submitted by: Nils Larsch
2003-12-02Incremental cleanups to bn_lib.c.Geoff Thorpe
- Add missing bn_check_top() calls and relocate some others - Use BN_is_zero() where appropriate - Remove assert()s that bn_check_top() is already covering - Simplify the code in places (esp. bn_expand2()) - Only keep ambiguous zero handling if BN_STRICT isn't defined - Remove some white-space and make some other aesthetic tweaks
2003-12-02Use the BN_is_odd() macro in place of code that (inconsistently) does muchGeoff Thorpe
the same thing. Also, I have some stuff on the back-burner related to some BN_CTX notes from Peter Gutmann about his cryptlib hacks to the bignum code. The BN_CTX comments are there to remind me of some relevant points in the code.
2003-12-02BN_FLG_FREE is of extremely dubious usefulness, and is only referred toGeoff Thorpe
once in the source (where it is set for the benefit of no other code whatsoever). I've deprecated the declaration in the header and likewise made the use of the flag conditional in bn_lib.c. Note, this change also NULLs the 'd' pointer in a BIGNUM when it is reset but not deallocated.
2003-12-01Declare the static BIGNUM "BN_value_one()" more carefully.Geoff Thorpe
2003-12-01Add missing bn_check_top()s to bn_kron.c, remove some miscellaneousGeoff Thorpe
white-space, and include extra headers to satisfy debugging builds.
2003-12-01Add missing bn_check_top()s to bn_gf2m.c and remove some miscellaneousGeoff Thorpe
white-space.
2003-12-01The bn_set_max() macro is only "used" by the bn_set_[low|high]() macrosGeoff Thorpe
which, in turn, are used nowhere at all. This is a good thing because bn_set_max() would currently generate code that wouldn't compile (BIGNUM has no 'max' element). The only apparent use for bn_set_[low|high] would be for implementing windowing algorithms, and all of openssl's seem to use bn_***_words() helpers instead (including the BN_div() that Nils fixed recently, which had been using independently-coded versions of what these unused macros are intended for). I'm therefore consigning these macros to cvs oblivion in the name of readability.
2003-12-01bn_fix_top() exists for compatibility's sake and is mapped toGeoff Thorpe
bn_correct_top() or bn_check_top() depending on debug settings. For internal source, all bn_fix_top()s should be converted one way or the other depending on whether the use of bn_correct_top() is justified. For BN_div_recp(), these cases should not require correction if the other bignum functions are doing their jobs properly, so convert to bn_check_top().