summaryrefslogtreecommitdiffstats
path: root/crypto/bio
AgeCommit message (Collapse)Author
2016-08-19Fix NULL-return checks in 1.0.2Rich Salz
RT4386: Add sanity checks for BN_new() RT4384: Missing Sanity Checks for RSA_new_method() RT4384: Missing Sanity Check plus potential NULL pointer deref RT4382: Missing Sanity Check(s) for BUF_strdup() RT4380: Missing Sanity Checks for EVP_PKEY_new() RT4377: Prevent potential NULL pointer dereference RT4375: Missing sanity checks for OPENSSL_malloc() RT4374: Potential for NULL pointer dereferences RT4371: Missing Sanity Check for malloc() RT4370: Potential for NULL pointer dereferences Also expand tabs, make update, typo fix (rsalz) Minor tweak by Paul Dale. Some minor internal review feedback. Reviewed-by: Richard Levitte <levitte@openssl.org>
2016-06-27Change usage of RAND_pseudo_bytes to RAND_bytesMatt Caswell
RAND_pseudo_bytes() allows random data to be returned even in low entropy conditions. Sometimes this is ok. Many times it is not. For the avoidance of any doubt, replace existing usage of RAND_pseudo_bytes() with RAND_bytes(). Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-06-20RT3925: Remove trailing semi from #define's.Dr. Matthias St. Pierre
Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-06-03BIO_printf() can fail to print the last characterMatt Caswell
If the string to print is exactly 2048 character long (excluding the NULL terminator) then BIO_printf will chop off the last byte. This is because it has filled its static buffer but hasn't yet allocated a dynamic buffer. In cases where we don't have a dynamic buffer we need to truncate but that is not the case for BIO_printf(). We need to check whether we are able to have a dynamic buffer buffer deciding to truncate. Reviewed-by: Rich Salz <rsalz@openssl.org>
2016-05-31Fix some missing initsFdaSilvaYY
Backport of 8e89e85f556f549f05d3b49f5408a217ac5e3700 From PR #1019 / #997 Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1019)
2016-05-09Fix BIO_eof() for BIO pairsMatt Caswell
BIO_eof() was always returning true when using a BIO pair. It should only be true if the peer BIO is empty and has been shutdown. RT#1215 Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 3105d695358d86c0f2a404b2b74a1870b941ce5e)
2016-02-25Fix memory issues in BIO_*printf functionsMatt Caswell
The internal |fmtstr| function used in processing a "%s" format string in the BIO_*printf functions could overflow while calculating the length of a string and cause an OOB read when printing very long strings. Additionally the internal |doapr_outch| function can attempt to write to an OOB memory location (at an offset from the NULL pointer) in the event of a memory allocation failure. In 1.0.2 and below this could be caused where the size of a buffer to be allocated is greater than INT_MAX. E.g. this could be in processing a very long "%s" format string. Memory leaks can also occur. These issues will only occur on certain platforms where sizeof(size_t) > sizeof(int). E.g. many 64 bit systems. The first issue may mask the second issue dependent on compiler behaviour. These problems could enable attacks where large amounts of untrusted data is passed to the BIO_*printf functions. If applications use these functions in this way then they could be vulnerable. OpenSSL itself uses these functions when printing out human-readable dumps of ASN.1 data. Therefore applications that print this data could be vulnerable if the data is from untrusted sources. OpenSSL command line applications could also be vulnerable where they print out ASN.1 data, or if untrusted data is passed as command line arguments. Libssl is not considered directly vulnerable. Additionally certificates etc received via remote connections via libssl are also unlikely to be able to trigger these issues because of message size limits enforced within libssl. CVE-2016-0799 Issue reported by Guido Vranken. Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-01RT4129: BUF_new_mem_buf should take const void *Daniel Kahn Gillmor
Signed-off-by: Rich Salz <rsalz@akamai.com> Reviewed-by: Dr. Stephen Henson <steve@openssl.org> (cherry picked from commit 8ab31975bacb9c907261088937d3aa4102e3af84)
2016-01-28Correct number of arguments in BIO_get_conn_int_port macroRichard Levitte
Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 41a28cb2944a4e1c9d13889757a3bd9f72abeca1)
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>
2015-12-19Correct or add comments indicating what controls belong to whatRichard Levitte
Reviewed-by: Rich Salz <rsalz@openssl.org>
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>
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-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-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-15RT4044: Remove .cvsignore files.Rich Salz
Reviewed-by: Matt Caswell <matt@openssl.org>
2015-06-16Remove one extraneous parenthesisRichard Levitte
Reviewed-by: Kurt Roeckx <kurt@openssl.org> (cherry picked from commit 30cf91784bfde82622f79d87d17d20ce73329532)
2015-06-10Fix memory leaks in BIO_dup_chain()Matt Caswell
This fixes a memory leak that can occur whilst duplicating a BIO chain if the call to CRYPTO_dup_ex_data() fails. It also fixes a second memory leak where if a failure occurs after successfully creating the first BIO in the chain, then the beginning of the new chain was not freed. With thanks to the Open Crypto Audit Project for reporting this issue. Reviewed-by: Stephen Henson <steve@openssl.org> Conflicts: crypto/bio/bio_lib.c
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-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-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-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-04-30Clarify logic in BIO_*printf functionsMatt Caswell
The static function dynamically allocates an output buffer if the output grows larger than the static buffer that is normally used. The original logic implied that |currlen| could be greater than |maxlen| which is incorrect (and if so would cause a buffer overrun). Also the original logic would call OPENSSL_malloc to create a dynamic buffer equal to the size of the static buffer, and then immediately call OPENSSL_realloc to make it bigger, rather than just creating a buffer than was big enough in the first place. Thanks to Kevin Wojtysiak (Int3 Solutions) and Paramjot Oberoi (Int3 Solutions) for reporting this issue. Reviewed-by: Andy Polyakov <appro@openssl.org> (cherry picked from commit 9d9e37744cd5119f9921315864d1cd28717173cd)
2015-04-16Code style: space after 'if'Viktor Dukhovni
Reviewed-by: Matt Caswell <gitlab@openssl.org>
2015-03-25Fix RAND_(pseudo_)?_bytes returnsMatt Caswell
Ensure all calls to RAND_bytes and RAND_pseudo_bytes have their return value checked correctly Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-03-24Fix malloc define typoMike Frysinger
Fix compilation failure when SCTP is compiled due to incorrect define. Reported-by: Conrad Kostecki <ck+gentoobugzilla@bl4ckb0x.de> URL: https://bugs.gentoo.org/543828 RT#3758 Signed-off-by: Matt Caswell <matt@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 7c82e339a677f8546e1456c7a8f6788598a9de43)
2015-03-19make updateMatt Caswell
Reviewed-by: Richard Levitte <levitte@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-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-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-01-22Fix post-reformat errors preventing windows compilationMatt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22Re-align some comments after running the reformat script.OpenSSL_1_0_2-post-reformatMatt Caswell
This should be a one off operation (subsequent invokation of the script should not move them) This commit is for the 1.0.2 changes Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22Rerun util/openssl-format-source -v -c .OpenSSL_1_0_2-post-auto-reformatMatt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22Run util/openssl-format-source -v -c .Matt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22Move more comments that confuse indentMatt Caswell
Conflicts: crypto/dsa/dsa.h demos/engines/ibmca/hw_ibmca.c ssl/ssl_locl.h Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22indent has problems with comments that are on the right hand side of a line.Matt Caswell
Sometimes it fails to format them very well, and sometimes it corrupts them! This commit moves some particularly problematic ones. Conflicts: crypto/bn/bn.h crypto/ec/ec_lcl.h crypto/rsa/rsa.h demos/engines/ibmca/hw_ibmca.c ssl/ssl.h ssl/ssl3.h Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22Additional comment changes for reformat of 1.0.2Matt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22Further comment amendments to preserve formatting prior to source reformatMatt Caswell
(cherry picked from commit 4a7fa26ffd65bf36beb8d1cb8f29fc0ae203f5c5) Conflicts: crypto/x509v3/pcy_tree.c Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-22mark all block comments that need format preserving so thatTim Hudson
indent will not alter them when reformatting comments (cherry picked from commit 1d97c8435171a7af575f73c526d79e1ef0ee5960) Conflicts: crypto/bn/bn_lcl.h crypto/bn/bn_prime.c crypto/engine/eng_all.c crypto/rc4/rc4_utl.c crypto/sha/sha.h ssl/kssl.c ssl/t1_lib.c Reviewed-by: Tim Hudson <tjh@openssl.org>
2015-01-06Fix memory leak.Martin Brejcha
Fix memory leak by freeing up saved_message.data if it is not NULL. PR#3489 Reviewed-by: Stephen Henson <steve@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 41cd41c4416f545a18ead37e09e437c75fa07c95)
2014-12-20Fix incorrect OPENSSL_assert() usage.Michael Tuexen
Return an error code for I/O errors instead of an assertion failure. PR#3470 Reviewed-by: Stephen Henson <steve@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 2521fcd8527008ceb3e4748f95b0ed4e2d70cfef)
2014-12-03There are a number of instances throughout the code where the constant 28 isMatt Caswell
used with no explanation. Some of this was introduced as part of RT#1929. The value 28 is the length of the IP header (20 bytes) plus the UDP header (8 bytes). However use of this constant is incorrect because there may be instances where a different value is needed, e.g. an IPv4 header is 20 bytes but an IPv6 header is 40. Similarly you may not be using UDP (e.g. SCTP). This commit introduces a new BIO_CTRL that provides the value to be used for this mtu "overhead". It will be used by subsequent commits. Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 0d3ae34df573f477b6b1aaf614d52dcdfcff5fce)
2014-11-17Don't use msg on error.Jan Hykel
Don't attempt to access msg structure if recvmsg returns an error. PR#3483 Reviewed-by: Stephen Henson <steve@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org> (cherry picked from commit 012aa9ec76b158179b4de44bb5de8b8472045eac)
2014-07-09Fix memory leak in BIO_free if there is no destroy function.Matt Caswell
Based on an original patch by Neitrino Photonov <neitrinoph@gmail.com> PR#3439 (cherry picked from commit 66816c53bea0ecddb9448da7ea9a51a334496127)
2014-05-12Set authkey to NULL and check malloc return value.Kurt Roeckx
2014-05-12dgram_sctp_ctrl: authkey memory leakMartin Brejcha
PR: 3327
2014-03-06bss_dgram.c,d1_lib.c: make it compile with mingw.Andy Polyakov
Submitted by: Roumen Petrov (cherry picked from commit 972b0dc3500a26edb178a5446a0cdfb8f450f853)
2014-02-25Avoid Windows 8 Getversion deprecated errors.Dr. Stephen Henson
Windows 8 SDKs complain that GetVersion() is deprecated. We only use GetVersion like this: (GetVersion() < 0x80000000) which checks if the Windows version is NT based. Use a macro check_winnt() which uses GetVersion() on older SDK versions and true otherwise. (cherry picked from commit a4cc3c8041104896d51ae12ef7b678c31808ce52)
2014-02-20Show the contents of the RFC6962 Signed Certificate Timestamp List ↵Rob Stradling
Certificate/OCSP Extensions. Add the RFC6962 OIDs to the objects table. (backport from master branch)
2014-02-01Improve WINCE support.Andy Polyakov
Submitted by: Pierre Delaage (cherry picked from commit a006fef78e56b078549a80f4bb4518b6a02eba84) Resolved conflicts: crypto/bio/bss_dgram.c ssl/d1_lib.c util/pl/VC-32.pl