aboutsummaryrefslogtreecommitdiff
path: root/crypto/ec/ec_lib.c
AgeCommit message (Collapse)AuthorFilesLines
2016-03-01Add default operations to EC_METHODDr. Stephen Henson1-4/+1
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-01Replace overrides.Dr. Stephen Henson1-5/+12
Instead of overriding a default operation move default operation to a separate function which is then explicitly included in any EC_METHOD that uses it. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-02-28Add group_order_bits to EC_METHOD.Dr. Stephen Henson1-0/+2
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-02-28Extended EC_METHOD customisation support.Dr. Stephen Henson1-10/+16
Add support for optional overrides of various private key operations in EC_METHOD. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-02-04Fix BN_gcd errors for some curvesBilly Brumley1-2/+7
Those even order that do not play nicely with Montgomery arithmetic Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-01-31Zero newly allocated pointsDr. Stephen Henson1-1/+1
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-01-31Add EC_GROUP_order_bits, EC_GROUP_get0_order and EC_GROUP_get0_cofactorDr. Stephen Henson1-5/+29
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 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>
2016-01-13Call single parent free_comp routine.Rich Salz1-3/+3
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-01-13Add missing #ifdef's to fix build breakRich Salz1-0/+4
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
2016-01-13Add CRYPTO_EX_DATA; remove EC_EXTRA_DATARich Salz1-162/+61
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 Caswell1-6/+6
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 Salz1-14/+2
After openssl_zalloc, cleanup more "set to 0/NULL" assignments. Many are from github feedback. Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-08-10RT3999: Remove sub-component version stringsRich Salz1-2/+0
Especially since after the #ifdef cleanups this is not useful. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-06-10EC_POINT_is_on_curve does not return a booleanMatt Caswell1-0/+7
The function EC_POINT_is_on_curve does not return a boolean value. It returns 1 if the point is on the curve, 0 if it is not, and -1 on error. Many usages within OpenSSL were incorrectly using this function and therefore not correctly handling error conditions. With thanks to the Open Crypto Audit Project for reporting this issue. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-05-04Use safer sizeof variant in mallocRich Salz1-5/+5
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 Salz1-6/+1
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 Salz1-9/+5
Don't check for NULL before calling OPENSSL_free Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-30free NULL cleanup 7Rich Salz1-24/+12
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 Salz1-10/+3
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-03-25free NULL cleanup.Rich Salz1-13/+8
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-19Use named curve parameter encoding by default.Dr. Stephen Henson1-1/+1
Many applications require named curve parameter encoding instead of explicit parameter encoding (including the TLS library in OpenSSL itself). Set this encoding by default instead of requiring an explicit call to set it. Add OPENSSL_EC_EXPLICT_CURVE define. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-01-22Run util/openssl-format-source -v -c .Matt Caswell1-962/+922
Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-12-17Build fixesEmilia Kasper1-1/+1
Various build fixes, mostly uncovered by clang's unused-const-variable and unused-function errors. Reviewed-by: Kurt Roeckx <kurt@openssl.org> (cherry picked from commit 0e1c318ece3c82e96ae95a34a1badf58198d6b28)
2014-12-08Implement internally opaque bn access from ecMatt Caswell1-21/+25
Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-12-08remove OPENSSL_FIPSAPIDr. Stephen Henson1-1/+1
Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-12-08Remove fips_constseg references.Dr. Stephen Henson1-1/+0
Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-09-12Reserve option to use BN_mod_exp_mont_consttime in ECDSA.Andy Polyakov1-0/+71
Submitted by Shay Gueron, Intel Corp. RT: 3149 Reviewed-by: Rich Salz <rsalz@openssl.org>
2014-07-21"EC_POINT_invert" was checking "dbl" function pointer instead of "invert".Billy Brumley1-1/+1
PR#2569 Reviewed-by: Rich Salz <rsalz@openssl.org>
2013-09-16 Fix overly lenient comparisons:Bodo Moeller1-5/+5
- EC_GROUP_cmp shouldn't consider curves equal just because the curve name is the same. (They really *should* be the same in this case, but there's an EC_GROUP_set_curve_name API, which could be misused.) - EC_POINT_cmp shouldn't return 0 for ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED or EC_R_INCOMPATIBLE_OBJECTS errors because in a cmp API, 0 indicates equality (not an error). Reported by: king cope
2011-09-14Allow for dynamic base in Win64 FIPS module.Andy Polyakov1-0/+1
2011-02-14Reorganise ECC code for inclusion in FIPS module.Dr. Stephen Henson1-68/+2
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.
2011-02-12New option to disable characteristic two fields in EC code.Dr. Stephen Henson1-8/+8
2006-03-15fix problems found by coverity: remove useless codeNils Larsch1-1/+1
2006-02-08remove unnecessary checkNils Larsch1-1/+1
2006-01-08Some error code cleanups (SSL lib. used SSL_R_... codes reserved for alerts)Bodo Möller1-1/+1
2005-09-03fix function name in errorNils Larsch1-1/+1
2005-05-20fix typo, add prototypeNils Larsch1-1/+1
2005-05-16ecc api cleanup; summary:Nils Larsch1-30/+27
- 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-05-08give EC_GROUP_*_nid functions a more meaningful nameNils Larsch1-4/+4
EC_GROUP_get_nid -> EC_GROUP_get_curve_name EC_GROUP_set_nid -> EC_GROUP_set_curve_name
2005-04-26Fix various incorrect error function codes.Bodo Möller1-2/+2
("perl util/ck_errf.pl */*.c */*/*.c" still reports many more.)
2005-03-09Fix typoBodo Möller1-1/+1
PR: 1017 Submitted by: ciresh@yahoo.com Reviewed by: Nils Larsch
2004-03-13Convert openssl code not to assume the deprecated form of BN_zero().Geoff Thorpe1-2/+2
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).
2003-07-21new function EC_GROUP_cmp() (used by EVP_PKEY_cmp())Bodo Möller1-0/+75
Submitted by: Nils Larsch
2003-02-12Allow EC_GROUP objects to share precomputation for improved memoryBodo Möller1-55/+132
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-06implement fast point multiplication with precomputationBodo Möller1-1/+58
Submitted by: Nils Larsch Reviewed by: Bodo Moeller
2002-11-28Cleanse memory using the new OPENSSL_cleanse() function.Richard Levitte1-3/+3
I've covered all the memset()s I felt safe modifying, but may have missed some.
2002-08-26move EC_GROUP_get_basis_type() from ec_lib.c to ec_asn1.cBodo Möller1-39/+0
2002-08-26ASN1 for binary curvesBodo Möller1-0/+39
Submitted by: Nils Larsch
2002-08-02Rename implementations of method functions so that they matchBodo Möller1-62/+31
the new method names where _GF... suffixes have been removed. Revert changes to ..._{get/set}_Jprojective_coordinates_...: The current implementation for ECC over binary fields does not use projective coordinates, and if it did, it would not use Jacobian projective coordinates; so it's OK to use the ..._GFp prefix for all this. Add author attributions to some files so that it doesn't look as if Sun wrote all of this :-)