summaryrefslogtreecommitdiffstats
path: root/crypto
AgeCommit message (Collapse)Author
2016-01-28Prepare for 1.0.1r releaseOpenSSL_1_0_1rMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-01-04Fix X509_STORE_CTX_cleanup()Viktor Dukhovni
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
2015-12-22Fix memory leak in DSA redo case.David Benjamin
Found by clang scan-build. Signed-off-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Richard Levitte <levitte@openssl.org> RT: #4184, MR: #1496 (cherry picked from commit 679d87515d23ca31491effdc264edc81c695a72a)
2015-12-20Don't check RSA_FLAG_SIGN_VER.Dr. Stephen Henson
Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 6656ba7152dfe4bba865e327dd362ea08544aa80)
2015-12-19BIO_s_datagram() ctrl doesn't support SEEK/TELL, so don't pretend it doesRichard Levitte
Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 17592f323ac7dad381cc3b512573c291b1a820c0)
2015-12-19Correct or add comments indicating what controls belong to whatRichard Levitte
Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 6d97060ee00518efc99c5d89a78529dc111780fb)
2015-12-19Have BIO_get_conn_int_port use BIO_ctrl instead BIO_int_ctrlRichard Levitte
BIO_int_ctrl isn't made for the purpose BIO_get_conn_int_port used it for. This also changes BIO_C_GET_CONNECT to actually return the port instead of assigning it to a pointer that was never returned back to the caller. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 2a60fccdd9b696e01fddaa268e92ea210beb0e8f)
2015-12-19Fix URLs mangled by reformatMatt Caswell
Some URLs in the source code ended up getting mangled by indent. This fixes it. Based on a patch supplied by Arnaud Lacombe <al@aerilon.ca> Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-12-18Remove the "eay" c-file-style indicatorsRichard Levitte
Since we don't use the eay style any more, there's no point tryint to tell emacs to use it. Reviewed-by: Ben Laurie <ben@openssl.org>
2015-12-14Fix a ** 0 mod 1 = 0 for real this time.Emilia Kasper
Commit 2b0180c37fa6ffc48ee40caa831ca398b828e680 attempted to do this but only hit one of many BN_mod_exp codepaths. Fix remaining variants and add a test for each method. Thanks to Hanno Boeck for reporting this issue. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Dr. Stephen Henson <steve@openssl.org> (cherry picked from commit d911097d7c93e4cfeab624b34d73fe51da158b69) (cherry picked from commit 44e4f5b04b43054571e278381662cebd3f3555e6)
2015-12-08Cleanup the EVP_MD_CTX before exit rather than afterRichard Levitte
Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit c44844d928ad3c471c8dbe8baf2df8957900125b)
2015-12-03Prepare for 1.0.1r-devMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-12-03Prepare for 1.0.1q releaseOpenSSL_1_0_1qMatt Caswell
Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-12-03Add PSS parameter check.Dr. Stephen Henson
Avoid seg fault by checking mgf1 parameter is not NULL. This can be triggered during certificate verification so could be a DoS attack against a client or a server enabling client authentication. Thanks to Loïc Jonas Etienne (Qnective AG) for discovering this bug. CVE-2015-3194 Reviewed-by: Matt Caswell <matt@openssl.org>
2015-12-03Fix leak with ASN.1 combine.Dr. Stephen Henson
When parsing a combined structure pass a flag to the decode routine so on error a pointer to the parent structure is not zeroed as this will leak any additional components in the parent. This can leak memory in any application parsing PKCS#7 or CMS structures. CVE-2015-3195. Thanks to Adam Langley (Google/BoringSSL) for discovering this bug using libFuzzer. PR#4131 Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-11-24Use both sun and __sunKurt Roeckx
Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit ed02493567390cac6d07447f193fcaac5b219af3)
2015-11-24mark openssl configuration as loaded at end of OPENSSL_configMarcus Meissner
Signed-off-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Rich Salz <rsalz@akamai.com> GH: #466 (cherry picked from commit 434b58457c8cca4d09f77a1774d6d2c446604bae)
2015-11-24Fix uninitialised p error.Dr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 63eb10a07ee29a312e50a227f5b3a290b1ad22b4)
2015-11-24Limit depth of ASN1 parse printing.Dr. Stephen Henson
Thanks to Guido Vranken <guidovranken@gmail.com> for reporting this issue. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 158e5207a794603f5d64ffa95e0247c7808ab445) Conflicts: crypto/asn1/asn1_par.c
2015-11-22Use defined(__sun) instead of defined(sun)Kurt Roeckx
Strict ISO confirming C compilers only define __sun Reviewed-by: Viktor Dukhovni <openssl-users@dukhovni.org> RT #4144, MR #1353 (cherry picked from commit 3d32218812e87221344f2985512e42e4aaa88745)
2015-11-13RT32671: wrong multiple errs TS_check_status_infoGraeme Perrow
Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit f236ef27bd2ca99b3367554aa3e2fc9ca345deb5)
2015-11-09Fix missing malloc return value checksMatt Caswell
During work on a larger change in master a number of locations were identified where return value checks were missing. This backports the relevant fixes. Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 903738ac63e60c10552741e2d6de9753c67e0ff3) Conflicts: crypto/cms/cms_sd.c
2015-10-29BN_GF2m_mod_inv(): check bn_wexpand return valuePascal Cuoq
Signed-off-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Rich Salz <rsalz@akamai.com> MR #1276, RT #4107 (cherry picked from commit 94b3664a528258df5ebcaae213d19bf6568cc47d)
2015-10-23Remove useless codeAlessandro Ghedini
RT#4081 Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 070c23325af4526c9a8532a60d63522c58d5554b)
2015-10-23Check memory allocationAlessandro Ghedini
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 8cf9d71a3a43d9b98a8a278d47dc08088a954a7b)
2015-10-23Fix typosAlessandro Ghedini
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit d900a015b5a89ea2018e6122dd2738925e4d68ab)
2015-10-23Set salt length after the malloc has succeededAlessandro Ghedini
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit c2319cf9fce87a2e82efb6e58ced11a85190dc3d)
2015-10-23Fix memory leaks and other mistakes on errorsAlessandro Ghedini
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 3f6c7691870d1cd2ad0e0c83638cef3f35a0b548)
2015-10-23Replace malloc+strlcpy with strdupAlessandro Ghedini
Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 8acaabec429b39f9436f6a88006384d72d292539)
2015-10-11Typo.Dr. Stephen Henson
PR#4079 Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit c69ce9351336f5b4a8b33890756b3fd185528210) Conflicts: crypto/evp/e_des3.c
2015-10-09Avoid SHA1 weaknessRich Salz
In X509_cmp, if cert digest is equal, look at DER of the signed part. This is what master and 1.0.2 already do. Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
2015-10-08Don't treat a bare OCTETSTRING as DigestInfo in int_rsa_verifyMatt Caswell
The function int_rsa_verify is an internal function used for verifying an RSA signature. It takes an argument |dtype| which indicates the digest type that was used. Dependant on that digest type the processing of the signature data will vary. In particular if |dtype == NID_mdc2| and the signature data is a bare OCTETSTRING then it is treated differently to the default case where the signature data is treated as a DigestInfo (X509_SIG). Due to a missing "else" keyword the logic actually correctly processes the OCTETSTRING format signature first, and then attempts to continue and process it as DigestInfo. This will invariably fail because we already know that it is a bare OCTETSTRING. This failure doesn't actualy make a real difference because it ends up at the |err| label regardless and still returns a "success" result. This patch just cleans things up to make it look a bit more sane. RT#4076 Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit dffe51091f412dcbc18f6641132f0b4f0def6bce)
2015-10-08When ENGINE_add finds that id or name is missing, actually returnRichard Levitte
Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 5850cc75ea0c1581a9034390f1ca77cadc596238)
2015-10-07Move BN_CTX_start() call so the error case can always call BN_CTX_end().Pascal Cuoq
Signed-off-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Rich Salz <rsalz@openssl.org> MR #1231 (cherry picked from commit 99c203337574d967c86ffbfa13f40ace51048485)
2015-10-07Set flags to 0 before calling BN_with_flags()Pascal Cuoq
BN_with_flags() will read the dest->flags to keep the BN_FLG_MALLOCED but overwrites everything else. Signed-off-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Rich Salz <rsalz@openssl.org> MR #1231 (cherry picked from commit f92768e6f5259069bd21dbed2b98b3423c1dfca4)
2015-10-03Fix more d2i cases to properly update the input pointerKurt Roeckx
Thanks to David Benjamin <davidben@google.com> for pointing them out. Reviewed-by: Steve Henson <steve@openssl.org> MR #1198 (cherry picked from commit 605236f6a8fe0743af2f63d93239a74c69dae137)
2015-09-29GH367: use random data if seed too short.Ismo Puustinen
Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Emilia Käsper <emilia@openssl.org> (cherry picked from commit 6f997dc36504d67d1339ceb6bce4ecba673d8568)
2015-09-22BUF_strndup: tidyEmilia Kasper
Fix comment, add another overflow check, tidy style Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit de8883e11befde31d9b6cfbbd1fc017c365e0bbf) (cherry picked from commit f5afe9ce3f7ab8d2fef460054d1170427db0d02c)
2015-09-22Make BUF_strndup() read-safe on arbitrary inputsAlessandro Ghedini
BUF_strndup was calling strlen through BUF_strlcpy, and ended up reading past the input if the input was not a C string. Make it explicitly part of BUF_strndup's contract to never read more than |siz| input bytes. This augments the standard strndup contract to be safer. The commit also adds a check for siz overflow and some brief documentation for BUF_strndup(). Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 110f7b37de9feecfb64950601cc7cec77cf6130b) (cherry picked from commit f61216ba9d17430fb5eb3e2b202a209960b9d51b)
2015-09-21RT3479: Add UTF8 support to BIO_read_filename()David Woodhouse
If we use BIO_new_file(), on Windows it'll jump through hoops to work around their unusual charset/Unicode handling. it'll convert a UTF-8 filename to UCS-16LE and attempt to use _wfopen(). If you use BIO_read_filename(), it doesn't do this. Shouldn't it be consistent? It would certainly be nice if SSL_use_certificate_chain_file() worked. Also made BIO_C_SET_FILENAME work (rsalz) Signed-off-by: Rich Salz <rsalz@akamai.com> Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit ff03599a2f518dbdf13bca0bb0208e431b892fe9)
2015-09-21RT3823: Improve the robustness of event loggingGunnar Kudrjavets
There are a couple of minor fixes here: 1) Handle the case when RegisterEventSource() fails (which it may for various reasons) and do the work of logging the event only if it succeeds. 2) Handle the case when ReportEvent() fails and do our best in debug builds to at least attempt somehow indicate that something has gone wrong. The typical situation would be someone running tools like DbMon, DBWin32, DebugView or just having the debugger attached. The intent is to make sure that at least some data will be captured so that we can save hours and days of debugging time. 3) Minor fix to change the MessageBox() flag to MB_ICONERROR. Though the value of MB_ICONERROR is the same value as MB_ICONSTOP, the intent is better conveyed by using MB_ICONERROR. Testing performed: 1) Clean compilation for debug-VC-WIN32 and VC-WIN32. 2) Good test results (nmake -f ms\ntdll.mak test) for debug-VC-WIN32 and VC-WIN32. 3) Stepped through relevant changes using WinDBG and exercised the impacted code paths. Signed-off-by: Rich Salz <rsalz@akamai.com> Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 4cd94416a452c3a3e0df24c297f7d2f0e6d5bb5f)
2015-09-21Fix SRP memory leaksMatt Caswell
There were some memory leaks in the creation of an SRP verifier (both on successful completion and also on some error paths). Reviewed-by: Emilia Käsper <emilia@openssl.org> (cherry picked from commit bf95cde28712cfcad90cb3975cdcb8e5c0f20fde)
2015-09-19Fix indentationViktor Dukhovni
Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 4fe1cbdff89768c5d1983988ce1022674a438bbb)
2015-09-18This undoes GH367 for non-masterRich Salz
Was only approved for master, to avoid compatibility issues on previous releases. Reviewed-by: Emilia Käsper <emilia@openssl.org> (cherry picked from commit 6be18a22199de4d114b53686c31ba02723fc2c18)
2015-09-17Make sure OPENSSL_cleanse checks for NULLMatt Caswell
In master we have the function OPENSSL_clear_free(x,y), which immediately returns if x == NULL. In <=1.0.2 this function does not exist so we have to do: OPENSSL_cleanse(x, y); OPENSSL_free(x); However, previously, OPENSSL_cleanse did not check that if x == NULL, so the real equivalent check would have to be: if (x != NULL) OPENSSL_cleanse(x, y); OPENSSL_free(x); It would be easy to get this wrong during cherry-picking to other branches and therefore, for safety, it is best to just ensure OPENSSL_cleanse also checks for NULL. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 020d8fc83fe1a94232db1ee1166309e2458a8a18)
2015-09-17base64 decode: check for high bitEmilia Kasper
Previously, the conversion would silently coerce to ASCII. Now, we error out. Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit b785504a10310cb2872270eb409b70971be5e76e) (cherry picked from commit cb71f17dc786c72ec74c0ebb983b3ccfde484271)
2015-09-17RT3757: base64 encoding bugsEmilia Kasper
Rewrite EVP_DecodeUpdate. In particular: reject extra trailing padding, and padding in the middle of the content. Don't limit line length. Add tests. Previously, the behaviour was ill-defined, and depended on the position of the padding within the input. In addition, this appears to fix a possible two-byte oob read. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Dr Stephen Henson <steve@openssl.org> (cherry picked from commit 3cdd1e94b1d71f2ce3002738f9506da91fe2af45) (cherry picked from commit 37faf117965de181f4de0b4032eecac2566de5f6)
2015-09-15RT4044: Remove .cvsignore files.Rich Salz
Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 3be39dc1e3378d79531e385a72051c4dc5c6b34d)
2015-09-15d2i: don't update input pointer on failureKurt Roeckx
Reviewed-by: Dr. Stephen Henson <steve@openssl.org> MR #1005 (cherry picked from commit a46c9789ce2aecedceef119e9883513c7a49f1ca)
2015-09-10RT3754: check for NULL pointerEmilia Kasper
Fix both the caller to error out on malloc failure, as well as the eventual callee to handle a NULL gracefully. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>