aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/bio
Commit message (Collapse)AuthorAgeFilesLines
* RT4660: BIO_METHODs should be const.David Benjamin2016-03-2115-37/+37
| | | | | | | BIO_new, etc., don't need a non-const BIO_METHOD. This allows all the built-in method tables to live in .rodata. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove the remainder of util/mk1mf.pl and companion scriptsRichard Levitte2016-03-211-3/+0
| | | | | | | This removes all scripts that deal with MINFO as well, since that's only used by mk1mf. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Remove Netware and OS/2Rich Salz2016-03-173-43/+4
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove ultrix/mips support.Rich Salz2016-03-171-2/+0
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Remove some dead code from 1999Matt Caswell2016-03-112-12/+0
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Don't clobber the last errorMatt Caswell2016-03-111-4/+8
| | | | | | | | | | | | | | | | On Windows we call WSAGetLastError() to find out the last error that happened on a socket operation. We use this to find out whether we can retry the operation or not. You are supposed to call this immediately however in a couple of places we logged an error first. This can end up making other Windows system calls to get the thread local error state. Sometimes that can clobber the error code, so if you call WSAGetLastError() later on you get a spurious response and the socket operation looks like a fatal error. Really we shouldn't be logging an error anyway if its a retryable issue. Otherwise we could end up with stale errors on the error queue. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Avoid negative array index in BIO_debug_callback()Benjamin Kaduk2016-03-091-0/+3
| | | | | | | | | | | | | | | | BIO_snprintf() can return -1 on truncation (and overflow as of commit 9cb177301fdab492e4cfef376b28339afe3ef663). Though neither can realistically occur while printing a pointer and short fixed string into a buffer of length 256, the analysis to confirm that this the case goes somewhat far up the call chain, and not all static analyzers can successfully follow the chain of logic. It's easy enough to clamp the returned length to be nonnegative before continuing, which appeases the static analyzer and does not harm the subsequent code. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
* Convert CRYPTO_LOCK_BIO to new multi-threading APIAlessandro Ghedini2016-03-081-8/+36
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
* Convert CRYPTO_LOCK_GET*BYNAME to new multi-threading APIAlessandro Ghedini2016-03-081-4/+13
| | | | | Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
* ISSUE 43: Add BIO_sock_shutdownRich Salz2016-03-072-2/+2
| | | | | | This replaces SHUTDOWN/SHUTDOWN2 with BIO_closesocket. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Fix memory issues in BIO_*printf functionsMatt Caswell2016-02-251-71/+116
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* GH480: Don't break statements with CPP stuff.Flavio Medeiros2016-02-241-3/+4
| | | | | | | This is also RT 4137 Signed-off-by: Rich Salz <rsalz@akamai.com> Reviewed-by: Andy Polyakov <appro@openssl.org>
* GH678: Add a few more zallocFdaSilvaYY2016-02-221-6/+0
| | | | | | | Remove some duplicated NULL/zero init. Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org>
* Always build library object files with shared library cflagsRichard Levitte2016-02-201-1/+1
| | | | | | | | | | | | | | | | This takes us away from the idea that we know exactly how our static libraries are going to get used. Instead, we make them available to build shareable things with, be it other shared libraries or DSOs. On the other hand, we also have greater control of when the shared library cflags. They will never be used with object files meant got binaries, such as apps/openssl or test/test*. With unified, we take this a bit further and prepare for having to deal with extra cflags specifically to be used with DSOs (dynamic engines), libraries and binaries (applications). Reviewed-by: Rich Salz <rsalz@openssl.org>
* getaddrinfo: zero the hints structureEmilia Kasper2016-02-191-6/+1
| | | | | | | | This silences the memory sanitizer. All fields were already correctly initialized but the struct padding wasn't, causing an uninitialized read warning. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Remove all special make depend flags, as well as OPENSSL_DOING_MAKEDEPENDRichard Levitte2016-02-181-1/+1
| | | | | | | | | | All those flags existed because we had all the dependencies versioned in the repository, and wanted to have it be consistent, no matter what the local configuration was. Now that the dependencies are gone from the versioned Makefile.ins, it makes much more sense to use the exact same flags as when compiling the object files. Reviewed-by: Rich Salz <rsalz@openssl.org>
* RT4310: Fix varous no-XXX buildsRich Salz2016-02-171-0/+2
| | | | | | | | | | | | | | | | | | | | | When OPENSSL_NO_ASYNC is set, make ASYNC_{un,}block_pause() do nothing. This prevents md_rand.c from failing to build. Probably better to do it this way than to wrap every instance in an explicit #ifdef. A bunch of new socket code got added to a new file crypto/bio/b_addr.c. Make it all go away if OPENSSL_NO_SOCK is defined. Allow configuration with no-ripemd, no-ts, no-ui We use these for the UEFI build. Also remove the 'Really???' comment from no-err and no-locking. We use those too. We need to drop the crypto/engine directory from the build too, and also set OPENSSL_NO_ENGINE Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Tim Hudson <tjh@openssl.org>
* On solaris, the variable name sun clashes, use s_un insteadRichard Levitte2016-02-162-32/+32
| | | | | | For orthogonality, we change sin -> s_in and sin6 -> s_in6 as well. Reviewed-by: Matt Caswell <matt@openssl.org>
* Make the BIO_ADDR param optional.Rich Salz2016-02-142-12/+7
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* Make sure a socklen_t can compare with a sizeof() resultRichard Levitte2016-02-141-1/+1
| | | | | | | | | | Most of the times, it seems that socklen_t is unsigned. Unfortunately, this isn't always the case, and it doesn't compare with a size_t without warning. A cast resolves the issue. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Defines OSSL_SSIZE_MAXRob Percival2016-02-131-12/+4
| | | | | | | | | | | Removes SSIZE_MAX definition from bss_bio.c and changes that file to use OSSL_SSIZE_MAX. No need to account for OPENSSL_SYS_VXWORKS, since that never actually gets defined anywhere. It must be a historical artifact. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Ben Laurie <ben@openssl.org>
* Better workaround for VMS getnameinfo() bugRichard Levitte2016-02-121-5/+7
| | | | | | | | | | | | | | The actual bug with current getnameinfo() on VMS is not that it puts gibberish in the service buffer, but that it doesn't touch it at all. The gibberish we dealt with before was simply stuff that happened to be on the stack. It's better to initialise the service buffer properly (with the empty string) and check if it's still an empty string after the getnameinfo() call, and fill it with the direct numerical translation of the raw port if that's the case. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Move to REF_DEBUG, for consistency.Rich Salz2016-02-112-9/+4
| | | | | | | Add utility macros REF_ASSERT_NOT and REF_PRINT_COUNT This is also RT 4181 Reviewed-by: Richard Levitte <levitte@openssl.org>
* GH620: second diff from rt-2275, adds error codeRich Salz2016-02-111-0/+32
| | | | | | | clean up and apply patches from RT-2275 Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
* Rework BIO_ADDRINFO_protocol() to return correct valuesRichard Levitte2016-02-111-2/+18
| | | | | | | | As noted already, some platforms don't fill in ai_protocol as expected. To circumvent that, we have BIO_ADDRINFO_protocol() to compute a sensible answer in that case. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* BIO_PAIR_DEBUG did nothing; remove it.Rich Salz2016-02-101-14/+0
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* VMS getnameinfo() seems to have a bug with returned service stringRichard Levitte2016-02-101-0/+11
| | | | | | | | It seems like it gives back gibberish. If we asked for a numeric service, it's easy to check for a digit in the first position, and if there isn't any, rewrite it using older methods. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Small fixesRichard Levitte2016-02-081-1/+1
| | | | | | | | - One typo fixed in crypto/bio/b_addr.c - Add a comment in doc/crypto/BIO_parse_hostserv.pod to explain the blank lines with one lonely space each. Reviewed-by: Andy Polyakov <appro@openssl.org>
* GH641: Don't care openssl_zmallocRich Salz2016-02-081-3/+4
| | | | | | | | Don't cast malloc-family return values. Also found some places where (a) blank line was missing; and (b) the *wrong* return value was checked. Reviewed-by: Richard Levitte <levitte@openssl.org>
* bio/b_sock.c: cleanup obsolete stuff.Andy Polyakov2016-02-081-12/+0
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* avoid crash if hostserv is with host part onlyRoumen Petrov2016-02-081-1/+1
| | | | | | | | (if priority is set to host) Signed-off-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add a BIO_ADDR_clear functionMatt Caswell2016-02-051-0/+7
| | | | | | | Adds a new function BIO_ADDR_clear to reset a BIO_ADDR back to an unitialised state, and to set the family to AF_UNSPEC. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
* GH601: Various spelling fixes.FdaSilvaYY2016-02-053-4/+4
| | | | | Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* VMS lacks socklen_t, give it oneRichard Levitte2016-02-051-0/+4
| | | | | | Fortunately, we only use socklen_t internally Reviewed-by: Rich Salz <rsalz@openssl.org>
* Update crypto/bio/build.infoRichard Levitte2016-02-041-2/+2
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Make sure getaddrinfo and getnameinfo works as intended on WindowsRichard Levitte2016-02-041-2/+9
| | | | | | | | | Both getaddrinfo() and getnameinfo() have to be preceeded with a call to BIO_sock_init(). Also, make sure to give gai_strerror() the actual error code. Reviewed-by: Stephen Henson <steve@openssl.org>
* Use WSAGetLastError() on windowsKurt Roeckx2016-02-041-0/+8
| | | | | | | | Windows doesn't have h_error or hstrerror() Reviewed-by: Richard Levitte <levitte@openssl.org> MR: #1848
* bio_err.c: remove a reappeared filename commentViktor Szakats2016-02-041-1/+0
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
* Make fallback addresses static so that we can initialize itKurt Roeckx2016-02-041-8/+11
| | | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> MR: #1841
* Refactoring BIO: Adapt BIO_s_datagram and all that depends on itRichard Levitte2016-02-031-130/+43
| | | | | | | The control commands that previously took a struct sockaddr * have been changed to take a BIO_ADDR * instead. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* make updateRichard Levitte2016-02-031-1/+8
| | | | Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Refactoring BIO: adapt BIO_s_connect and BIO_s_acceptRichard Levitte2016-02-033-269/+424
| | | | Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* make updateRichard Levitte2016-02-031-0/+2
| | | | Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Refactoring BIO: reimplement old socket handling functions with new onesRichard Levitte2016-02-031-435/+90
| | | | Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* make updateRichard Levitte2016-02-031-0/+15
| | | | Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Temporary pragma to have GCC quiet down about deprecated functionsRichard Levitte2016-02-033-0/+18
| | | | | | | Future commits will change our use to newer functions and the pragmas will go away at that time. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Refactoring BIO: new socket-handling functions, deprecate older onesRichard Levitte2016-02-033-2/+345
| | | | | | | | | | | | | | | | | | | | | Added functions: BIO_socket BIO_connect BIO_listen BIO_accept_ex BIO_closesocket BIO_sock_info These get deprecated: BIO_gethostbyname BIO_get_port BIO_get_host_ip BIO_get_accept_socket BIO_accept Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Refactoring BIO: add error macros & text, and make updateRichard Levitte2016-02-031-1/+9
| | | | Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Refactoring BIO: Small adjustmentsRichard Levitte2016-02-033-6/+2
| | | | | | | | Because of the way bio_lcl.h is organised, we must not include internal/cryptlib.h before it. As a matter of fact, bio_lcl.h includes internal/cryptlib.h on its own. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* Refactoring BIO: add wrappers around sockaddr et alRichard Levitte2016-02-034-10/+878
| | | | | | | | | | | | | | | | | | | | | | | | | | Because different platforms have different levels of support for IPv6, different kinds of sockaddr variants, and some have getaddrinfo et al while others don't, we could end up with a mess if ifdefs, duplicate code and other maintainance nightmares. Instead, we're introducing wrappers around the common form for socket communication: BIO_ADDR, closely related to struct sockaddr and some of its variants. BIO_ADDRINFO, closely related to struct addrinfo. With that comes support routines, both convenient creators and accessors, plus a few utility functions: BIO_parse_hostserv, takes a string of the form host:service and splits it into host and service. It checks for * in both parts, and converts any [ipv6-address] syntax to ust the IPv6 address. BIO_lookup, looks up information on a host. All routines handle IPv4 (AF_INET) and IPv6 (AF_INET6) addresses, and there is support for local sockets (AF_UNIX) as well. Reviewed-by: Kurt Roeckx <kurt@openssl.org>