summaryrefslogtreecommitdiffstats
path: root/crypto/ec
AgeCommit message (Collapse)Author
2016-06-13Ensure that NULL r and s parameters cannot be set on DSA_SIG/ECDSA_SIGs.TJ Saunders
Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1193)
2016-06-13Reorder the setter arguments to more consistently match that of other APIs,TJ Saunders
per review comments. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1193)
2016-06-13Implement DSA_SIG_set0() and ECDSA_SIG_set0(), for setting signature values.TJ Saunders
SSH2 implementations which use DSA_do_verify() and ECDSA_do_verify() are given the R and S values, and the data to be signed, by the client. Thus in order to validate these signatures, SSH2 implementations will digest and sign the data -- and then pass in properly provisioned DSA_SIG and ECDSA_SIG objects. Unfortunately, the existing OpenSSL-1.1.0 APIs do not allow for directly setting those R and S values in these objects, which makes using OpenSSL for such SSH2 implementations much more difficult. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1193)
2016-06-09RT 4242: reject invalid EC point coordinatesEmilia Kasper
We already test in EC_POINT_oct2point that points are on the curve. To be on the safe side, move this check to EC_POINT_set_affine_coordinates_* so as to also check point coordinates received through some other method. We do not check projective coordinates, though, as - it's unlikely that applications would be receiving this primarily internal representation from untrusted sources, and - it's possible that the projective setters are used in a setting where performance matters. Reviewed-by: Rich Salz <rsalz@openssl.org>
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-31Parameter copy sanity checks.Dr. Stephen Henson
Don't copy parameters is they're already present in the destination. Return error if an attempt is made to copy different parameters to destination. Update documentation. If key type is not initialised return missing parameters RT#4149 Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-29x86_64 assembly pack: tolerate spaces in source directory name.Andy Polyakov
[as it is now quoting $output is not required, but done just in case] Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-28SPARC assembly pack: add missing .type directives.Andy Polyakov
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-23Remove unused error/function codes.Rich Salz
Add script to find unused err/reason codes Remove unused reason codes. Remove entries for unused functions Reviewed-by: Matt Caswell <matt@openssl.org>
2016-05-23Fix and simplify error handling in (RSA/EC_kmeth)_new_method()FdaSilvaYY
Inspired from PR #873. Nearly same as 2bbf0ba. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-05-21Add OpenSSL copyright to .pl filesRich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-17Manual fixes after copyright consolidationRich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-17Copyright consolidation 05/10Rich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-17Copyright consolidation 06/10Rich Salz
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-05-11Adding missing BN_CTX_(start/end) in crypto/ec/ec_key.cSteven Valdez
RT#4363 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Stephen Henson <steve@openssl.org>
2016-05-09fix tab-space mixed indentationFdaSilvaYY
No code change Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-05-09few missing allocation failure checks and releases on error pathsJ Mohan Rao Arisankala
- Missing checks for allocation failure. - releasing memory in few missing error paths Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-05-05Document inversion ladder in curve25519Emilia Kasper
This demystifies two for-loops that do nothing. They were used to write the ladder in a unified way. Now that the ladder is otherwise commented, remove the dead loops. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-04-29Remove some dead code from EC_GROUP_check()Matt Caswell
EC_GROUP_check() was obtaining a temporary BIGNUM from the BN_CTX, but then not using it. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-04-29Avoid a NULL ptr deref if group is not setMatt Caswell
We should only copy parameters and keys if the group is set. Otherwise they don't really make any sense. Previously we copied the private key regardless of whether the group was set...but if it wasn't a NULL ptr deref could occur. It's unclear whether we could ever get into that situation, but since we were already checking it for the public key we should be consistent. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-04-23Fix EC_KEY_set_private_key() to call key->group->meth->set_private()Kazuki Yamaguchi
Fix a bug introduced by 6903e2e7e9a4 (Extended EC_METHOD customisation support., 2016-02-01). key->meth->set_private() is wrongly called where it should call key->group->meth->set_private(). PR#4517 Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Stephen Henson <steve@openssl.org>
2016-04-20Remove --classic build entirelyRichard Levitte
The Unix build was the last to retain the classic build scheme. The new unified scheme has matured enough, even though some details may need polishing. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-04-14Fix the spelling of "implement".Shlomi Fish
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-29RT 4393: Call EC_GROUP_order_bits in priv2opt.David Benjamin
The private key is a scalar and should be sized by the order, not the degree. See RFC 5915. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-03-21Remove the remainder of util/mk1mf.pl and companion scriptsRichard Levitte
This removes all scripts that deal with MINFO as well, since that's only used by mk1mf. Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-20Remove #error from include files.Rich Salz
Don't have #error statements in header files, but instead wrap the contents of that file in #ifndef OPENSSL_NO_xxx This means it is now always safe to include the header file. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-19constify ECDSA_SIG_get0()Dr. Stephen Henson
PR#4436 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-03-13Add $(LIB_CFLAGS) for any build.info generator that uses $(CFLAGS)Richard Levitte
The reason to do so is that some of the generators detect PIC flags like -fPIC and -KPIC, and those are normally delivered in LD_CFLAGS. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-11crypto/*/build.info: make it work on ARM platforms.Andy Polyakov
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-03-11Fix some assembler generating scripts for better unificationRichard Levitte
Some of these scripts would recognise an output parameter if it looks like a file path. That works both in both the classic and new build schemes. Some fo these scripts would only recognise it if it's a basename (i.e. no directory component). Those need to be corrected, as the output parameter in the new build scheme is more likely to contain a directory component than not. Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-10Add include directory options for assembler files that include from crypto/Richard Levitte
Closes RT#4406 Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-10The typedef ECPARAMETERS is already defined, don't define it anewRichard Levitte
Reviewed-by: Matt Caswell <matt@openssl.org>
2016-03-09RT3676: Expose ECgroup i2d functionsRich Salz
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
2016-03-09Make sure the effect of "pic" / "no-pic" is used with assembler compilationsRichard Levitte
Before the 'Introduce the "pic" / "no-pic" config option' commit, the shared_cflag value for the chosen config would be part of the make variable CFLAG, which got replicated into CFLAGS and ASFLAGS. Since said commit, the shared_cflag value has become a make variable of its own, SHARED_CFLAG (which is left empty in a "no-pic" build). However, ASFLAGS was forgotten. That's what's corrected with this change. Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-09ec/asm/ecp_nistz256-sparcv9.pl: get corner logic right.Andy Polyakov
RT#4284 Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-09Unified - adapt the generation of ec assembler to use GENERATERichard Levitte
This gets rid of the BEGINRAW..ENDRAW sections in crypto/ec/build.info. This also moves the assembler generating perl scripts to take the output file name as last command line argument, where necessary. Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-03-08Include e_os.h from ec_lcl.hRichard Levitte
The EC code recently started using REF_PRINT_COUNT and REF_ASSERT_ISNT. Those are defined in e_os.h. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-08Convert CRYPTO_LOCK_X509_* to new multi-threading APIAlessandro Ghedini
Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@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-08SPARCv9 assembly pack: unify build rules and argument handling.Andy Polyakov
Make all scripts produce .S, make interpretation of $(CFLAGS) pre-processor's responsibility, start accepting $(PERLASM_SCHEME). [$(PERLASM_SCHEME) is redundant in this case, because there are no deviataions between Solaris and Linux assemblers. This is purely to unify .pl->.S handling across all targets.] Reviewed-by: Richard Levitte <levitte@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-03-04Curve25519: fix const-initializationEmilia Kasper
Clang is permissive of this, but gcc fails. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-04Curve25519: avoid undefined behaviourEmilia Kasper
Appease the sanitizer: avoid left shifts of negative values. This could've been done entirely with casts to uint and back, but using masks seemed slightly more readable. There are also implementation-defined signed right shifts in this code. Those remain. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-03Clean up curve25519 buildEmilia Kasper
- Remove OPENSSL_X25519_X86_64 which never worked, because we don't have the assembly. - Also remove OPENSSL_SMALL (which should have been OPENSSL_SMALL_FOOTPRINT) which isn't a priority at the moment. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-02make errorsDr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-02Handle KDF internally.Dr. Stephen Henson
Handle KDF in ECDH_compute_key instead of requiring each implementation support it. This modifies the compute_key method: now it allocates and populates a buffer containing the shared secret. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-02curve25519: add missing const-qualifierEmilia Kasper
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2016-03-02Make k25519Precomp constKurt Roeckx
Reviewed-by: Dr. Stephen Henson <steve@openssl.org> MR: #2184
2016-03-01make errorsDr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-03-01Add default operations to EC_METHODDr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org>