aboutsummaryrefslogtreecommitdiff
path: root/crypto/bn/bn_word.c
AgeCommit message (Collapse)AuthorFilesLines
2018-12-06Following the license change, modify the boilerplates in crypto/bn/Richard Levitte1-1/+1
[skip ci] Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7777)
2017-10-18Remove parentheses of return.KaoruToda1-5/+5
Since return is inconsistent, I removed unnecessary parentheses and unified them. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4541)
2017-10-09Since return is inconsistent, I removed unnecessary parentheses andKaoruToda1-4/+4
unified them. - return (0); -> return 0; - return (1); -> return 1; - return (-1); -> return -1; Reviewed-by: Stephen Henson <steve@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4500)
2017-02-01bn: fix occurances of negative zeroGeoff Thorpe1-0/+2
The BIGNUM behaviour is supposed to be "consistent" when going into and out of APIs, where "consistent" means 'top' is set minimally and that 'neg' (negative) is not set if the BIGNUM is zero (which is iff 'top' is zero, due to the previous point). The BN_DEBUG testing (make test) caught the cases that this patch corrects. Note, bn_correct_top() could have been used instead, but that is intended for where 'top' is expected to (sometimes) require adjustment after direct word-array manipulation, and so is heavier-weight. Here, we are just catching the negative-zero case, so we test and correct for that explicitly, in-place. Change-Id: Iddefbd3c28a13d935648932beebcc765d5b85ae7 Signed-off-by: Geoff Thorpe <geoff@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1672)
2016-06-07Fix BN_mod_word bugMatt Caswell1-0/+22
On systems where we do not have BN_ULLONG (e.g. typically 64 bit systems) then BN_mod_word() can return incorrect results if the supplied modulus is too big. RT#4501 Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-05-17Copyright consolidation 06/10Rich Salz1-54/+6
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-26Remove /* foo.c */ commentsRich Salz1-1/+0
This was done by the following find . -name '*.[ch]' | /tmp/pl where /tmp/pl is the following three-line script: print unless $. == 1 && m@/\* .*\.[ch] \*/@; close ARGV if eof; # Close file to reset $. And then some hand-editing of other files. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2015-05-14Identify and move common internal libcrypto header filesRichard Levitte1-1/+1
There are header files in crypto/ that are used by a number of crypto/ submodules. Move those to crypto/include/internal and adapt the affected source code and Makefiles. The header files that got moved are: crypto/cryptolib.h crypto/md32_common.h Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-01-22Run util/openssl-format-source -v -c .Matt Caswell1-165/+154
Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-08-18RT2163: Remove some unneeded #include'sDoug Goldstein1-1/+0
Several files #include stdio.h and don't need it. Also, per tjh, remove BN_COUNT Reviewed-by: Emilia Kasper <emilia@openssl.org>
2012-11-09bn_word.c: fix overflow bug in BN_add_word.Andy Polyakov1-17/+8
2008-11-12Revert the size_t modifications from HEAD that had led to moreGeoff Thorpe1-7/+0
knock-on work than expected - they've been extracted into a patch series that can be completed elsewhere, or in a different branch, before merging back to HEAD.
2008-11-01size_tification.Ben Laurie1-0/+7
2005-07-25fix BN_mod_word and give a more reasonable return value if an error occurredNils Larsch1-2/+5
2005-07-17bugfix: 0 - w (w != 0) is actually negativeNils Larsch1-1/+7
2004-06-17BN_div_word() was breaking when called from BN_bn2dec() (actually, this isGeoff Thorpe1-1/+8
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-03-17Variety of belt-tightenings in the bignum code. (Please help test this!)Geoff Thorpe1-9/+21
- 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.
2003-11-25Fix some handling in bn_word. This also resolves the issues observed inGeoff Thorpe1-6/+19
ticket 697 (though uses a different solution than the proposed one). This problem was initially raised by Otto Moerbeek. PR: 697 Submitted by: Nils Larsch Reviewed by: Geoff Thorpe
2003-11-04Put the first stage of my bignum debugging adventures into CVS. This codeGeoff Thorpe1-0/+4
is itself experimental, and in addition may cause execution to break on existing openssl "bugs" that previously were harmless or at least invisible.
2002-10-14When BN_add_word() reaches top, it shouldn't try to add the the correspondingRichard Levitte1-1/+4
word, since that word may not be zero.
2000-09-04Fix for BN_mul_word(a, 0).Bodo Möller1-4/+9
2000-07-27There's a slight possibility that a is 0 in BN_sub_word(), and mightRichard Levitte1-1/+1
therefore have unallocated parts. Therefore, a check for the 0 case is needed, resulting with the same thing as when a is negative.
2000-07-27In the case where a < 0 and |a| < w, the result (assigned to a) fromRichard Levitte1-1/+1
BN_add_word becomes wrongly negative... This was discovered by Darrel Hankerson <dhankers@cacr.math.uwaterloo.ca>
2000-02-03Some 'const's for BNs.Bodo Möller1-1/+1
1999-04-19Change functions to ANSI C.Ulf Möller1-15/+5
1998-12-21Import of old SSLeay release: SSLeay 0.9.1b (unreleased)SSLeayRalf S. Engelschall1-10/+10
1998-12-21Import of old SSLeay release: SSLeay 0.9.0bRalf S. Engelschall1-26/+75
1998-12-21Import of old SSLeay release: SSLeay 0.8.1bRalf S. Engelschall1-0/+155