diff options
author | Werner Koch <wk@gnupg.org> | 2013-12-12 15:13:09 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2013-12-12 15:28:06 +0100 |
commit | 3b30e9840d4b351c4de73b126e561154cb7df4cc (patch) | |
tree | ef3d2d1127165ef5866840d33ccde9d35a2dee33 /random/random-csprng.c | |
parent | cd548ba2dc777b8b27d8d33182ba733c20222120 (diff) | |
download | libgcrypt-3b30e9840d4b351c4de73b126e561154cb7df4cc.tar.gz |
Remove macro hacks for internal vs. external functions. Part 2 and last.
* src/visibility.h: Remove remaining define/undef hacks for symbol
visibility. Add macros to detect the use of the public functions.
Change all affected functions by replacing them by the x-macros.
* src/g10lib.h: Add internal prototypes.
(xtrymalloc, xtrycalloc, xtrymalloc_secure, xtrycalloc_secure)
(xtryrealloc, xtrystrdup, xmalloc, xcalloc, xmalloc_secure)
(xcalloc_secure, xrealloc, xstrdup, xfree): New macros.
--
The use of xmalloc/xtrymalloc/xfree is a more common pattern than the
gcry_free etc. functions. Those functions behave like those defined
by C and thus for better readability we use these macros and not
the underscore prefixed functions.
Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'random/random-csprng.c')
-rw-r--r-- | random/random-csprng.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/random/random-csprng.c b/random/random-csprng.c index b6d7f667..87235d82 100644 --- a/random/random-csprng.c +++ b/random/random-csprng.c @@ -322,11 +322,11 @@ initialize(void) use this extra space (which is allocated in secure memory) as a temporary hash buffer */ rndpool = (secure_alloc - ? gcry_xcalloc_secure (1, POOLSIZE + BLOCKLEN) - : gcry_xcalloc (1, POOLSIZE + BLOCKLEN)); + ? xcalloc_secure (1, POOLSIZE + BLOCKLEN) + : xcalloc (1, POOLSIZE + BLOCKLEN)); keypool = (secure_alloc - ? gcry_xcalloc_secure (1, POOLSIZE + BLOCKLEN) - : gcry_xcalloc (1, POOLSIZE + BLOCKLEN)); + ? xcalloc_secure (1, POOLSIZE + BLOCKLEN) + : xcalloc (1, POOLSIZE + BLOCKLEN)); /* Setup the slow entropy gathering function. The code requires that this function exists. */ @@ -676,7 +676,7 @@ _gcry_rngcsprng_set_seed_file (const char *name) { if (seed_file_name) BUG (); - seed_file_name = gcry_xstrdup (name); + seed_file_name = xstrdup (name); } @@ -1312,7 +1312,7 @@ gather_faked (void (*add)(const void*, size_t, enum random_origins), #endif } - p = buffer = gcry_xmalloc( length ); + p = buffer = xmalloc( length ); n = length; #ifdef HAVE_RAND while ( n-- ) @@ -1322,6 +1322,6 @@ gather_faked (void (*add)(const void*, size_t, enum random_origins), *p++ = ((unsigned)(1 + (int) (256.0*random()/(RAND_MAX+1.0)))-1); #endif add_randomness ( buffer, length, origin ); - gcry_free (buffer); + xfree (buffer); return 0; /* okay */ } |