summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_div.c
AgeCommit message (Collapse)Author
2019-09-28Reorganize local header filesDr. Matthias St. Pierre
Apart from public and internal header files, there is a third type called local header files, which are located next to source files in the source directory. Currently, they have different suffixes like '*_lcl.h', '*_local.h', or '*_int.h' This commit changes the different suffixes to '*_local.h' uniformly. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9333)
2019-07-02Fix TyposAntoine Cœur
CLA: trivial Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/9288)
2018-12-06Following the license change, modify the boilerplates in crypto/bn/Richard Levitte
[skip ci] Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7777)
2018-12-05bn/bn_{div|shift}.c: introduce fixed-top interfaces.Andy Polyakov
Fixed-top interfaces tolerate zero-padded inputs and facilitate constant-time-ness. bn_div_fixed_top tolerates zero-padded dividend, but not divisor. It's argued that divisor's length is public even when value is secret. [extended tests] Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7589)
2018-12-05bn/bn_div.c: make conditional addition unconditionalAndy Polyakov
and add template for constant-time bn_div_3_words. Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7589)
2018-09-11Update copyright yearMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7176)
2018-07-12bn/bn_lib.c: add BN_FLG_FIXED_TOP flag.Andy Polyakov
The new flag marks vectors that were not treated with bn_correct_top, in other words such vectors are permitted to be zero padded. For now it's BN_DEBUG-only flag, as initial use case for zero-padded vectors would be controlled Montgomery multiplication/exponentiation, not general purpose. For general purpose use another type might be more appropriate. Advantage of this suggestion is that it's possible to back-port it... bn/bn_div.c: fix memory sanitizer problem. bn/bn_sqr.c: harmonize with BN_mul. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: David Benjamin <davidben@google.com> (Merged from https://github.com/openssl/openssl/pull/6662)
2017-10-18Remove parentheses of return.KaoruToda
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-13Remove email addresses from source code.Rich Salz
Names were not removed. Some comments were updated. Replace Andy's address with openssl.org Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/4516)
2017-10-09Since return is inconsistent, I removed unnecessary parentheses andKaoruToda
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-06-26Change to check last return value of BN_CTX_getPaul Yang
To make it consistent in the code base Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/3749)
2017-02-01bn: fix occurances of negative zeroGeoff Thorpe
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-08-31crypto/bn/*: x86[_64] division instruction doesn't handle constants, change ↵Andy Polyakov
constraint from 'g' to 'r'. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-06-29Whitespace cleanup in cryptoFdaSilvaYY
Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1264)
2016-05-22Avoid creating an illegal pointerKurt Roeckx
Found by tis-interpreter Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #1106
2016-05-17Copyright consolidation 06/10Rich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-30Move more BN internals to bn_lcl.hRich Salz
There was an unused macro in ssl_locl.h that used an internal type, so I removed it. Move bio_st from bio.h to ossl_type.h Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-01-26Remove /* foo.c */ commentsRich Salz
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 Levitte
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 Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22Further comment changes for reformat (master)Matt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-12-30mark all block comments that need format preserving so thatTim Hudson
indent will not alter them when reformatting comments Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2014-12-17Check for invalid divisors in BN_div.Emilia Kasper
Invalid zero-padding in the divisor could cause a division by 0. Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit a43bcd9e96c5180e5c6c82164ece643c0097485e)
2014-12-08remove OPENSSL_FIPSAPIDr. Stephen Henson
Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-08-18RT2163: Remove some unneeded #include'sDoug Goldstein
Several files #include stdio.h and don't need it. Also, per tjh, remove BN_COUNT Reviewed-by: Emilia Kasper <emilia@openssl.org>
2011-08-14bn_div.c: remove duplicate code by merging BN_div and BN_div_no_branch.Andy Polyakov
2011-06-10#undef bn_div_words as it is defined for FIPS builds.Dr. Stephen Henson
2011-04-11Fix warning.Dr. Stephen Henson
2011-02-03Transfer error redirection to fips.h, add OPENSSL_FIPSAPI to source filesDr. Stephen Henson
that use it.
2010-02-23Always check bn_wexpend() return values for failure (CVE-2009-3245).Bodo Möller
(The CHANGES entry covers the change from PR #2111 as well, submitted by Martin Olsson.) Submitted by: Neel Mehta
2009-06-17Submitted by: Peter Gutmann <pgut001@cs.auckland.ac.nz>Dr. Stephen Henson
Approved by: steve@openssl.org Check return values for NULL in case of malloc failure.
2008-11-12Revert the size_t modifications from HEAD that had led to moreGeoff Thorpe
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 Laurie
2008-09-14Some precautions to avoid potential security-relevant problems.Bodo Möller
2008-02-28Avoid warnings.Dr. Stephen Henson
2007-06-11Privatize BN_*_no_branch.Andy Polyakov
2007-04-19fix error codesBodo Möller
2007-04-19don't violate the bn_check_top assertion in BN_mod_inverse_no_branch()Bodo Möller
2007-03-28make BN_FLG_CONSTTIME semantics more fool-proofBodo Möller
2007-03-28Change to mitigate branch prediction attacksBodo Möller
Submitted by: Matthew D Wood Reviewed by: Bodo Moeller
2005-08-28fix warnings when building openssl with the following compiler options:Nils Larsch
-Wmissing-prototypes -Wcomment -Wformat -Wimplicit -Wmain -Wmultichar -Wswitch -Wshadow -Wtrigraphs -Werror -Wchar-subscripts -Wstrict-prototypes -Wreturn-type -Wpointer-arith -W -Wunused -Wno-unused-parameter -Wuninitialized
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
2003-11-22BN_div() cleanup: replace the use of BN_sub and BN_add with bn_sub_wordsGeoff Thorpe
and bn_add_words to avoid using fake bignums to window other bignums that can lead to corruption. This change allows all bignum tests to pass with BN_DEBUG and BN_DEBUG_RAND debugging and valgrind. NB: This should be tested on a few different architectures and configuration targets, as the bignum code this deals with is quite preprocessor (and assembly) sensitive. Submitted by: Nils Narsch Reviewed by: Geoff Thorpe, Ulf Moeller
2003-11-06Put more debug screening in BN_div() and correct a comment.Geoff Thorpe
2003-11-04Put the first stage of my bignum debugging adventures into CVS. This codeGeoff Thorpe
is itself experimental, and in addition may cause execution to break on existing openssl "bugs" that previously were harmless or at least invisible.
2003-10-31bn_div() does some pretty nasty things with temporary variables,Geoff Thorpe
constructing BIGNUM structures with pointers offset into other bignums (among other things). This corrects some of it that is too plainly insane, and tries to ensure that bignums are normalised when passed to other functions.
2003-10-30This fixes a couple of cases where an inconsistent BIGNUM could be passed asGeoff Thorpe
input to a function.
2002-12-20A little debugging.Richard Levitte
2002-12-14x86_64 performance patch.Andy Polyakov