aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
Commit message (Collapse)AuthorAgeFilesLines
* Create BIO_write_ex() which handles size_t argumentsMatt Caswell2016-10-2822-15/+111
| | | | | | | Also extend BIO_METHOD to be able to supply an implementation for the new BIO_write_ex function. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Create BIO_read_ex() which handles size_t argumentsMatt Caswell2016-10-2823-21/+173
| | | | | | | Also extend BIO_METHOD to be able to supply an implementation for the new BIO_read function. Reviewed-by: Richard Levitte <levitte@openssl.org>
* ppccap.c: engage new multipplication and squaring subroutines.Andy Polyakov2016-10-242-32/+15
| | | | | | [And remove FPU mutiplication subroutine.] Reviewed-by: Rich Salz <rsalz@openssl.org>
* bn/asm/ppc-mont.pl: add optimized multiplication and squaring subroutines.Andy Polyakov2016-10-241-1/+1645
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* bn/asm/ppc-mont.pl: prepare for extension.Andy Polyakov2016-10-241-19/+24
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* sha/asm/sha512-armv8.pl: adapt for kernel use.Andy Polyakov2016-10-241-15/+38
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* x86_64 assembly pack: add Goldmont performance results.Andy Polyakov2016-10-2411-1/+14
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* sha/keccak1600.c: add known answer and verify result with memcmp.Andy Polyakov2016-10-241-3/+83
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* crypto/sha: add Keccak1600 primitives to build SHA-3 upon.Andy Polyakov2016-10-241-0/+281
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix support for DragonFly BSDjrmarino2016-10-224-6/+6
| | | | | | | | | The __DragonFly__ macros were introduced in issue #1546 along with a function naming fix, but it was decided they should be handled separately. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1765)
* GH1546: Fix old names in cryptodev code.Rich Salz2016-10-211-2/+2
| | | | | | Add DragonFly version of BSD. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1584)
* Do not set load_crypto_strings_inited when OPENSSL_NO_ERR is definedMat2016-10-191-1/+1
| | | | | | | | | | | | | | | | Only set the load_crypto_strings_inited to 1 when err_load_crypto_strings_int was called. This solves the following issue: - openssl is built with no-err - load_crypto_strings_inited is set to 1 during the OPENSSL_init_crypto call - During the cleanup: OPENSSL_cleanup, err_free_strings_int is called because load_crypto_strings_inited == 1 - err_free_strings_int calls do_err_strings_init because it has never been called - Now do_err_strings_init calls OPENSSL_init_crypto - But since we are in the cleanup (stopped == 1) this results in an error: CRYPTOerr(CRYPTO_F_OPENSSL_INIT_CRYPTO, ERR_R_INIT_FAIL); - which then tries to initialize everything we are trying to clean up: ERR_get_state, ossl_init_thread_start, etc Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1654)
* Add error checking, small nit on ouputFdaSilvaYY2016-10-191-2/+3
| | | | | Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1632)
* Fix config option 'no-deprecated'Richard Levitte2016-10-191-0/+2
| | | | | | | | crypto/asn1/asn1_item_list.c needed including dh.h and rsa.h directly. The reason is that they are not included by x509.h when configured 'no-deprecated' Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1741)
* Fix strict-warnings buildPatrick Steuer2016-10-181-0/+1
| | | | | | | | | | | | | crypto/s390xcap.c: internal/cryptlib.h needs to be included for OPENSSL_cpuid_setup function prototype is located there to avoid build error due to -Werror=missing-prototypes. Signed-off-by: Patrick Steuer <psteuer@mail.de> Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> CLA: trivial
* Fix strict-warnings buildPatrick Steuer2016-10-182-6/+6
| | | | | | | | | | | | | | | | | crypto/evp/e_aes.c: Types of inp and out parameters of AES_xts_en/decrypt functions need to be changed from char to unsigned char to avoid build error due to '-Werror=incompatible-pointer-types'. crypto/aes/asm/aes-s390x.pl: Comments need to reflect the above change. Signed-off-by: Patrick Steuer <psteuer@mail.de> Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> CLA: trivial
* Fix strict-warnings buildPatrick Steuer2016-10-181-1/+1
| | | | | | | | | | | | | crypto/asn1/a_strex.c: Type of width variable in asn1_valid_host function needs to be changed from char to signed char to avoid build error due to '-Werror=type-limits'. Signed-off-by: Patrick Steuer <psteuer@mail.de> Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> CLA: trivial
* Fix embedded string handling.Dr. Stephen Henson2016-10-174-9/+19
| | | | | | | | | Don't rely on embedded flag to free strings correctly: it wont be set if there is a malloc failure during initialisation. Thanks to Guido Vranken for reporting this issue. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1725)
* Ensure we handle len == 0 in ERR_err_string_nMatt Caswell2016-10-151-0/+3
| | | | | | | | | | | | If len == 0 in a call to ERR_error_string_n() then we can read beyond the end of the buffer. Really applications should not be calling this function with len == 0, but we shouldn't be letting it through either! Thanks to Agostino Sarubbo for reporting this issue. Agostino's blog on this issue is available here: https://blogs.gentoo.org/ago/2016/10/14/openssl-libcrypto-stack-based-buffer-overflow-in-err_error_string_n-err-c/ Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix X509_NAME decode for malloc failures.Dr. Stephen Henson2016-10-111-17/+20
| | | | | | | | | | | | The original X509_NAME decode free code was buggy: this could result in double free or leaks if a malloc failure occurred. Simplify and fix the logic. Thanks to Guido Vranken for reporting this issue. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1691)
* Fix up bn_prime.pl formatting.David Benjamin2016-10-102-260/+259
| | | | | | | | Align at 5 characters, not 4. There are 5-digit numbers in the output. Also avoid emitting an extra blank line and trailing whitespace. Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Remove trailing whitespace from some files.David Benjamin2016-10-1079-362/+362
| | | | | | | | | | | | | | | | | | 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>
* SRP code tidy.Dr. Stephen Henson2016-10-011-69/+17
| | | | | | | | | Tidy up srp_Calc_k and SRP_Calc_u by making them a special case of srp_Calc_xy which performs SHA1(PAD(x) | PAD(y)). This addresses an OCAP Audit issue. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Print <ABSENT> if a STACK is NULL.Dr. Stephen Henson2016-09-291-1/+2
| | | | | | | If a STACK (corresponding to SEQUENCE OF or SET OF) is NULL then the field is absent as opposed to empty (present but has zero elements). Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add ASN1_ITEM lookup and enumerate functions.Dr. Stephen Henson2016-09-293-1/+204
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add -Wswitch-enumRich Salz2016-09-227-31/+86
| | | | | | | Change code so when switching on an enumeration, have case's for all enumeration values. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Add OCSP_RESPID_match()Matt Caswell2016-09-221-1/+27
| | | | | | | Add a function for testing whether a given OCSP_RESPID matches with a certificate. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add the ability to set OCSP_RESPID fieldsMatt Caswell2016-09-221-10/+37
| | | | | | | OCSP_RESPID was made opaque in 1.1.0, but no accessors were provided for setting the name/key value for the OCSP_RESPID. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Don't leak on an OPENSSL_realloc() failureMatt Caswell2016-09-211-10/+6
| | | | | | | If OPENSSL_sk_insert() calls OPENSSL_realloc() and it fails, it was leaking the originally allocated memory. Reviewed-by: Rich Salz <rsalz@openssl.org>
* rand/randfile.c: treat empty string in RAND_file_name as error.Andy Polyakov2016-09-211-1/+1
| | | | | | Suggested in GH#1589. Reviewed-by: Rich Salz <rsalz@openssl.org>
* rand/randfile.c: rationalize __OpenBSD__ code path.Andy Polyakov2016-09-211-5/+1
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* rand/randfile.c: restore fallback to $HOME for non-setuid programs.Andy Polyakov2016-09-211-4/+6
| | | | | | Reported in GH#1589, but solution is different from suggested. Reviewed-by: Rich Salz <rsalz@openssl.org>
* GH1555: Don't bump size on realloc failureRich Salz2016-09-211-1/+1
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Revert "Constify code about X509_VERIFY_PARAM"Rich Salz2016-09-211-2/+2
| | | | | | This reverts commit 81f9ce1e1965e0e33db6d2391285c4c1b6af0434. Reviewed-by: Matt Caswell <matt@openssl.org>
* Fix a missing NULL check in dsa_builtin_paramgenMatt Caswell2016-09-211-0/+3
| | | | | | | | | We should check the last BN_CTX_get() call to ensure that it isn't NULL before we try and use any of the allocated BIGNUMs. Issue reported by Shi Lei. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Convert num_alloc to a size_t in stack.c and tweak styleMatt Caswell2016-09-191-34/+23
| | | | | | | | | | | We were casting num_alloc to size_t in lots of places, or just using it in a context where size_t makes more sense - so convert it. This simplifies the code a bit. Also tweak the style in stack.c a bit following on from the previous commit Reviewed-by: Rich Salz <rsalz@openssl.org>
* Prevent overflows in stack APIGuido Vranken2016-09-191-8/+42
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Constify code about X509_VERIFY_PARAMFdaSilvaYY2016-09-181-2/+2
| | | | | Reviewed-by: Viktor Dukhovni <viktor@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1594)
* Remove an useless definition.FdaSilvaYY2016-09-171-1/+1
| | | | | | | APP_INFO is currently a field of MEM struct. Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1583)
* Add some sanity checks around usage of t_fromb64()Matt Caswell2016-09-141-9/+27
| | | | | | | | | | | | | | | The internal SRP function t_fromb64() converts from base64 to binary. It does not validate that the size of the destination is sufficiently large - that is up to the callers. In some places there was such a check, but not in others. Add an argument to t_fromb64() to provide the size of the destination buffer and validate that we don't write too much data. Also add some sanity checks to the callers where appropriate. With thanks to Shi Lei for reporting this issue. Reviewed-by: Richard Levitte <levitte@openssl.org>
* bn/bn_lcl.h: improve interoperability with clang and Android NDK.Andy Polyakov2016-09-131-2/+2
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* VMS: be less picky when loading DSOsRichard Levitte2016-09-111-9/+7
| | | | | | | | | | | The DSO API was picky about casing of symbol names on VMS. There's really no reason to be that picky, it's mostly just annoying. Therefore, we take away the possibility to flag for a choice, and will instead first try to find a symbol with exact case, and failing that, we try to find it in upper case. Reviewed-by: Rich Salz <rsalz@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>
* If errno is ENXIO in BSS_new_file(), set BIO_R_NO_SUCH_FILERichard Levitte2016-09-081-1/+5
| | | | | | | VMS sets that errno when the device part of a file spec is malformed or a logical name that doesn't exist. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Fix mem leaks during auto-deinitMatt Caswell2016-09-085-0/+5
| | | | | | | | | | | | | | Certain functions are automatically called during auto-deinit in order to deallocate resources. However, if we have never entered a function which marks lib crypto as inited then they never get called. This can happen if the user only ever makes use of a small sub-set of functions that don't hit the auto-init code. This commit ensures all such resources deallocated by these functions also init libcrypto when they are initially allocated. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Ben Laurie <ben@openssl.org>
* chacha/asm/chacha-ppc.pl: add missing .text directive.Andy Polyakov2016-09-081-0/+1
| | | | | | RT#4667 Reviewed-by: Rich Salz <rsalz@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)
* GH1537: Avoid double-free in the EVP_PKEY APIAlex Gaynor2016-09-071-1/+1
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
* Misc BN fixesRich Salz2016-09-063-15/+23
| | | | | | | | | | | | | | | | | Never output -0; make "negative zero" an impossibility. Do better checking on BN_rand top/bottom requirements and #bits. Update doc. Ignoring trailing garbage in BN_asc2bn. Port this commit from boringSSL: https://boringssl.googlesource.com/boringssl/+/899b9b19a4cd3fe526aaf5047ab9234cdca19f7d%5E!/ Ensure |BN_div| never gives negative zero in the no_branch code. Have |bn_correct_top| fix |bn->neg| if the input is zero so that we don't have negative zeros lying around. Thanks to Brian Smith for noticing. Reviewed-by: Richard Levitte <levitte@openssl.org>
* modes/asm/ghash-armv4.pl: improve interoperability with Android NDK.Andy Polyakov2016-09-031-1/+3
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>