summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2016-04-28Free memory on error in PKCS7_dataFinal()Matt Caswell
The PKCS7_dataFinal() function allocates a memory buffer but then fails to free it on an error condition. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-28Don't leak memory on error in PKCS12_key_gen_uniMatt Caswell
The PKCS12_key_gen_uni() had one error path which did not free memory correctly. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-28Don't leak memory on error in i2b_PVKMatt Caswell
The i2b_PVK function leaked a number of different memory allocations on error paths (and even some non-error paths). Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-28Don't leak memory on error in b2i_rsaMatt Caswell
The b2i_rsa() function uses a number of temporary local variables which get leaked on an error path. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-28Don't leak resource on error in OCSP_url_svcloc_newMatt Caswell
On error we could leak a ACCESS_DESCRIPTION and an ASN1_IA5STRING. Both should be freed in the error path. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-28Check that we were actually allocated BIGNUMs in dsa_builtin_paramgen2Matt Caswell
Calls to BN_CTX_get() can fail so we should check that they were successful. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-28Don't leak EVP_MD_CTX on error pathMatt Caswell
The cms_SignerInfo_content_sign() function allocated an EVP_MD_CTX but then failed to free it on an error path. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-28Don't leak memory on error in cms_RecipientInfo_pwri_cryptMatt Caswell
The cms_RecipientInfo_pwri_crypt() allocated an EVP_CIPHER_CTX but then failed to free it in some error paths. By allocating it a bit later that can be avoided. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-28Don't leak memory on error in BN_generate_prime_exMatt Caswell
In BN_generate_prime_ex() we do some sanity checks first and return with an error if they fail. We should do that *before* allocating any resources to avoid a memory leak. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-28Free a BIGNUM on error in BN_mpi2bnMatt Caswell
In the BN_mpi2bn() function, a failure of a call to BN_bin2bn() could result in the leak of a previously allocated BIGNUM value. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-28Don't leak memory on failure to create a mem BIOMatt Caswell
During construction of a mem BIO we allocate some resources. If this allocation fails we can end up leaking everything we have allocated so far. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-28Close the accept socket on errorMatt Caswell
When setting an accepted socket for non-blocking, if the operation fails make sure we close the accepted socket. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-28Make BIO_sock_error return a proper error code when getsockopt failsRichard Levitte
BIO_sock_error() returned 1 when getsockopt() fails when it should return the error code for that failure. Additionally, the optlen parameter to getsockopt() has to point at the size of the area that the optval parameter points at rather than zero. Some systems may forgive it being zero, but others don't. Reviewed-by: Matt Caswell <matt@openssl.org>
2016-04-28Reject inappropriate private key encryption ciphers.Dr. Stephen Henson
The traditional private key encryption algorithm doesn't function properly if the IV length of the cipher is zero. These ciphers (e.g. ECB mode) are not suitable for private key encryption anyway. Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-04-27Fix set0 reuse testViktor Dukhovni
We must test for new object == current object, not !=. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-27Future proof build_chain() in x509_vfy.cViktor Dukhovni
Coverity reports a potential NULL deref when "2 0 0" DANE trust-anchors from DNS are configured via SSL_dane_tlsa_add() and X509_STORE_CTX_init() is called with a NULL stack of untrusted certificates. Since ssl_verify_cert_chain() always provideds a non-NULL stack of untrusted certs, and no other code path enables DANE, the problem can only happen in applications that use SSL_CTX_set_cert_verify_callback() to implement their own wrappers around X509_verify_cert() passing only the leaf certificate to the latter. Regardless of the "improbability" of the problem, we do need to ensure that build_chain() handles this case correctly. Reviewed-by: Matt Caswell <matt@openssl.org>
2016-04-27Documentation the changed {RSA,DSA,DH}_set0_* functionality changeRichard Levitte
Reviewed-by: Matt Caswell <matt@openssl.org>
2016-04-27RSA, DSA, DH: Allow some given input to be NULL on already initialised keysRichard Levitte
The diverse {RSA,DSA,DH}_set0_* functions are made to allow some parameters to be NULL IF the corresponding numbers in the given key structure have already been previously initialised. Specifically, this allows the addition of private components to be added to a key that already has the public half, approximately like this: RSA_get0_key(rsa, NULL, &e, NULL); RSA_get0_factors(rsa, &p, &q); /* calculate new d */ RSA_set0_key(rsa, NULL, NULL, d); Reviewed-by: Matt Caswell <matt@openssl.org>
2016-04-27GH975 Add ex_data functions for X509_STOREKazuki Yamaguchi
Add X509_STORE_{set,get}_ex_data() function and X509_STORE_get_ex_new_index() macro. X509_STORE has ex_data and the documentation also mentions them but they are not actually implemented. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-27Fix no-gost no-srp no-ec no-dh.Ben Laurie
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-27Fix enable-ssl-trace no-nextprotoneg.Ben Laurie
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-27Fix no-engine no-ui.Ben Laurie
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-27split_send_fragment should always be less than or equal to max_send_fragmentMatt Caswell
A bug meant that SSL_CTRL_SET_MAX_SEND_FRAGMENT was not adjusting split_send_fragment properly. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-27Fix BIO_CTRL_DUP for an SSL BIOMatt Caswell
The variables in the BIO weren't being duplicated properly. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-04-27Fix passwd seg faultMatt Caswell
Passing the -stdin arg to the passwd command line app *and* supply a password on the command line causes a seg fault. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-26SPARCv9 assembly pack: fine-tune run-time switch.Andy Polyakov
Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-04-26camellia/build.info: fix typoAndy Polyakov
RT#4520 Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-04-26Remove dead-code infinite loopBenjamin Kaduk
Commit d32f5d8733df9938727710d4194e92813c421ef1 added a 'goto end;' statement at the end of the code block for the 'end' label. Fortunately, it was after a return statement, so no infinite loop occurred, but it is still dead code. Remove the extra goto statement as cleanup. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-26Add ex_data functions for X509_STOREKazuki Yamaguchi
Add X509_STORE_{set,get}_ex_data() function and X509_STORE_get_ex_new_index() macro. X509_STORE has ex_data and the documentation also mentions them but they are not actually implemented. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
2016-04-26Ensure we check i2d_X509 return valMatt Caswell
The i2d_X509() function can return a negative value on error. Therefore we should make sure we check it. Issue reported by Yuan Jochen Kang. Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-04-26*.der files are binary.Dr. Stephen Henson
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-26Remove the never-functional no-sctBenjamin Kaduk
It was added as part of 2df84dd3299ff25fa078ca7ffbdeaac65b361feb but has never actually been used for anything; presumably it was a typo for one of SCTP or CT. This removes the last '??' entry from INSTALL. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-04-26Remove some OPENSSL_NO_SHA that snuck inBenjamin Kaduk
Commit d064e6ab52ac8e7b80b2a5d11b31bca583b769c7 removed all the OPENSSL_NO_SHA guards, but commit a50ad1daaa68c109ea1a14225a7aba8660526101 regenerated some due to the sha entries in the %md_disabler table in apps/progs.pl. Update %md_disabler to reflect that sha is not disableable, and remove OPENSSL_NO_SHA for good. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-04-25crypto/poly1305/asm: chase overflow bit on x86 and ARM platforms.Andy Polyakov
Even though no test could be found to trigger this, paper-n-pencil estimate suggests that x86 and ARM inner loop lazy reductions can loose a bit in H4>>*5+H0 step. Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-04-25make updateViktor Dukhovni
And recycle some disused slots. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-04-25Added missing X509_STORE_CTX_set_error_depth() accessorViktor Dukhovni
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-04-25Document the enhancements for DEPEND and INCLUDE and use a better exampleRichard Levitte
Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-04-25Build system: add include directories and dependencies for generatorsRichard Levitte
In the case of generating a file like this: GENERATE[foo.S]=mkfoo.pl arg1 arg2 the 'mkfoo.pl' generator itself might need to include other files, such as perl modules within our source tree. We can reuse already existing syntax for it, like this: INCLUDE[mkfoo.pl]=module/path or: DEPEND[mkfoo.pl]=modules/mymodule.pm This change implements the support for such constructs, and for the DEPEND statement, for any value that indicates a perl module (.pm file), it will automatically infer an INCLUDE statement for its directory, just like it does for C header files, so you won't have do write this: DEPEND[mkfoo.pl]=modules/mymodule.pm INCLUDE[mkfoo.pl]=modules Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-04-25Fix NULL deref in apps/pkcs7Rich Salz
Thanks to Brian Carpenter for finding and reporting this. Reviewed-by: Emilia Käsper <emilia@openssl.org>
2016-04-25API compat macros for renamed X509_STORE_CTX functionsViktor Dukhovni
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-04-25s390x assembly pack: cache capability query results.Andy Polyakov
IBM argues that in certain scenarios capability query is really expensive. At the same time it's asserted that query results can be safely cached, because disabling CPACF is incompatible with reboot-free operation. Reviewed-by: Tim Hudson <tjh@openssl.org>
2016-04-25crypto/sparc_arch.h: reserve more SPARCv9 capability bits.Andy Polyakov
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-25chacha/asm/chacha-ppc.pl: get misalignment corner case right on big-endian.Andy Polyakov
Reviewed-by: Richard Levitte <levitte@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-23add test for CVE-2016-2109Dr. Stephen Henson
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-23In d2i_test return error for malloc failure.Dr. Stephen Henson
Bad ASN.1 data should never be able to trigger a malloc failure so return an error in d2i_test if a malloc failure occurs. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-04-23Harden ASN.1 BIO handling of large amounts of data.Dr. Stephen Henson
If the ASN.1 BIO is presented with a large length field read it in chunks of increasing size checking for EOF on each read. This prevents small files allocating excessive amounts of data. CVE-2016-2109 Thanks to Brian Carpenter for reporting this issue. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
2016-04-22Warn when doing an out-of-source build and finding in-source build artifactsRichard Levitte
The reason to warn is that configuration *may* pick up on configuration header files that are in the source tree, that might be for a wildly different configuration than what is expected in the current out-of-source configuration. Reviewed-by: Matt Caswell <matt@openssl.org>
2016-04-22make updateViktor Dukhovni
Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-04-22Enabled DANE only when at least one TLSA RR was addedViktor Dukhovni
It is up to the caller of SSL_dane_tlsa_add() to take appropriate action when no records are added successfully or adding some records triggers an internal error (negative return value). With this change the caller can continue with PKIX if desired when none of the TLSA records are usable, or take some appropriate action if DANE is required. Also fixed the internal ssl_dane_dup() function to properly initialize the TLSA RR stack in the target SSL handle. Errors in ssl_dane_dup() are no longer ignored. Reviewed-by: Rich Salz <rsalz@openssl.org>