summaryrefslogtreecommitdiffstats
path: root/crypto/ec/ec_mult.c
AgeCommit message (Collapse)Author
2018-06-21[crypto/ec] don't assume points are of order group->orderBilly Brumley
(cherry picked from commit 01fd5df77d401c87f926552ec24c0a09e5735006) Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6549)
2018-06-21ec/ec_mult.c: get BN_CTX_start,end sequence right.Andy Polyakov
Triggered by Coverity analysis. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 7d859d1c8868b81c5d810021af0b40f355af4e1f) Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6549)
2018-05-24Improve compatibility of point and curve checksMatt Caswell
We check that the curve name associated with the point is the same as that for the curve. Fixes #6302 Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6323) (cherry picked from commit b14e60155009f4f1d168e220fa01cd2b75557b72)
2018-04-23Remove superfluous NULL checks. Add Andy's BN_FLG comment.Billy Brumley
Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6009) (cherry picked from commit 39df51522ba2e3773ae2f1d4df5a6031ef41c1ba)
2018-04-23Move up check for EC_R_INCOMPATIBLE_OBJECTS and for the point at infinity caseNicola Tuveri
Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6009) (cherry picked from commit 736b31e5ea33166d89d5cff5774697d0c15d96bd)
2018-04-23Pass throughNicola Tuveri
Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6009) (cherry picked from commit f4675379275c304dbfa593cc573b4e4c4eb54bd4)
2018-04-23ladder description: why it worksBilly Brumley
Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6009) (cherry picked from commit a067a8705a654c85d43b942e0d1616e282667969)
2018-04-23Address code style commentsNicola Tuveri
Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6009) (cherry picked from commit 36bed230b580f92d2e10d13e4ba472236e622562)
2018-04-23Elliptic curve scalar multiplication with timing attack defensesBilly Brumley
Co-authored-by: Nicola Tuveri <nic.tuv@gmail.com> Co-authored-by: Cesar Pereida Garcia <cesar.pereidagarcia@tut.fi> Co-authored-by: Sohaib ul Hassan <soh.19.hassan@gmail.com> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6009) (cherry picked from commit 40e48e54582e46c1a01e184ecf5bd31f4f7f8294)
2017-12-08Standardize syntax of sizeof(foo)Rich Salz
Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4876)
2017-05-02Fix URL links in commentRich Salz
Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3365) (cherry picked from commit dea0eb2c5452cd4c2160a64a6868e79efeca6e9d)
2016-06-01Free tempory data on error in ec_wNAF_mul()Matt Caswell
The ec_wNAF_mul() function allocates some temporary storage that it doesn't always free on an error condition. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-17Copyright consolidation 06/10Rich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-08Convert CRYPTO_LOCK_EC_* to new multi-threading APIAlessandro Ghedini
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-05GH616: Remove dead codeRich Salz
Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-02-05GH601: Various spelling fixes.FdaSilvaYY
Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-01-31Add EC_GROUP_order_bits, EC_GROUP_get0_order and EC_GROUP_get0_cofactorDr. Stephen Henson
New functions to return internal pointer for order and cofactor. This avoids the need to allocate a new BIGNUM which to copy the value to. Simplify code to use new functions. Reviewed-by: Rich Salz <rsalz@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>
2016-01-13Call single parent free_comp routine.Rich Salz
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-01-13Add CRYPTO_EX_DATA; remove EC_EXTRA_DATARich Salz
Add CRYPTO_EX_DATA add EndC_KEY_[gs]et_method, From Roumen Petrov. Had to add various exdata calls to init/copy/free the exdata. Had to remove const from some EC functions because exdata isn't const-correct. :( Also remove EC_EXTRA_DATA and use a union to hold the possible pre-computed values and an enum to tell which value is in the union. (Rich Salz) Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
2015-11-09Continue standardising malloc style for libcryptoMatt Caswell
Continuing from previous commit ensure our style is consistent for malloc return checks. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-09-03remove 0 assignments.Rich Salz
After openssl_zalloc, cleanup more "set to 0/NULL" assignments. Many are from github feedback. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-05-11Use p==NULL not !p (in if statements, mainly)Rich Salz
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-05-04Use safer sizeof variant in mallocRich Salz
For a local variable: TYPE *p; Allocations like this are "risky": p = OPENSSL_malloc(sizeof(TYPE)); if the type of p changes, and the malloc call isn't updated, you could get memory corruption. Instead do this: p = OPENSSL_malloc(sizeof(*p)); Also fixed a few memset() calls that I noticed while doing this. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-05-01free NULL cleanup -- codaRich Salz
After the finale, the "real" final part. :) Do a recursive grep with "-B1 -w [a-zA-Z0-9_]*_free" to see if any of the preceeding lines are an "if NULL" check that can be removed. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-05-01free null cleanup finaleRich Salz
Don't check for NULL before calling OPENSSL_free Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-30free NULL cleanup 7Rich Salz
This gets BN_.*free: BN_BLINDING_free BN_CTX_free BN_FLG_FREE BN_GENCB_free BN_MONT_CTX_free BN_RECP_CTX_free BN_clear_free BN_free BUF_MEM_free Also fix a call to DSA_SIG_free to ccgost engine and remove some #ifdef'd dead code in engines/e_ubsec. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-30free cleanup almost the finaleRich Salz
Add OPENSSL_clear_free which merges cleanse and free. (Names was picked to be similar to BN_clear_free, etc.) Removed OPENSSL_freeFunc macro. Fixed the small simple ones that are left: CRYPTO_free CRYPTO_free_locked OPENSSL_free_locked Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-28remove malloc castsRich Salz
Following ANSI C rules, remove the casts from calls to OPENSSL_malloc and OPENSSL_realloc. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-25free NULL cleanup.Rich Salz
This gets EC_GROUP_clear_free EC_GROUP_free, EC_KEY_free, EC_POINT_clear_free, EC_POINT_free Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-02-06Live code cleanup: remove #if 1 stuffRich Salz
For code bracketed by "#if 1" then remove the alternate "#else .. #endif" lines. Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-01-22Re-align some comments after running the reformat script.Matt Caswell
This should be a one off operation (subsequent invokation of the script should not move them) Reviewed-by: Tim Hudson <tjh@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-08Implement internally opaque bn access from ecMatt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-12-08remove OPENSSL_FIPSAPIDr. Stephen Henson
Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-11-12Fix free of garbage pointer. PR#3595Matt Caswell
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2011-02-14Reorganise ECC code for inclusion in FIPS module.Dr. Stephen Henson
Move compression, point2oct and oct2point functions into separate files. Add a flags field to EC_METHOD. Add a flag EC_FLAGS_DEFAULT_OCT to use the default compession and oct functions (all existing methods do this). This removes dependencies from EC_METHOD while keeping original functionality.
2010-08-26ECC library bugfixes.Bodo Möller
Submitted by: Emilia Kasper (Google)
2009-05-02ec_mult.c: fix C4334 win64 compiler warning.Andy Polyakov
2008-12-27Check scalar->d before we use it (in BN_num_bits()). (Coverity ID 129)Ben Laurie
2007-05-22Fix crypto/ec/ec_mult.c to work properly with scalars of value 0Bodo Möller
2006-03-14fix error found by coverity: check if ctx is != NULL before calling BN_CTX_end()Nils Larsch
2005-05-16ecc api cleanup; summary:Nils Larsch
- hide the EC_KEY structure definition in ec_lcl.c + add some functions to use/access the EC_KEY fields - change the way how method specific data (ecdsa/ecdh) is attached to a EC_KEY - add ECDSA_sign_ex and ECDSA_do_sign_ex functions with additional parameters for pre-computed values - rebuild libeay.num from 0.9.7
2005-04-22- use BN_set_negative and BN_is_negative instead of BN_set_signNils Larsch
and BN_get_sign - implement BN_set_negative as a function - always use "#define BN_is_zero(a) ((a)->top == 0)"
2003-05-21Make sure EC_window_bits_for_scalar_size() returns a size_tRichard Levitte
2003-02-12Allow EC_GROUP objects to share precomputation for improved memoryBodo Möller
efficiency (EC_PRE_COMP objects are now constant once completed). Extend 'extra_data' API to support arbitrarily many slots (although we need only one at the moment). Modify EC internal 'extra_data' API: EC_GROUP_[clear_]free_extra_data now frees only a single slot (the previous functions are available as EC_GROUP_[clear_]free_all_extra_data). Submitted by: Nils Larsch Reviewed by: Bodo Moeller
2003-02-10Make sure memcpy() is properly declared by including string.h.Richard Levitte
2003-02-08remove debugging leftoversBodo Möller