aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ec
Commit message (Collapse)AuthorAgeFilesLines
* Add missing include of cryptlib.hRich Salz2017-08-061-1/+1
| | | | | | | Also use "" not <> for all include cryptlib Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4082)
* Add RAND_priv_bytes() for private keysRich Salz2017-08-032-2/+2
| | | | | | | | | | Add a new global DRBG for private keys used by RAND_priv_bytes. Add BN_priv_rand() and BN_priv_rand_range() which use RAND_priv_bytes(). Change callers to use the appropriate BN_priv... function. Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/4076)
* Switch from ossl_rand to DRBG randRich Salz2017-08-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If RAND_add wraps around, XOR with existing. Add test to drbgtest that does the wrap-around. Re-order seeding and stop after first success. Add RAND_poll_ex() Use the DF and therefore lower RANDOMNESS_NEEDED. Also, for child DRBG's, mix in the address as the personalization bits. Centralize the entropy callbacks, from drbg_lib to rand_lib. (Conceptually, entropy is part of the enclosing application.) Thanks to Dr. Matthias St Pierre for the suggestion. Various code cleanups: -Make state an enum; inline RANDerr calls. -Add RAND_POLL_RETRIES (thanks Pauli for the idea) -Remove most RAND_seed calls from rest of library -Rename DRBG_CTX to RAND_DRBG, etc. -Move some code from drbg_lib to drbg_rand; drbg_lib is now only the implementation of NIST DRBG. -Remove blocklength Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/4019)
* Use OPENSSL_secure_clear_free for secure mem BIOs and X25519 private keysBernd Edlinger2017-07-291-1/+1
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4044)
* Fix const correctness of EC_KEY_METHOD_get_*Johannes Bauer2017-07-231-5/+5
| | | | | | | | | | Changes the EC_KEY_METHOD_get_* family to not need a EC_KEY_METHOD* as its first parameter, but a const EC_KEY_METHOD*, which is entirely sufficient. Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Paul Dale <paul.dale@oracle.com> GH: #3985
* Cleanup some copyright stuffRich Salz2017-06-301-0/+7
| | | | | | | | | | | | | | Remove some incorrect copyright references. Move copyright to standard place Add OpenSSL copyright where missing. Remove copyrighted file that we don't use any more Remove Itanium assembler for RC4 and MD5 (assembler versions of old and weak algorithms for an old chip) Standardize apps/rehash copyright comment; approved by Timo Put dual-copyright notice on mkcert Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3691)
* Merge Intel copyright notice into standardRich Salz2017-06-303-86/+27
| | | | | | | This is done with the kind permission of Intel. Reviewed-by: Tim Hudson <tjh@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3813)
* Change to check last return value of BN_CTX_getPaul Yang2017-06-264-27/+39
| | | | | | | | 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)
* Use EVP_PKEY_X25519, EVP_PKEY_ED25519 instead of NIDs where appropriate.Dr. Stephen Henson2017-06-211-9/+10
| | | | Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3585)
* Modify Sun copyright to follow OpenSSL styleRich Salz2017-06-2016-156/+16
| | | | | | | Approved by Oracle. Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de> (Merged from https://github.com/openssl/openssl/pull/3585)
* 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>