Changeset View
Changeset View
Standalone View
Standalone View
src/misc.c
| Context not available. | |||||
| static int verbosity_level = 0; | static int verbosity_level = 0; | ||||
| #ifndef HAVE_EXPLICIT_MEMSET | |||||
| /* Prevent compiler from optimizing away the call to memset by accessing | /* Prevent compiler from optimizing away the call to memset by accessing | ||||
| memset through volatile pointer. */ | memset through volatile pointer. */ | ||||
| static void *(*volatile memset_ptr)(void *, int, size_t) = (void *)memset; | static void *(*volatile memset_ptr)(void *, int, size_t) = (void *)memset; | ||||
| #endif | |||||
| static void (*fatal_error_handler)(void*,int, const char*) = NULL; | static void (*fatal_error_handler)(void*,int, const char*) = NULL; | ||||
| static void *fatal_error_handler_value = 0; | static void *fatal_error_handler_value = 0; | ||||
| Context not available. | |||||
| /* Note: This function is called from wipememory/wipememory2 only if LEN | /* Note: This function is called from wipememory/wipememory2 only if LEN | ||||
| is large or unknown at compile time. New wipe function alternatives | is large or unknown at compile time. New wipe function alternatives | ||||
| need to be checked before adding to this function. New implementations | need to be checked before adding to this function. New implementations | ||||
| need to be faster than wipememory/wipememory2 macros in 'misc.h'. | need to be faster than wipememory/wipememory2 macros in 'g10lib.h'. | ||||
| Following implementations were found to have suboptimal performance: | Following implementations were found to have suboptimal performance: | ||||
| Context not available. | |||||
| */ | */ | ||||
| #ifdef HAVE_EXPLICIT_BZERO | #ifdef HAVE_EXPLICIT_BZERO | ||||
| explicit_bzero (ptr, len); | explicit_bzero (ptr, len); | ||||
| #elif defined(HAVE_EXPLICIT_MEMSET) | |||||
| explicit_memset (ptr, 0, len); | |||||
| #else | #else | ||||
| memset_ptr (ptr, 0, len); | memset_ptr (ptr, 0, len); | ||||
| #endif | #endif | ||||
| Context not available. | |||||
| void | void | ||||
| _gcry_fast_wipememory2 (void *ptr, int set, size_t len) | _gcry_fast_wipememory2 (void *ptr, int set, size_t len) | ||||
| { | { | ||||
| #ifdef HAVE_EXPLICIT_MEMSET | |||||
| explicit_memset (ptr, set, len); | |||||
| #else | |||||
| #ifdef HAVE_EXPLICIT_BZERO | #ifdef HAVE_EXPLICIT_BZERO | ||||
| if (set == 0) | if (set == 0) | ||||
| { | { | ||||
| Context not available. | |||||
| #endif | #endif | ||||
| memset_ptr (ptr, set, len); | memset_ptr (ptr, set, len); | ||||
| #endif | |||||
| } | } | ||||
| Context not available. | |||||