aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ec
Commit message (Collapse)AuthorAgeFilesLines
* Fix crash in ecdh_simple_compute_key.Bernd Edlinger2017-06-141-0/+4
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3671)
* Fix a memleak in ec_copy_parameters.Bernd Edlinger2017-06-131-2/+6
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3666)
* make error tables const and separate header fileRich Salz2017-06-071-226/+280
| | | | | | | | | | | | | | | | | | | Run perltidy on util/mkerr Change some mkerr flags, write some doc comments Make generated tables "const" when genearting lib-internal ones. Add "state" file for mkerr Renerate error tables and headers Rationalize declaration of ERR_load_XXX_strings Fix out-of-tree build Add -static; sort flags/vars for options. Also tweak code output Moved engines/afalg to engines (from master) Use -static flag Standard engine #include's of errors Don't linewrap err string tables unless necessary Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3392)
* ec/asm/ecp_nistz256-x86_64.pl: minor sqr_montx cleanup.Andy Polyakov2017-06-051-13/+9
| | | | | | Drop some redundant instructions in reduction in ecp_nistz256_sqr_montx. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Left shift of a negative number is undefined behaviourMatt Caswell2017-06-021-115/+115
| | | | | | | | | | | | Fix undefined behaviour in curve25519.c. Prior to this running with ubsan produces errors like this: crypto/ec/curve25519.c:3871:18: runtime error: left shift of negative value -22867 [extended tests] Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3600)
* Clear sensitive data in ED25519_signDr. Stephen Henson2017-05-301-1/+7
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3503)
* Add custom sig_info_set for ED25519Dr. Stephen Henson2017-05-301-1/+10
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3503)
* make errorsDr. Stephen Henson2017-05-301-0/+1
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3503)
* Add custom ASN.1 sign and verifyDr. Stephen Henson2017-05-301-1/+35
| | | | | | | Since ED25519 doesn't have an associated digest it needs custom sign/verify routines to handle ASN.1 signatures. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3503)
* make errorsDr. Stephen Henson2017-05-301-1/+3
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3503)
* ED25519 public key method.Dr. Stephen Henson2017-05-301-8/+69
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3503)
* Add ED25519 ASN.1 methodDr. Stephen Henson2017-05-301-10/+54
| | | | | | | | Make X25519 key method more flexible by removing hard coding of NID_X25519 OID. Since the parameters and key syntax between ED25519 and X25519 are almost identical they can share a lot of common code. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3503)
* Make Ed25519 consistent with X25519Dr. Stephen Henson2017-05-302-21/+9
| | | | | | | | | | Rename and change ED25519_keypair_from_seed to ED25519_public_from_private to be consistent with X25519 API. Modidy ED25519_sign to take separate public key argument instead of requiring it to follow the private key. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3503)
* Add Ed25519 algorithm.Dr. Stephen Henson2017-05-302-0/+1335
| | | | | | | Reinstate Ed25519 algorithm to curv25519.c this is largely just a copy of the code from BoringSSL with some adjustments so it compiles under OpenSSL. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3503)
* Remove filename argument to x86 asm_init.David Benjamin2017-05-111-1/+1
| | | | | | | | | | | | | | | The assembler already knows the actual path to the generated file and, in other perlasm architectures, is left to manage debug symbols itself. Notably, in OpenSSL 1.1.x's new build system, which allows a separate build directory, converting .pl to .s as the scripts currently do result in the wrong paths. This also avoids inconsistencies from some of the files using $0 and some passing in the filename. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3431)
* Cleanup - use e_os2.h rather than stdint.hRichard Levitte2017-05-111-7/+1
| | | | | | | Not exactly everywhere, but in those source files where stdint.h is included conditionally, or where it will be eventually Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3447)
* Fix URL links in commentRich Salz2017-05-021-3/+7
| | | | Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3365)
* Address some -Wold-style-declaration warningsBenjamin Kaduk2017-05-011-2/+2
| | | | | | | | | | | | | | | | | | | gcc's -Wextra pulls in -Wold-style-declaration, which triggers when a declaration has a storage-class specifier as a non-initial qualifier. The ISO C formal grammar requires the storage-class to be the first component of the declaration, if present. Seeint as the register storage-class specifier does not really have any effect anymore with modern compilers, remove it entirely while we're here, instead of fixing up the order. Interestingly, the gcc devteam warnings do not pull in -Wextra, though the clang ones do. [extended tests] Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3239)
* ASN.1: adapt our use of INTxx et al by making them explicitely embeddedRichard Levitte2017-04-131-6/+6
| | | | | | Fixes #3191 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3199)
* Act on deprecation of LONG and ZLONG, step 2Richard Levitte2017-04-101-12/+12
| | | | | | | Replace all remaining uses of LONG and ZLONG with INT32 / ZINT32. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3126)
* Add EC_KEY_get0_engine()Richard Levitte2017-03-151-0/+5
| | | | | | | Just as for DH, DSA and RSA, this gives the engine associated with the key. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2960)
* Increase the size of the stack buffer to prevent an overflow.Pauli2017-02-241-1/+1
| | | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2721)
* Fix typo, should be && rather than &Richard Levitte2017-02-221-1/+1
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2689)
* Iterate over EC_GROUP's poly array in a safe wayRich Salz2017-02-221-3/+6
| | | | | | | | | Prevent that memory beyond the last element is accessed if every element of group->poly[] is non-zero Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2689)
* mem leak on error path and error propagation fixYuchi2017-02-141-1/+3
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2559)
* ec/asm/ecp_nistz256-x86_64.pl: add CFI directives.Andy Polyakov2017-02-131-0/+133
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* ec/asm/ecp_nistz256-x86_64.pl: fix typo-bug in Win64 SE handler.Andy Polyakov2017-02-131-2/+2
| | | | | | Thanks to Jun Sun for spotting this. Reviewed-by: Rich Salz <rsalz@openssl.org>
* x86_64 assembly pack: Win64 SEH face-lift.Andy Polyakov2017-02-061-75/+455
| | | | | | | | - harmonize handlers with guidelines and themselves; - fix some bugs in handlers; - add missing handlers in chacha and ecp_nistz256 modules; Reviewed-by: Rich Salz <rsalz@openssl.org>
* ec/asm/ecp_nistz256-ppc64.pl: minor POWER8-specific optimization.Andy Polyakov2017-01-211-18/+18
| | | | | | Up to 4% depending on benchmark. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add support for reference counting using C11 atomicsKurt Roeckx2016-11-177-18/+19
| | | | | | | Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> GH: #1500
* Check return value of some BN functions.Rich Salz2016-11-151-9/+11
| | | | | | | | | | | Factorise multiple bn_get_top(group->field) calls Add missing checks on some conditional BN_copy return value Add missing checks on some BN_copy return value Add missing checks on a few bn_wexpand return value Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1626)
* Revert "Move algorithm specific ppccap code from crypto/ppccap.c"Richard Levitte2016-11-101-38/+0
| | | | | | | | | Now that we can link specifically with static libraries, the immediate need to split ppccap.c (and eventually other *cap.c files) is no more. This reverts commit e3fb4d3d52e188b83ccb8506aa2f16cb686f4d6c. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Move algorithm specific ppccap code from crypto/ppccap.cRichard Levitte2016-11-091-0/+38
| | | | | | | Having that code in one central object file turned out to cause trouble when building test/modes_internal_test. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1883)
* Remove trailing whitespace from some files.David Benjamin2016-10-104-11/+11
| | | | | | | | | | | | | | | | | | The prevailing style seems to not have trailing whitespace, but a few lines do. This is mostly in the perlasm files, but a few C files got them after the reformat. This is the result of: find . -name '*.pl' | xargs sed -E -i '' -e 's/( |'$'\t'')*$//' find . -name '*.c' | xargs sed -E -i '' -e 's/( |'$'\t'')*$//' find . -name '*.h' | xargs sed -E -i '' -e 's/( |'$'\t'')*$//' Then bn_prime.h was excluded since this is a generated file. Note mkerr.pl has some changes in a heredoc for some help output, but other lines there lack trailing whitespace too. Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Add -Wswitch-enumRich Salz2016-09-222-6/+26
| | | | | | | Change code so when switching on an enumeration, have case's for all enumeration values. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Fix EC_KEY_print so it prints out private key informationTim Hudson2016-09-101-1/+1
| | | | | | even when the public key is not present in an EC_KEY Reviewed-by: Stephen Henson <steve@openssl.org>
* Avoid EVP_PKEY_cmp() crash on EC keys without public componentDavid Woodhouse2016-09-071-0/+4
| | | | | | | | | | | | | | | | | Some hardware devices don't provide the public EC_POINT data. The only way for X509_check_private_key() to validate that the key matches a given certificate is to actually perform a sign operation and then verify it using the public key in the certificate. Maybe that can come later, as discussed in issue 1532. But for now let's at least make it fail gracefully and not crash. GH: 1532 Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1547) (cherry picked from commit 92ed7fa575a80955f3bb6efefca9bf576a953586)
* Add ecp_nistz256-ppc64 module.Andy Polyakov2016-08-292-0/+2376
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Remove comment tags from structs (coding style)Rich Salz2016-08-291-5/+5
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Use uppercase name for PCT_ enumRich Salz2016-08-292-16/+21
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* ec/asm/ecp_nistz256-x86_64.pl: /cmovb/cmovc/ as nasm doesn't recognize cmovb.Andy Polyakov2016-08-241-40/+40
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* ec/ecp_nistz256: harmonize is_infinity with ec_GFp_simple_is_at_infinity.Andy Polyakov2016-08-244-212/+102
| | | | | | RT#4625 Reviewed-by: Rich Salz <rsalz@openssl.org>
* ec/ecp_nistz256: harmonize is_infinity with ec_GFp_simple_is_at_infinity.Andy Polyakov2016-08-242-31/+50
| | | | | | RT#4625 Reviewed-by: Rich Salz <rsalz@openssl.org>
* ec/asm/ecp_nistz256-*.pl: addition to perform stricter reduction.Andy Polyakov2016-08-244-89/+158
| | | | | | | | Addition was not preserving inputs' property of being fully reduced. Thanks to Brian Smith for reporting this. Reviewed-by: Rich Salz <rsalz@openssl.org>
* ec/asm/ecp_nistz256-x86_64.pl: addition to perform stricter reduction.Andy Polyakov2016-08-242-62/+84
| | | | | | | | Addition was not preserving inputs' property of being fully reduced. Thanks to Brian Smith for reporting this. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Fix a memory leak in EC_GROUP_get_ecparameters()Kazuki Yamaguchi2016-08-221-5/+2
| | | | | | | | The variable 'buffer', allocated by EC_POINT_point2buf(), isn't free'd on the success path. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* ecp_nistz256.c: get is_one on 32-bit platforms right.Andy Polyakov2016-08-211-15/+22
| | | | | | Thanks to Brian Smith for reporting this. Reviewed-by: Rich Salz <rsalz@openssl.org>
* constify i2o_ECPublicKeyDr. Stephen Henson2016-08-191-1/+1
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Constify private key decode.Dr. Stephen Henson2016-08-172-5/+5
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* constify X509_ALGOR_get0()Dr. Stephen Henson2016-08-171-8/+8
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>