aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/objects/o_names.c
Commit message (Collapse)AuthorAgeFilesLines
* Add a lock around the OBJ_NAME tableRich Salz2017-06-071-28/+65
| | | | | | | | | | | | | Various initialization functions modify this table, which can cause heap corruption in the absence of external synchronization. Some stats are modified from OPENSSL_LH_retrieve, where callers aren't expecting to have to take out an exclusive lock. Switch to using atomic operations for those stats. Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Rich Salz <rsalz@openssl.org> (Merged from https://github.com/openssl/openssl/pull/3525)
* Add checks on sk_TYPE_push() returned valueFdaSilvaYY2016-07-051-3/+9
| | | | | Reviewed-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Fix a mem leak on an error path in OBJ_NAME_add()Matt Caswell2016-05-241-3/+4
| | | | | | | | If lh_OBJ_NAME_insert() fails then the allocated |onp| value is leaked. RT#2238 Reviewed-by: Richard Levitte <levitte@openssl.org>
* Rename lh_xxx,sk_xxx tp OPENSSL_{LH,SK}_xxxRich Salz2016-05-201-2/+2
| | | | | | | | | | | | Rename sk_xxx to OPENSSL_sk_xxx and _STACK to OPENSSL_STACK Rename lh_xxx API to OPENSSL_LH_xxx and LHASH_NODE to OPENSSL_LH_NODE Make lhash stuff opaque. Use typedefs for function pointers; makes the code simpler. Remove CHECKED_xxx macros. Add documentation; remove old X509-oriented doc. Add API-compat names for entire old API Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
* Copyright consolidation 04/10Rich Salz2016-05-171-0/+9
| | | | Reviewed-by: Richard Levitte <levitte@openssl.org>
* fix tab-space mixed indentationFdaSilvaYY2016-05-091-1/+1
| | | | | | | No code change Reviewed-by: Kurt Roeckx <kurt@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* RT4335: Fix UEFI build of OBJ_NAME_new_index()David Woodhouse2016-02-261-8/+16
| | | | | | | | | | | | | | | | | | | | | | | We are using strcmp() as the cmp_func, where in the EDK2 environment strcmp actually ends up being the external AsciiStrCmp() function — an EFI library function defined with the Microsoft ABI. This means that we can't just assign function pointers to it, since in GCC-hosted builds the ABI of any function *not* explicitly marked EFIAPI is the native SysV ABI. Arguably this stupidity ought to be resolved on the UEFI side, but in the general case that would mean that we need to provide ABI-compatible wrappers for *all* the "standard" functions, just in case they're used like this. And in fact we already have a workaround here for DEC C. So instead of playing games with casting function pointers, it's nicer just to use a simple function to wrap the strcmp() call. That cleans up the DEC C workaround, *and* it works around the UEFI bogosity at the same time. Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* GH601: Various spelling fixes.FdaSilvaYY2016-02-051-1/+1
| | | | | Signed-off-by: Rich Salz <rsalz@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org>
* Add lh_doall_arg inliningDr. Stephen Henson2016-01-111-7/+6
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add lh_doall inliningDr. Stephen Henson2016-01-111-3/+1
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Add lh_new() inliningDr. Stephen Henson2016-01-111-15/+5
| | | | Reviewed-by: Rich Salz <rsalz@openssl.org>
* Inline LHASH_OFDr. Stephen Henson2016-01-111-5/+4
| | | | | | | | | | | Make LHASH_OF use static inline functions. Add new lh_get_down_load and lh_set_down_load functions and their typesafe inline equivalents. Make lh_error a function instead of a macro. Reviewed-by: Rich Salz <rsalz@openssl.org>
* mem functions cleanupRich Salz2016-01-071-8/+8
| | | | | | | | | | | | | | | | | Only two macros CRYPTO_MDEBUG and CRYPTO_MDEBUG_ABORT to control this. If CRYPTO_MDEBUG is not set, #ifdef out the whole debug machinery. (Thanks to Jakob Bohm for the suggestion!) Make the "change wrapper functions" be the only paradigm. Wrote documentation! Format the 'set func' functions so their paramlists are legible. Format some multi-line comments. Remove ability to get/set the "memory debug" functions at runtme. Remove MemCheck_* and CRYPTO_malloc_debug_init macros. Add CRYPTO_mem_debug(int flag) function. Add test/memleaktest. Rename CRYPTO_malloc_init to OPENSSL_malloc_init; remove needless calls. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Only declare stacks in headersDr. Stephen Henson2016-01-071-4/+3
| | | | | | | Don't define stacks in C source files: it causes warnings about unused functions in some compilers. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Rename DECLARE*STACK_OF to DEFINE*STACK_OFDr. Stephen Henson2016-01-071-1/+1
| | | | | | | | | | Applications wishing to include their own stacks now just need to include DEFINE_STACK_OF(foo) in a header file. Reviewed-by: Richard Levitte <levitte@openssl.org>
* Continue standardising malloc style for libcryptoMatt Caswell2015-11-091-2/+2
| | | | | | | Continuing from previous commit ensure our style is consistent for malloc return checks. Reviewed-by: Kurt Roeckx <kurt@openssl.org>
* remove 0 assignments.Rich Salz2015-09-031-5/+1
| | | | | | | After openssl_zalloc, cleanup more "set to 0/NULL" assignments. Many are from github feedback. Reviewed-by: Tim Hudson <tjh@openssl.org>
* Use safer sizeof variant in mallocRich Salz2015-05-041-4/+4
| | | | | | | | | | | | | 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>
* Code style: space after 'if'Viktor Dukhovni2015-04-161-1/+1
| | | | Reviewed-by: Matt Caswell <matt@openssl.org>
* Unchecked malloc fixesMatt Caswell2015-03-051-6/+9
| | | | | | | 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>
* util/mkstack.pl now generates entire safestack.hRich Salz2015-02-061-1/+0
| | | | | | | | | The mkstack.pl script now generates the entire safestack.h file. It generates output that follows the coding style. Also, removed all instances of the obsolete IMPLEMENT_STACK_OF macro. Reviewed-by: Andy Polyakov <appro@openssl.org>
* Run util/openssl-format-source -v -c .Matt Caswell2015-01-221-294/+285
| | | | Reviewed-by: Tim Hudson <tjh@openssl.org>
* Fix some clang warnings.Ben Laurie2013-01-131-1/+1
|
* Revert the size_t modifications from HEAD that had led to moreGeoff Thorpe2008-11-121-2/+2
| | | | | | 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.
* size_tification.Ben Laurie2008-11-011-2/+2
|
* LHASH revamp. make depend.Ben Laurie2008-05-261-22/+25
|
* some const fixes and cleanupNils Larsch2005-04-051-3/+3
|
* Add lots of checks for memory allocation failure, error codes to indicateDr. Stephen Henson2004-12-051-1/+6
| | | | | | failure and freeing up memory if a failure occurs. PR:620
* Check the return values where memory allocation failures may happen.Richard Levitte2002-05-301-0/+3
| | | | PR: 49
* With later version of DEC C on VMS, some functions (strcmp(), forRichard Levitte2001-02-201-1/+13
| | | | | | | | example) are declared with some extra linkage information. This generates a warning when using the function name as a value to a regular function pointer with the "correct" definition of the function. Therefore, use a macro to cast the appropriate function on VMS.
* The callbacks in the NAME_FUNCS structure are not used directly as LHASHGeoff Thorpe2001-02-201-10/+10
| | | | | | | | | | callbacks, and their prototypes were consistent as they were. These casts need reversing. Also, I personally find line breaks during parameter lists (ie a line ending in a comma) easier to read at a glance than line breaks at the end of a function call and before a dereference on the return value (ie a line ending in a closed-bracket followed by a line starting with "->").
* Get the right cast for lhash callback functions.Richard Levitte2001-02-201-2/+2
|
* Move all the existing function pointer casts associated with LHASH's twoGeoff Thorpe2001-01-091-2/+6
| | | | | | | "doall" functions to using type-safe wrappers. As and where required, this can be replaced by redeclaring the underlying callbacks to use the underlying "void"-based prototypes (eg. if performance suffers from an extra level of function invocation).
* Whilst in the process of fixing outstanding function-pointer casts in theGeoff Thorpe2001-01-081-1/+1
| | | | | | | | LHASH code, this evil was uncovered. The cast was obscuring the fact that the function was prototyped to take 2 parameters when in fact it is being used as a callback that should take only one. Anyway, the function itself ignores the second parameter (thankfully). A proper cure is on the way but for now this corrects the inconsistency.
* Various Win32 related fixes. Doesn't compile yet onDr. Stephen Henson2000-12-211-2/+2
| | | | | | | | | | | | | | Win32 but it is getting there... Update mkdef.pl to handle ASN1_ANY and fix headers. Stop various VC++ warnings. Include some fixes from "Peter 'Luna' Runestig" <peter@runestig.com> Remove external declaration for des_set_weak_key_flag: it doesn't exist.
* Constification of the data of a hash table. This means the callbackRichard Levitte2000-12-131-4/+4
| | | | | | | 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...
* Next step in tidying up the LHASH code.Geoff Thorpe2000-12-081-8/+15
| | | | | | | | | | | | | | | | DECLARE/IMPLEMENT macros now exist to create type (and prototype) safe wrapper functions that avoid the use of function pointer casting yet retain type-safety for type-specific callbacks. However, most of the usage within OpenSSL itself doesn't really require the extra function because the hash and compare callbacks are internal functions declared only for use by the hash table. So this change catches all those cases and reimplements the functions using the base-level LHASH prototypes and does per-variable casting inside those functions to convert to the appropriate item type. The exception so far is in ssl_lib.c where the hash and compare callbacks are not static - they're exposed in ssl.h so their prototypes should not be changed. In this last case, the IMPLEMENT_LHASH_*** macros have been left intact.
* Make the remaining LHASH macro changes. This should leave no remainingGeoff Thorpe2000-12-041-2/+5
| | | | | cases of function pointer casting in lh_new() calls - and leave only the lh_doall and lh_doall_arg cases to be finished.
* First step in tidying up the LHASH code. The callback prototypes (andGeoff Thorpe2000-12-011-3/+4
| | | | | | | | | | | | | | | | casts) used in the lhash code are about as horrible and evil as they can be. For starters, the callback prototypes contain empty parameter lists. Yuck. This first change defines clearer prototypes - including "typedef"'d function pointer types to use as "hash" and "compare" callbacks, as well as the callbacks passed to the lh_doall and lh_doall_arg iteration functions. Now at least more explicit (and clear) casting is required in all of the dependant code - and that should be included in this commit. The next step will be to hunt down and obliterate some of the function pointer casting being used when it's not necessary - a particularly evil variant exists in the implementation of lh_doall.
* Better handling of EVP names, add EVP to speed.Ben Laurie2000-11-201-11/+79
|
* Fixes for Win32 build.Dr. Stephen Henson2000-06-211-2/+3
| | | | | | | | | | | | | | | | | 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 :-)
* Safe stack reorganisation in terms of function casts.Dr. Stephen Henson2000-06-161-31/+0
| | | | | | | | | | | | After some messing around this seems to work but needs a few more tests. Working out the syntax for sk_set_cmp_func() (cast it to a function that itself returns a function pointer) was painful :-( Needs some testing to see what other compilers think of this syntax. Also needs similar stuff for ASN1_SET_OF etc etc.
* There have been a number of complaints from a number of sources that namesRichard Levitte2000-06-011-5/+5
| | | | | | | | | 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.
* "make update" + stripping the type-specific stack functions out ofGeoff Thorpe2000-06-011-0/+31
| | | | libeay.num and ssleay.num.
* Make name_funcs_stack static.Dr. Stephen Henson2000-03-031-1/+1
|
* Enhance consistency by using BIO_flush() instead of fflush().Richard Levitte2000-02-251-1/+1
|
* Seek out and destroy another evil cast.Ulf Möller2000-01-301-2/+2
|
* Source code cleanups: Use void * rather than char * in lhash,Ulf Möller2000-01-301-3/+3
| | | | eliminate some of the -Wcast-qual warnings (debug-ben-strict target)
* Reimplement so only one synchronous stack is used. The benefit isRichard Levitte2000-01-291-79/+60
| | | | that function pointers are nicely tucker in their structure.