summaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)Author
2015-06-04Clean premaster_secret for GOSTMatt Caswell
Ensure OPENSSL_cleanse() is called on the premaster secret value calculated for GOST. With thanks to the Open Crypto Audit Project for reporting this issue. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit b7ee4815f2452c854cc859e8dda88f2673cdddea) Conflicts: ssl/s3_srvr.c
2015-06-04Clean Kerberos pre-master secretMatt Caswell
Ensure the Kerberos pre-master secret has OPENSSL_cleanse called on it. With thanks to the Open Crypto Audit Project for reporting this issue. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-06-04Fix off-by-one error in BN_bn2hexMatt Caswell
A BIGNUM can have the value of -0. The function BN_bn2hex fails to account for this and can allocate a buffer one byte too short in the event of -0 being used, leading to a one byte buffer overrun. All usage within the OpenSSL library is considered safe. Any security risk is considered negligible. With thanks to Mateusz Kocielski (LogicalTrust), Marek Kroemeke and Filip Palian for discovering and reporting this issue. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit c56353071d9849220714d8a556806703771b9269) Conflicts: crypto/bn/bn_print.c
2015-06-04Fix DTLS session resumptionMatt Caswell
The session object on the client side is initially created during construction of the ClientHello. If the client is DTLS1.2 capable then it will store 1.2 as the version for the session. However if the server is only DTLS1.0 capable then when the ServerHello comes back the client switches to using DTLS1.0 from then on. However the session version does not get updated. Therefore when the client attempts to resume that session the server throws an alert because of an incorrect protocol version. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 7322abf5cefdeb47c7d61f3b916c428bf2cd69b6) Conflicts: ssl/s3_clnt.c
2015-06-03make updateDr. Stephen Henson
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-06-03Add funtions to set item_sign and item_verifySergey Agievich
PR#3872 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Stephen Henson <steve@openssl.org>
2015-06-02Fix compilation failure for some tool chainsMatt Caswell
Some tool chains (e.g. android) do not define IP_PMTUDISC_PROBE, and so this build breaks. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 133dce447b259e0bb93076bf5fd0ce475d16910a)
2015-06-02RT3230: Better test for C identifierAnnie Yousar
objects.pl only looked for a space to see if the name could be used as a C identifier. Improve the test to match the real C rules. Signed-off-by: Rich Salz <rsalz@akamai.com> Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 591b7aef05b22cba09b179e5787a9bf40dfc9508)
2015-06-02Add the macro OPENSSL_SYS_WIN64Richard Levitte
This is for consistency. Additionally, have its presence define OPENSSL_SYS_WINDOWS as well. Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 3f131556d6678bc3754f1e6d98a9a5bfc24e368c) Conflicts: e_os2.h
2015-06-02GH249: Fix bad regexp in arg parsing.Olaf Johansson
Signed-off-by: Rich Salz <rsalz@akamai.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 8846adbd36c1de2b0d38a73ca32e28fde50083b8)
2015-06-02Fix IP_MTU_DISCOVER typoPer Allansson
The code in bss_dgram.c checks if IP_MTUDISCOVER is defined, where it should test for IP_MTU_DISCOVER RT#3888 Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 0baaff1a76d4c91b9c1121059be63175454d7b03)
2015-06-02Fix race condition in NewSessionTicketMatt Caswell
If a NewSessionTicket is received by a multi-threaded client when attempting to reuse a previous ticket then a race condition can occur potentially leading to a double free of the ticket data. CVE-2015-1791 This also fixes RT#3808 where a session ID is changed for a session already in the client session cache. Since the session ID is the key to the cache this breaks the cache access. Parts of this patch were inspired by this Akamai change: https://github.com/akamai/openssl/commit/c0bf69a791239ceec64509f9f19fcafb2461b0d3 Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-06-01Check the message type requested is the type received in DTLSMatt Caswell
dtls1_get_message has an |mt| variable which is the type of the message that is being requested. If it is negative then any message type is allowed. However the value of |mt| is not checked in one of the main code paths, so a peer can send a message of a completely different type and it will be processed as if it was the message type that we were expecting. This has very little practical consequences because the current behaviour will still fail when the format of the message isn't as expected. Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 8c2b1d872b25f3ec78e04f5cd2de8f21e853c4a6)
2015-05-28check for error when creating PKCS#8 structureDr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 2849707fa65d2803e6d1c1603fdd3fd1fdc4c6cc)
2015-05-28PEM doc fixesDr. Stephen Henson
Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit f097f81c891bb1f479426d8ac9c9541390334983)
2015-05-26Fix ssltest to use 1024-bit DHE parametersEmilia Kasper
Also add more ciphersuite test coverage, and a negative test for 512-bit DHE. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 1ee85aab75d7c9f20058f781bfe9222323df08eb)
2015-05-26Don't check for a negative SRP extension sizeMatt Caswell
The size of the SRP extension can never be negative (the variable |size| is unsigned). Therefore don't check if it is less than zero. RT#3862 Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 9c89d290834f3ed9146eeb8b64fe5de817679a0b)
2015-05-26Fix error check in GOST engineMatt Caswell
The return value of i2d functions can be negative if an error occurs. Therefore don't assign the return value to an unsigned type and *then* check if it is negative. RT#3862 Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 90e7cdff3aa66779486914f88333f6601f0c1cf4)
2015-05-26Handle unsigned struct timeval membersMatt Caswell
The members of struct timeval on OpenVMS are unsigned. The logic for calculating timeouts needs adjusting to deal with this. RT#3862 Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit fc52ac9028b9492fb086ba35a3352ea46e03ecfc)
2015-05-26Housekeeping 'make TABLE' update.Andy Polyakov
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-05-26Configure: replace -mv8 with -mcpu=v8 in SPARC config lines.Andy Polyakov
RT#3860 Reviewed-by: Matt Caswell <matt@openssl.org>
2015-05-26fix copy paste error in ec_GF2m function prototypesBilly Brumley
RT#3858 Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 71f6130b7a96bacbffae4611796ed98c2f724d96)
2015-05-26bn/bn_lcl.h: fix MIPS-specific gcc version check.Andy Polyakov
RT#3859 Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 60c268b21ac81cc6b1af5c5470282a613b96f6fd)
2015-05-25Don't send an alert if we've just received oneMatt Caswell
If the record received is for a version that we don't support, previously we were sending an alert back. However if the incoming record already looks like an alert then probably we shouldn't do that. So suppress an outgoing alert if it looks like we've got one incoming. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-05-24bn/asm/x86_64-mont5.pl: fix valgrind error.Andy Polyakov
bn_get_bits5 was overstepping array boundary by 1 byte. It was exclusively read overstep and data could not have been used. The only potential problem would be if array happens to end on the very edge of last accesible page. Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 69567687b0b7ed67831c17a010f4d46dfd059aef)
2015-05-24bn/bn_gf2m.c: appease STACK, unstable code detector.Andy Polyakov
RT#3852 Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 86e5d1e32b2d702a5fc777e612cd746e790098ef)
2015-05-24bn/asm/vis3-mont.pl: fix intermittent EC failures on SPARC T3.Andy Polyakov
BLKINIT optimization worked on T4, but for some reason appears "too aggressive" for T3 triggering intermiitent EC failures. It's not clear why only EC is affected... Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 579734ced696125c0768a2f4e56e97939b0e6e49)
2015-05-23Fix update and depend in engines/Richard Levitte
The update: target in engines/ didn't recurse into engines/ccgost. The update: and depend: targets in engines/ccgost needed a fixup. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 8b822d2566853ee5e313c37529f71336209b28ab)
2015-05-23Missed a couple of spots in the update changeRichard Levitte
Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 6f45032f6730622e8d484d92e07c7fce7d1f88ac) Conflicts: apps/Makefile
2015-05-23Fix the update target and remove duplicate file updatesRichard Levitte
We had updates of certain header files in both Makefile.org and the Makefile in the directory the header file lived in. This is error prone and also sometimes generates slightly different results (usually just a comment that differs) depending on which way the update was done. This removes the file update targets from the top level Makefile, adds an update: target in all Makefiles and has it depend on the depend: or local_depend: targets, whichever is appropriate, so we don't get a double run through the whole file tree. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 0f539dc1a2f45580435c39dada44dd276e79cb88) Conflicts: Makefile.org apps/Makefile test/Makefile
2015-05-23Fix typo setting up certificate masksMatt Caswell
The certificate masks are used to select which ciphersuite we are going to use. The variables |emask_k| and |emask_a| relate to export grade key exchange and authentication respecitively. The variables |mask_k| and |mask_a| are the equivalent versions for non-export grade. This fixes an instance where the two usages of export/non-export were mixed up. In practice it makes little difference since it still works! Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit fdfe8b06ae97da3bc3a77aa3db00f8e0445f3c70)
2015-05-23Remove export static DH ciphersuitesMatt Caswell
Remove support for the two export grade static DH ciphersuites. These two ciphersuites were newly added (along with a number of other static DH ciphersuites) to 1.0.2. However the two export ones have *never* worked since they were introduced. It seems strange in any case to be adding new export ciphersuites, and given "logjam" it also does not seem correct to fix them. Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 13f8eb4730b9fc039e743870f81e5ff54b3d05b8) Conflicts: CHANGES
2015-05-22Fix off-by-one in BN_randMatt Caswell
If BN_rand is called with |bits| set to 1 and |top| set to 1 then a 1 byte buffer overflow can occur. There are no such instances within the OpenSSL at the moment. Thanks to Mateusz Kocielski (LogicalTrust), Marek Kroemeke, Filip Palian for discovering and reporting this issue. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-05-22Reject negative shifts for BN_rshift and BN_lshiftMatt Caswell
The functions BN_rshift and BN_lshift shift their arguments to the right or left by a specified number of bits. Unpredicatable results (including crashes) can occur if a negative number is supplied for the shift value. Thanks to Mateusz Kocielski (LogicalTrust), Marek Kroemeke and Filip Palian for discovering and reporting this issue. Reviewed-by: Kurt Roeckx <kurt@openssl.org> (cherry picked from commit 7cc18d8158b5fc2676393d99b51c30c135502107) Conflicts: crypto/bn/bn.h crypto/bn/bn_err.c
2015-05-22Lost alert in DTLSLubom
If a client receives a bad hello request in DTLS then the alert is not sent correctly. RT#2801 Signed-off-by: Matt Caswell <matt@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org> (cherry picked from commit 4dc1aa0436fdb8af50960db676b739c8ef81f38c)
2015-05-20Correctly check for export size limitKurt Roeckx
40 bit ciphers are limited to 512 bit RSA, 56 bit ciphers to 1024 bit. Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit ac38115c1a4fb61c66c2a8cd2a9800751828d328)
2015-05-20Only support >= 256-bit elliptic curves with ecdh_auto (server) or by ↵Emilia Kasper
default (client). Also reorder preferences to prefer prime curves to binary curves, and P-256 to everything else. The result: $ openssl s_server -named_curves "auto" This command will negotiate an ECDHE ciphersuite with P-256: $ openssl s_client This command will negotiate P-384: $ openssl s_client -curves "P-384" This command will not negotiate ECDHE because P-224 is disabled with "auto": $ openssl s_client -curves "P-224" Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-05-20client: reject handshakes with DH parameters < 768 bits.Emilia Kasper
Since the client has no way of communicating her supported parameter range to the server, connections to servers that choose weak DH will simply fail. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
2015-05-20Update documentation with Diffie-Hellman best practices.Emilia Kasper
- Do not advise generation of DH parameters with dsaparam to save computation time. - Promote use of custom parameters more, and explicitly forbid use of built-in parameters weaker than 2048 bits. - Advise the callback to ignore <keylength> - it is currently called with 1024 bits, but this value can and should be safely ignored by servers. Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-05-20dhparam: fix documentationEmilia Kasper
The default bitlength is now 2048. Also clarify that either the number of bits or the generator must be present: $ openssl dhparam -2 and $ openssl dhparam 2048 generate parameters but $ openssl dhparam does not. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-05-20s_server: Use 2048-bit DH parameters by default.Emilia Kasper
Reviewed-by: Rich Salz <rsalz@openssl.org>
2015-05-20GitHub284: Fix typo in xx-32.pl scripts.StudioEtrange
Reviewed-by: Richard Levitte <levitte@openssl.org> Signed-off-by: Rich Salz <rsalz@openssl.org>
2015-05-19Don't add write errors into bytecountsRobert Swiecki
Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 00d565cfbe90fab3b157e644caca4eb4a2ebec79)
2015-05-15mk1mf.pl: replace chop for windows.Andy Polyakov
Backport old patch to make it work in mixture of perls for Windows. Reviewed-by: Richard Levitte <levitte@openssl.org> Cherry-picked from 7bb98eee3c9e4694dfc2217001d5075ce8d2906e
2015-05-13RT1207: document SSL_COMP_free_compression_methods.Rich Salz
Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit c490a5512e988559a830c15b8efb1d0376f2e282)
2015-05-13Add NULL checks from masterRich Salz
The big "don't check for NULL" cleanup requires backporting some of the lowest-level functions to actually do nothing if NULL is given. This will make it easier to backport fixes to release branches, where master assumes those lower-level functions are "safe" This commit addresses those tickets: 3798 3799 3801. Reviewed-by: Matt Caswell <matt@openssl.org>
2015-05-13aes/asm/aesni-sha256-x86_64.pl: fix Windows compilation failure with old ↵Andy Polyakov
assembler. Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 82c4a079395223c0063100854a0981976db9848f)
2015-05-13Call of memcmp with null pointers in obj_cmp()Hanno Böck
The function obj_cmp() (file crypto/objects/obj_dat.c) can in some situations call memcmp() with a null pointer and a zero length. This is invalid behaviour. When compiling openssl with undefined behaviour sanitizer (add -fsanitize=undefined to compile flags) this can be seen. One example that triggers this behaviour is the pkcs7 command (but there are others, e.g. I've seen it with the timestamp function): apps/openssl pkcs7 -in test/testp7.pem What happens is that obj_cmp takes objects of the type ASN1_OBJECT and passes their ->data pointer to memcmp. Zero-sized ASN1_OBJECT structures can have a null pointer as data. RT#3816 Signed-off-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 2b8dc08b74fc3c6d4c2fc855cc23bac691d985be)
2015-05-13Don't allow a CCS when expecting a CertificateVerifyMatt Caswell
Currently we set change_cipher_spec_ok to 1 before calling ssl3_get_cert_verify(). This is because this message is optional and if it is not sent then the next thing we would expect to get is the CCS. However, although it is optional, we do actually know whether we should be receiving one in advance. If we have received a client cert then we should expect a CertificateVerify message. By the time we get to this point we will already have bombed out if we didn't get a Certificate when we should have done, so it is safe just to check whether |peer| is NULL or not. If it is we won't get a CertificateVerify, otherwise we will. Therefore we should change the logic so that we only attempt to get the CertificateVerify if we are expecting one, and not allow a CCS in this scenario. Whilst this is good practice for TLS it is even more important for DTLS. In DTLS messages can be lost. Therefore we may be in a situation where a CertificateVerify message does not arrive even though one was sent. In that case the next message the server will receive will be the CCS. This could also happen if messages get re-ordered in-flight. In DTLS if |change_cipher_spec_ok| is not set and a CCS is received it is ignored. However if |change_cipher_spec_ok| *is* set then a CCS arrival will immediately move the server into the next epoch. Any messages arriving for the previous epoch will be ignored. This means that, in this scenario, the handshake can never complete. The client will attempt to retransmit missing messages, but the server will ignore them because they are the wrong epoch. The server meanwhile will still be waiting for the CertificateVerify which is never going to arrive. RT#2958 Reviewed-by: Emilia Käsper <emilia@openssl.org> (cherry picked from commit a0bd6493369d960abef11c2346b9bbb308b4285a)
2015-05-11Add missing NULL check in X509V3_parse_list()Kurt Cancemi
Matt's note: I added a call to X509V3err to Kurt's original patch. RT#3840 Signed-off-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 344c271eb339fc2982e9a3584a94e51112d84584)