summaryrefslogtreecommitdiffstats
path: root/crypto
AgeCommit message (Collapse)Author
2015-03-19Prepare for 1.0.2a releaseOpenSSL_1_0_2aMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-19make updateMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-19Fix a failure to NULL a pointer freed on error.Matt Caswell
Reported by the LibreSSL project as a follow on to CVE-2015-0209 Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-19PKCS#7: avoid NULL pointer dereferences with missing contentEmilia Kasper
In PKCS#7, the ASN.1 content component is optional. This typically applies to inner content (detached signatures), however we must also handle unexpected missing outer content correctly. This patch only addresses functions reachable from parsing, decryption and verification, and functions otherwise associated with reading potentially untrusted data. Correcting all low-level API calls requires further work. CVE-2015-0289 Thanks to Michal Zalewski (Google) for reporting this issue. Reviewed-by: Steve Henson <steve@openssl.org>
2015-03-19Fix ASN1_TYPE_cmpDr. Stephen Henson
Fix segmentation violation when ASN1_TYPE_cmp is passed a boolean type. This can be triggered during certificate verification so could be a DoS attack against a client or a server enabling client authentication. CVE-2015-0286 Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-19Reject invalid PSS parameters.Dr. Stephen Henson
Fix a bug where invalid PSS parameters are not rejected resulting in a NULL pointer exception. This can be triggered during certificate verification so could be a DoS attack against a client or a server enabling client authentication. Thanks to Brian Carpenter for reporting this issues. CVE-2015-0208 Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-03-19Free up ADB and CHOICE if already initialised.Dr. Stephen Henson
CVE-2015-0287 Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org>
2015-03-17Remove dead code from cryptoMatt Caswell
Some miscellaneous removal of dead code from lib crypto. Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit b7573c597c1932ef709b2455ffab47348b5c54e5)
2015-03-17Fix memset call in stack.cMatt Caswell
The function sk_zero is supposed to zero the elements held within a stack. It uses memset to do this. However it calculates the size of each element as being sizeof(char **) instead of sizeof(char *). This probably doesn't make much practical difference in most cases, but isn't a portable assumption. Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 7132ac830fa08d9a936e011d7c541b0c52115b33)
2015-03-15Fix regression in ASN1_UTCTIME_cmp_time_tCarl Jackson
Previously, ASN1_UTCTIME_cmp_time_t would return 1 if s > t, -1 if s < t, and 0 if s == t. This behavior was broken in a refactor [0], resulting in the opposite time comparison behavior. [0]: 904348a4922333106b613754136305db229475ea PR#3706 Reviewed-by: Stephen Henson <steve@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit da27006df06853a33b132133699a7aa9d4277920)
2015-03-14Avoid reading an unused byte after the bufferAndy Polyakov
Other curves don't have this problem. Reviewed-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Emilia Käsper <emilia@openssl.org> (cherry picked from commit 9fbbdd73c58c29dc46cc314f7165e45e6d43fd60)
2015-03-13Fix undefined behaviour in shifts.Emilia Kasper
Td4 and Te4 are arrays of u8. A u8 << int promotes the u8 to an int first then shifts. If the mathematical result of a shift (as modelled by lhs * 2^{rhs}) is not representable in an integer, behaviour is undefined. In other words, you can't shift into the sign bit of a signed integer. Fix this by casting to u32 whenever we're shifting left by 24. (For consistency, cast other shifts, too.) Caught by -fsanitize=shift Submitted by Nick Lewycky (Google) Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 8b37e5c14f0eddb10c7f91ef91004622d90ef361)
2015-03-12ASN.1 print fix.Dr. Stephen Henson
When printing out an ASN.1 structure if the type is an item template don't fall thru and attempt to interpret as a primitive type. Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 5dc1247a7494f50c88ce7492518bbe0ce6f124fa)
2015-03-12Fix missing return checks in v3_cpols.cMatt Caswell
Fixed assorted missing return value checks in c3_cpols.c Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit c5f2b5336ab72e40ab91e2ca85639f51fa3178c6)
2015-03-12Fix dsa_pub_encodeMatt Caswell
The return value from ASN1_STRING_new() was not being checked which could lead to a NULL deref in the event of a malloc failure. Also fixed a mem leak in the error path. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 0c7ca4033dcf5398334d4b78a7dfb941c8167a40)
2015-03-12Fix dh_pub_encodeMatt Caswell
The return value from ASN1_STRING_new() was not being checked which could lead to a NULL deref in the event of a malloc failure. Also fixed a mem leak in the error path. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 6aa8dab2bbfd5ad3cfc0d07fe5d7243635d5b2a2)
2015-03-12Fix asn1_item_print_ctxMatt Caswell
The call to asn1_do_adb can return NULL on error, so we should check the return value before attempting to use it. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 34a7ed0c39aa3ab67eea1e106577525eaf0d7a00)
2015-03-12ASN1_primitive_new NULL param handlingMatt Caswell
ASN1_primitive_new takes an ASN1_ITEM * param |it|. There are a couple of conditional code paths that check whether |it| is NULL or not - but later |it| is deref'd unconditionally. If |it| was ever really NULL then this would seg fault. In practice ASN1_primitive_new is marked as an internal function in the public header file. The only places it is ever used internally always pass a non NULL parameter for |it|. Therefore, change the code to sanity check that |it| is not NULL, and remove the conditional checking. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 9e488fd6ab2c295941e91a47ab7bcd346b7540c7)
2015-03-12Fix EVP_DigestInit_ex with NULL digestMatt Caswell
Calling EVP_DigestInit_ex which has already had the digest set up for it should be possible. You are supposed to be able to pass NULL for the type. However currently this seg faults. Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit a01087027bd0c5ec053d4eabd972bd942bfcd92f)
2015-03-12Fix error handling in bn_expMatt Caswell
In the event of an error |rr| could be NULL. Therefore don't assume you can use |rr| in the error handling code. Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 8c5a7b33c6269c3bd6bc0df6b4c22e4fba03b485)
2015-03-12evp/e_aes.c: fix SPARC T4-specific problem:Andy Polyakov
- SIGSEGV/ILL in CCM (RT#3688); Reviewed-by: Matt Caswell <matt@openssl.org>
2015-03-11Fix seg fault in ASN1_generate_v3/ASN1_generate_nconfMatt Caswell
Reviewed-by: Dr. Stephen Henson <steve@openssl.org> (cherry picked from commit ac5a110621ca48f0bebd5b4d76d081de403da29e)
2015-03-10BIO_debug_callback: Fix output on 64-bit machinesRichard Godbee
BIO_debug_callback() no longer assumes the hexadecimal representation of a pointer fits in 8 characters. Signed-off-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 460e920d8a274e27aab36346eeda6685a42c3314)
2015-03-09Fix wrong numbers being passed as string lengthsDmitry-Me
Signed-off-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 0b142f022e2c5072295e00ebc11c5b707a726d74)
2015-03-08Cleanse PKCS#8 private key components.Dr. Stephen Henson
New function ASN1_STRING_clear_free which cleanses an ASN1_STRING structure before freeing it. Call ASN1_STRING_clear_free on PKCS#8 private key components. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit a8ae0891d4bfd18f224777aed1fbb172504421f1)
2015-03-05Unchecked malloc fixesMatt Caswell
Miscellaneous unchecked malloc fixes. Also fixed some mem leaks on error paths as I spotted them along the way. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 918bb8652969fd53f0c390c1cd909265ed502c7e) Conflicts: crypto/bio/bss_dgram.c
2015-03-02Check public key is not NULL.Dr. Stephen Henson
CVE-2015-0288 PR#3708 Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 28a00bcd8e318da18031b2ac8778c64147cd54f9)
2015-03-02Fix format script.Dr. Stephen Henson
The format script didn't correctly recognise some ASN.1 macros and didn't reformat some files as a result. Fix script and reformat affected files. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 437b14b533fe7f7408e3ebca6d5569f1d3347b1a)
2015-02-26Fix evp_extra_test.c with no-ecMatt Caswell
When OpenSSL is configured with no-ec, then the new evp_extra_test fails to pass. This change adds appropriate OPENSSL_NO_EC guards around the code. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit a988036259a4e119f6787b4c585f506226330120)
2015-02-25Remove pointless free, and use preferred way of calling d2i_* functionsMatt Caswell
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2015-02-25Fix a failure to NULL a pointer freed on error.Matt Caswell
Inspired by BoringSSL commit 517073cd4b by Eric Roman <eroman@chromium.org> CVE-2015-0209 Reviewed-by: Emilia Käsper <emilia@openssl.org>
2015-02-25Import evp_test.c from BoringSSL. Unfortunately we already have a fileMatt Caswell
called evp_test.c, so I have called this one evp_extra_test.c Reviewed-by: Emilia Käsper <emilia@openssl.org> Conflicts: crypto/evp/Makefile test/Makefile
2015-02-24Fix crash in SPARC T4 XTS.Andy Polyakov
Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 775b669de3ba84d8dce16ff5e2bdffe263c05c4b)
2015-02-22sha/asm/sha1-586.pl: fix typo.Andy Polyakov
The typo doesn't affect supported configuration, only unsupported masm. Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 3372c4fffa0556a688f8f1f550b095051398f596)
2015-02-22Fix memory leakKurt Roeckx
Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit edac5dc220d494dff7ee259dfd84335ffa50e938)
2015-02-22Avoid a double-free in an error path.Doug Hogan
Signed-off-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 1549a265209d449b6aefd2b49d7d39f7fbe0689b)
2015-02-22Assume TERMIOS is default, remove TERMIO on all Linux.Richard Levitte
The rationale for this move is that TERMIOS is default, supported by POSIX-1.2001, and most definitely on Linux. For a few other systems, TERMIO may still be the termnial interface of preference, so we keep -DTERMIO on those in Configure. crypto/ui/ui_openssl.c is simplified in this regard, and will define TERMIOS for all systems except a select few exceptions. Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 64e6bf64b36136d487e2fbf907f09612e69ae911) Conflicts: Configure crypto/ui/ui_openssl.c
2015-02-12RT3684: rand_egd needs stddef.hRich Salz
Reviewed-by: Andy Polyakov <appro@openssl.org>
2015-02-12RT3670: Check return from BUF_MEM_grow_cleanGraeme Perrow
Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit b0333e697c008d639c56f48e9148cb8cba957e32)
2015-02-10Fix hostname validation in the command-line tool to honour negative return ↵Emilia Kasper
values. Specifically, an ASN.1 NumericString in the certificate CN will fail UTF-8 conversion and result in a negative return value, which the "x509 -checkhost" command-line option incorrectly interpreted as success. Also update X509_check_host docs to reflect reality. Thanks to Sean Burford (Google) for reporting this issue. Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 0923e7df9eafec6db9c75405d7085ec8581f01bd)
2015-02-10objects/obj_xref.h: revert reformat.Andy Polyakov
obj_xref.h was erroneously restored to pre-reformat state. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-02-09Bring objects.pl output even closer to new format.Andy Polyakov
Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 849037169d98d070c27d094ac341fc6aca1ed2ca)
2015-02-09Fix memory leak reporting.Dr. Stephen Henson
Free up bio_err after memory leak data has been printed to it. In int_free_ex_data if ex_data is NULL there is nothing to free up so return immediately and don't reallocate it. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 9c7a780bbebc1b6d87dc38a6aa3339033911a8bb)
2015-02-09Harmonize objects.pl output with new format.Andy Polyakov
Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 7ce38623194f6df6a846cd01753b63f361c88e57)
2015-02-05Fixed bad formatting in crypto/des/spr.hRich Salz
Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 7e35f06ea908e47f87b723b5e951ffc55463eb8b)
2015-02-04Make objxref.pl output in correct formatDr. Stephen Henson
Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 6922ddee1b7b1bddbe0d59a5bbdcf8ff39343434)
2015-02-03Check PKCS#8 pkey field is valid before cleansing.Dr. Stephen Henson
PR:3683 Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 52e028b9de371da62c1e51b46592517b1068d770)
2015-01-30modes/gcm128.c: fix OPENSSL_SMALL_FOOTPRINT compile failureAndy Polyakov
on affected platforms (PowerPC and AArch64). For reference, minimalistic #ifdef GHASH is sufficient, because it's never defined with OPENSSL_SMALL_FOOTPRINT and ctx->ghash is never referred. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit b2991c081aba5351a3386bdde2927672d53e5c99)
2015-01-30dso_vms needs to add the .EXE extension if there is none alreadyRichard Levitte
Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit be7b1097e28ff6d49f0d4b7ab8b036d6da87ebc6)
2015-01-26Remove obsolete support for old code.Rich Salz
Reviewed-by: Tim Hudson <tjh@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 3d0cf918078fecee8b040807a2603e41937092f6)