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 /cipher/scrypt.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 'cipher/scrypt.c')
-rw-r--r-- | cipher/scrypt.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/cipher/scrypt.c b/cipher/scrypt.c index 6f6a7f11..404943d8 100644 --- a/cipher/scrypt.c +++ b/cipher/scrypt.c @@ -281,21 +281,21 @@ _gcry_kdf_scrypt (const unsigned char *passwd, size_t passwdlen, if (nbytes < r128) return GPG_ERR_ENOMEM; - B = gcry_malloc (p * r128); + B = xtrymalloc (p * r128); if (!B) { ec = gpg_err_code_from_syserror (); goto leave; } - tmp1 = gcry_malloc (N * r128); + tmp1 = xtrymalloc (N * r128); if (!tmp1) { ec = gpg_err_code_from_syserror (); goto leave; } - tmp2 = gcry_malloc (64 + r128); + tmp2 = xtrymalloc (64 + r128); if (!tmp2) { ec = gpg_err_code_from_syserror (); @@ -313,9 +313,9 @@ _gcry_kdf_scrypt (const unsigned char *passwd, size_t passwdlen, 1 /* iterations */, dkLen, DK); leave: - gcry_free (tmp2); - gcry_free (tmp1); - gcry_free (B); + xfree (tmp2); + xfree (tmp1); + xfree (B); return ec; } |