summaryrefslogtreecommitdiff
path: root/crypto/evp/bio_b64.c
Commit message (Collapse)AuthorAgeFilesLines
* Convert all {NAME}err() in crypto/ to their corresponding ERR_raise() callRichard Levitte2020-11-131-1/+1
| | | | | | | | | | This includes error reporting for libcrypto sub-libraries in surprising places. This was done using util/err-to-raise Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/13318)
* Update copyright yearMatt Caswell2020-04-231-1/+1
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/11616)
* Remove unneeded switch statement to fix warningDane (4cad@silvertoque)2020-02-201-7/+2
| | | | | | | | | | https://github.com/openssl/openssl/issues/10958 CLA: trivial Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11125)
* Following the license change, modify the boilerplates in crypto/evp/Richard Levitte2018-12-061-1/+1
| | | | | | | [skip ci] Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/7794)
* Set error code on alloc failuresRich Salz2018-04-031-2/+3
| | | | | | | Almost all *alloc failures now set an error code. Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com> (Merged from https://github.com/openssl/openssl/pull/5842)
* Update copyright yearMatt Caswell2018-03-201-1/+1
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5689)
* bio_b64.c: prevent base64 filter BIO from decoding out-of-bound dataDr. Matthias St. Pierre2018-02-271-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #5405, #1381 The base64 filter BIO reads its input in chunks of B64_BLOCK_SIZE bytes. When processing input in PEM format it can happen in rare cases that - the trailing PEM marker crosses the boundary of a chunk, and - the beginning of the following chunk contains valid base64 encoded data. This happened in issue #5405, where the PEM marker was split into "-----END CER" and "TIFICATE-----" at the end of the first chunk. The decoding of the first chunk terminated correctly at the '-' character, which is treated as an EOF marker, and b64_read() returned. However, when called the second time, b64_read() read the next chunk and interpreted the string "TIFICATE" as valid base64 encoded data, adding 6 extra bytes '4c 81 48 08 04 c4'. This patch restores the assignment of the error code to 'ctx->cont', which was deleted accidentally in commit 5562cfaca4f3 and which prevents b64_read() from reading additional data on subsequent calls. This issue was observed and reported by Annie Yousar. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/5422)
* Fix invalid function type casts.Bernd Edlinger2017-12-151-2/+2
| | | | | | | Rename bio_info_cb to BIO_info_cb. Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4493)
* Make BIO_METHOD struct definitions consistentDaniel Bevenius2017-12-091-1/+2
| | | | | | | | | | | | | | I noticed that some of the BIO_METHOD structs are placing the name on the same line as the type and some don't. This commit places the name on a separate line for consistency (which looks like what the majority do) CLA: trivial Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Paul Dale <paul.dale@oracle.com> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4878)
* Remove parentheses of return.KaoruToda2017-10-181-5/+5
| | | | | | | | | Since return is inconsistent, I removed unnecessary parentheses and unified them. Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/4541)
* Remove some commented out code in libcryptoMatt Caswell2017-02-281-3/+0
| | | | | Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Andy Polyakov <appro@openssl.org> (Merged from https://github.com/openssl/openssl/pull/2774)
* Create BIO_write_ex() which handles size_t argumentsMatt Caswell2016-10-281-0/+2
| | | | | | | Also extend BIO_METHOD to be able to supply an implementation for the new BIO_write_ex function. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Create BIO_read_ex() which handles size_t argumentsMatt Caswell2016-10-281-0/+2
| | | | | | | Also extend BIO_METHOD to be able to supply an implementation for the new BIO_read function. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Change the return type of EVP_EncodeUpdateMatt Caswell2016-06-161-3/+4
| | | | | | | | Previously EVP_EncodeUpdate returned a void. However there are a couple of error conditions that can occur. Therefore the return type has been changed to an int, with 0 indicating error and 1 indicating success. Reviewed-by: Rich Salz <rsalz@openssl.org>
* Copyright consolidation 04/10Rich Salz2016-05-171-54/+6
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* fix checkJ Mohan Rao Arisankala2016-05-091-1/+1
| | | | | Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* few missing allocation failure checks and releases on error pathsJ Mohan Rao Arisankala2016-05-091-1/+6
| | | | | | | | - Missing checks for allocation failure. - releasing memory in few missing error paths Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Make BIO opaqueMatt Caswell2016-03-291-33/+52
| | | | | | | | Move the the BIO_METHOD and BIO structures into internal header files, provide appropriate accessor methods and update all internal code to use the new accessors where appropriate. Reviewed-by: Richard Levitte <levitte@openssl.org>
* RT4660: BIO_METHODs should be const.David Benjamin2016-03-211-2/+2
| | | | | | | 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 /* foo.c */ commentsRich Salz2016-01-261-1/+0
| | | | | | | | | | | | This was done by the following find . -name '*.[ch]' | /tmp/pl where /tmp/pl is the following three-line script: print unless $. == 1 && m@/\* .*\.[ch] \*/@; close ARGV if eof; # Close file to reset $. And then some hand-editing of other files. Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
* Adapt BIO_f_base64 to the opaque EVP_ENCODE_CTXRichard Levitte2015-12-111-11/+14
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* remove 0 assignments.Rich Salz2015-09-031-7/+1
| | | | | | | After openssl_zalloc, cleanup more "set to 0/NULL" assignments. Many are from github feedback. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Identify and move common internal libcrypto header filesRichard Levitte2015-05-141-1/+1
| | | | | | | | | | | | | There are header files in crypto/ that are used by a number of crypto/ submodules. Move those to crypto/include/internal and adapt the affected source code and Makefiles. The header files that got moved are: crypto/cryptolib.h crypto/md32_common.h Reviewed-by: Rich Salz <rsalz@openssl.org>
* Use safer sizeof variant in mallocRich Salz2015-05-041-1/+1
| | | | | | | | | | | | | For a local variable: TYPE *p; Allocations like this are "risky": p = OPENSSL_malloc(sizeof(TYPE)); if the type of p changes, and the malloc call isn't updated, you could get memory corruption. Instead do this: p = OPENSSL_malloc(sizeof(*p)); Also fixed a few memset() calls that I noticed while doing this. Reviewed-by: Richard Levitte <levitte@openssl.org>
* remove malloc castsRich Salz2015-04-281-1/+1
| | | | | | | Following ANSI C rules, remove the casts from calls to OPENSSL_malloc and OPENSSL_realloc. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Dead code: if 0 removal from crypto/evp and an unused file.Rich Salz2015-02-021-4/+0
| | | | | Reviewed-by: Andy Polyakov <appro@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org>
* Run util/openssl-format-source -v -c .Matt Caswell2015-01-221-516/+490
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Initialize num properly.Dr. Stephen Henson2014-05-061-0/+1
| | | | | PR#3289 PR#3345
* Fix base64 decoding bug.Eric Young2014-04-021-1/+1
| | | | | | | A short PEM encoded sequence if passed to the BIO, and the file had 2 \n following would fail. PR#3289
* PR: 2258Dr. Stephen Henson2010-05-271-23/+54
| | | | | | | | | | Submitted By: Ger Hobbelt <ger@hobbelt.com> Base64 BIO fixes: Use OPENSSL_assert() instead of assert(). Use memmove() as buffers overlap. Fix write retry logic.
* A general spring-cleaning (in autumn) to fix up signed/unsigned warnings.Geoff Thorpe2003-10-291-1/+1
| | | | | | | | | | I have tried to convert 'len' type variable declarations to unsigned as a means to address these warnings when appropriate, but when in doubt I have used casts in the comparisons instead. The better solution (that would get us all lynched by API users) would be to go through and convert all the function prototypes and structure definitions to use unsigned variables except when signed is necessary. The proliferation of (signed) "int" for strictly non-negative uses is unfortunate.
* Base64 bio fixes. The base64 bio was seriously brokenDr. Stephen Henson2003-02-221-6/+27
| | | | | | | | when reading from a non blocking BIO. It would incorrectly interpret retries as EOF, incorrectly buffer initial data and have no buffering at all after initial data (data would be sent one byte at a time to EVP_DecodeUpdate).
* Fix bug in base64 bios during write an non blocking I/O:Dr. Stephen Henson2003-02-201-4/+1
| | | | | if the write fails when flushing the buffer return the value to the application so it can retry.
* Security fixes brought forward from 0.9.7.Ben Laurie2002-11-131-0/+1
|
* In certain cases, no encoding has been set up for the b64 filter. InRichard Levitte2001-10-111-2/+3
| | | | | | such cases, a flush should *not* attempt to finalise the encoding, as the EVP_ENCODE_CTX structure will only be filled with garbage. For the same reason, do the same check when a wpending is performed.
* When data are written out in very small blocks (less than 3 bytes inRichard Levitte2000-07-261-4/+11
| | | | | | | size) through the base64 filter, b64_write() messes up it's parameters in such a way that instead of writing correct base64 output, the first 4 characters of that output is repeated over and over. This fix corrects that problem.
* Fixes for Win32 build.Dr. Stephen Henson2000-06-211-2/+2
| | | | | | | | | | | | | | | | | This is mostly a work around for the old VC++ problem that it treats func() as func(void). Various prototypes had been added to 'compare' function pointers that triggered this. This could be fixed by removing the prototype, adding function pointer casts to every call or changing the passed function to use the expected arguments. I mostly did the latter. The mkdef.pl script was modified to remove the typesafe functions which no longer exist. Oh and some functions called OPENSSL_freeLibrary() were changed back to FreeLibrary(), wonder how that happened :-)
* There have been a number of complaints from a number of sources that namesRichard Levitte2000-06-011-2/+2
| | | | | | | | | like Malloc, Realloc and especially Free conflict with already existing names on some operating systems or other packages. That is reason enough to change the names of the OpenSSL memory allocation macros to something that has a better chance of being unique, like prepending them with OPENSSL_. This change includes all the name changes needed throughout all C files.
* Get rid of more non-ANSI declarations.Ulf Möller2000-05-151-7/+7
|
* Move the registration of callback functions to special functionsRichard Levitte2000-02-201-0/+16
| | | | | | | | | | designed for that. This removes the potential error to mix data and function pointers. Please note that I'm a little unsure how incorrect calls to the old ctrl functions should be handled, in som cases. I currently return 0 and that's it, but it may be more correct to generate a genuine error in those cases.
* Fix for base64 BIO decoding bugDr. Stephen Henson1999-10-021-1/+1
|
* Remove NOPROTO definitions and error code comments.Ulf Möller1999-04-261-11/+0
|
* Change #include filenames from <foo.h> to <openssl.h>.Bodo Möller1999-04-231-2/+2
| | | | | | Submitted by: Reviewed by: PR:
* Change functions to ANSI C.Ulf Möller1999-04-191-18/+6
|
* Import of old SSLeay release: SSLeay 0.9.0bRalf S. Engelschall1998-12-211-11/+106
|
* Import of old SSLeay release: SSLeay 0.8.1bRalf S. Engelschall1998-12-211-0/+452