summaryrefslogtreecommitdiffstats
path: root/crypto/mem.c
AgeCommit message (Collapse)Author
2015-09-02Add and use OPENSSL_zallocRich Salz
There are many places (nearly 50) where we malloc and then memset. Add an OPENSSL_zalloc routine to encapsulate that. (Missed one conversion; thanks Richard) Also fixes GH328 Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-08-26Remove _locked memory functions.Rich Salz
Undocumented, unused, unnecessary (replaced by secure arena). Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-06-23More secure storage of key material.Rich Salz
Add secure heap for storage of private keys (when possible). Add BIO_s_secmem(), CBIGNUM, etc. Add BIO_CTX_secure_new so all BIGNUM's in the context are secure. Contributed by Akamai Technologies under the Corporate CLA. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-05-14Identify and move common internal libcrypto header filesRichard Levitte
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>
2015-05-01free null cleanup finaleRich Salz
Don't check for NULL before calling OPENSSL_free Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-30free cleanup almost the finaleRich Salz
Add OPENSSL_clear_free which merges cleanse and free. (Names was picked to be similar to BN_clear_free, etc.) Removed OPENSSL_freeFunc macro. Fixed the small simple ones that are left: CRYPTO_free CRYPTO_free_locked OPENSSL_free_locked Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-28remove malloc castsRich Salz
Following ANSI C rules, remove the casts from calls to OPENSSL_malloc and OPENSSL_realloc. Reviewed-by: Richard Levitte <levitte@openssl.org>
2015-04-22Fix CRYPTO_strdupLoganaden Velvindron
The function CRYPTO_strdup (aka OPENSSL_strdup) fails to check the return value from CRYPTO_malloc to see if it is NULL before attempting to use it. This patch adds a NULL check. RT3786 Signed-off-by: Matt Caswell <matt@openssl.org> (cherry picked from commit 37b0cf936744d9edb99b5dd82cae78a7eac6ad60) Reviewed-by: Rich Salz <rsalz@openssl.org> (cherry picked from commit 20d21389c8b6f5b754573ffb6a4dc4f3986f2ca4)
2015-01-22Run util/openssl-format-source -v -c .Matt Caswell
Reviewed-by: Tim Hudson <tjh@openssl.org>
2014-11-10Fix datarace reported by valgrind/helgrindRussell Coker
This doesn't really fix the datarace but changes it so it can only happens once. This isn't really a problem since we always just set it to the same value. We now just stop writing it after the first time. PR3584, https://bugs.debian.org/534534 Signed-off-by: Kurt Roeckx <kurt@roeckx.be> Reviewed-by: Rich Salz <rsalz@openssl.org>
2012-06-03Version skew reduction: trivia (I hope).Ben Laurie
2012-04-19Check for potentially exploitable overflows in asn1_d2i_read_bioDr. Stephen Henson
BUF_mem_grow and BUF_mem_grow_clean. Refuse attempts to shrink buffer in CRYPTO_realloc_clean. Thanks to Tavis Ormandy, Google Security Team, for discovering this issue and to Adam Langley <agl@chromium.org> for fixing it. (CVE-2012-2110)
2011-04-12No need to disable leak checking for FIPS builds now we use internalDr. Stephen Henson
memory callbacks.
2011-04-01Add additional OPENSSL_init() handling add dummy call to (hopefully)Dr. Stephen Henson
ensure OPENSSL_init() is always linked into an application.
2011-01-27Move locking and thread ID functions into new files lock.c and thr_id.c,Dr. Stephen Henson
redirect locking to minimal FIPS_lock() function where required.
2008-11-12Revert the size_t modifications from HEAD that had led to moreGeoff Thorpe
knock-on work than expected - they've been extracted into a patch series that can be completed elsewhere, or in a different branch, before merging back to HEAD.
2008-11-02Fix prototypes.Dr. Stephen Henson
2008-11-01size_tification.Ben Laurie
2008-10-26Add JPAKE.Ben Laurie
2007-05-14Profiling revealed that OPENSSL_cleanse consumes *more* CPU time thanAndy Polyakov
sha1_block_data_order when hashing short messages. Move OPENSSL_cleanse to "cpuid" assembler module and gain 2x.
2003-12-01CRYPTO_malloc(), CRYPTO_realloc() and variants of them should return NULLRichard Levitte
if the give size is 0. This is a thought that came up in PR 751.
2003-10-07In realloc, don't destroy the old memory area if a new one couldn't beRichard Levitte
allocated. Notified by Daniel Lucq <daniel@lucq.org>
2003-02-19Make sure the memory allocation routines check for negative sizesRichard Levitte
2002-11-28Cleanse memory using the new OPENSSL_cleanse() function.Richard Levitte
I've covered all the memset()s I felt safe modifying, but may have missed some.
2002-11-27Add OPENSSL_cleanse() to help cleanse memory and avoid certain compilerRichard Levitte
and linker optimizations. PR: 343
2002-11-13Security fixes brought forward from 0.9.7.Ben Laurie
2002-08-01If CRYPTO_realloc() is called with a NULL pointer, have it callRichard Levitte
OPENSSL_malloc(). PR: 187
2001-01-10No functional change, but slightly improved code clarity.Bodo Möller
2001-01-10After discussion with Richard, change the new API for extended memoryBodo Möller
allocation callbacks so that it is no longer visible to applications that these live at a different call level than conventional memory allocation callbacks.
2001-01-10make indentation consistentBodo Möller
2001-01-10As response to a user request to be able to use external memoryRichard Levitte
handling routines that need file name and line number information, I've added a call level to our memory handling routines to allow that kind of hooking.
2000-12-13Constification of the data of a hash table. This means the callbackRichard Levitte
functions need to be constified, and therefore meant a number of easy changes a little everywhere. Now, if someone could explain to me why OBJ_dup() cheats...
2000-06-01There have been a number of complaints from a number of sources that namesRichard Levitte
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.
2000-05-02In Message-ID: <003201bfb332$14a07520$0801a8c0@janm.transactionsite.com>,Richard Levitte
"Jan Mikkelsen" <janm@transactionsite.com> correctly states that the OpenSSL header files have #include's and extern "C"'s in an incorrect order. Thusly fixed. Also, make the memory debugging routines defined and declared with prototypes, and use void* instead of char* for memory blobs. And last of all, redo the ugly callback construct for elegance and better definition (with prototypes).
2000-02-11Make gcc 2.95.2 happy again, even under ``-Wall -Wshadow -Wpointer-arith ↵Ralf S. Engelschall
-Wcast-align -Wmissing-prototypes -Wmissing-declarations -Wnested-externs -Winline''.
2000-01-30Source code cleanups: Use void * rather than char * in lhash,Ulf Möller
eliminate some of the -Wcast-qual warnings (debug-ben-strict target)
1999-12-19Late break-in patch for MacOS support.Andy Polyakov
1999-12-18- Don't assume that int and size_t have the same representationBodo Möller
(and that malloc can be called with an int argument). - Use proper prototypes (with argument list) for various function pointers, avoid casts (however there are still many such cases left in these files). - Avoid collissions in app_info_cmp if sizeof int != sizeof long. - Use CRYPTO_LOCK_MALLOC in mem_dbg.c.
1999-12-18 - Added more documentation in CHANGES.Richard Levitte
- Made CRYPTO_MDEBUG even less used in crypto.h, giving MemCheck_start() and MemCheck_stop() only one possible definition. - Made the values of the debug function pointers in mem.c dependent on the existence of the CRYPTO_MDEBUG macro, and made the rest of the code understand the NULL case. That's it. With this code, the old behvior of the debug functionality is restored, but you can still opt to have it on, even when the library wasn't compiled with a defined CRYPTO_MDEBUG.
1999-12-17Rebuild of the OpenSSL memory allocation and deallocation routines.Richard Levitte
With this change, the following is provided and present at all times (meaning CRYPTO_MDEBUG is no longer required to get this functionality): - hooks to provide your own allocation and deallocation routines. They have to have the same interface as malloc(), realloc() and free(). They are registered by calling CRYPTO_set_mem_functions() with the function pointers. - hooks to provide your own memory debugging routines. The have to have the same interface as as the CRYPTO_dbg_*() routines. They are registered by calling CRYPTO_set_mem_debug_functions() with the function pointers. I moved everything that was already built into OpenSSL and did memory debugging to a separate file (mem_dbg.c), to make it clear what is what. With this, the relevance of the CRYPTO_MDEBUG has changed. The only thing in crypto/crypto.h that it affects is the definition of the MemCheck_start and MemCheck_stop macros.
1999-11-12The info removal code was overcomplicated, and error-prone (references being ↵Richard Levitte
wrongly decreased). Fixed.
1999-11-12Avoid deadlock.Bodo Möller
1999-11-12Avoid some silly compiler warnings, and add the change log I forgot :-)Richard Levitte
1999-11-12Two changes have been made:Richard Levitte
1. Added code to the memory leak detecting code to give the user the possibility to add information, thereby forming a traceback. 2. Make the memory leak detecting code multithread-safe. The idea is that we're actually dealing with two separate critical sections, one containing the hash tables with the information, the other containing the current memory checking mode. Those should not be handled with the same lock, especially since their handling overlap. Hence, the added second lock.
1999-07-19New compile time option -DCRYPTO_MDEBUG_THREAD.Bodo Möller
1999-07-19Have CRYPTO_MDEBUG_TIME automatically set CRYPTO_MDEBUG,Bodo Möller
and make it the default for some debugging configurations.
1999-07-18Add optional (compile-time configurable) time to CRYPTO_mem_leaks output.Bodo Möller
This is much more helpful than the counter when doing tests with the library interactively.
1999-07-09Fix memory checking.Bodo Möller
1999-06-10Avoid warnings.Bodo Möller
1999-06-07Don't mix real tabs with tabs expanded as 8 spaces -- that'sBodo Möller
a pain to read when using 4-space tabs.