[git] GCRYPT - branch, master, updated. libgcrypt-1.8.1-65-g3e3b520

by NIIBE Yutaka cvs at cvs.gnupg.org
Wed Apr 11 01:52:18 CEST 2018

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU crypto library".

The branch, master has been updated
       via  3e3b520fb32a37c5c23762531a7b3168e112ac36 (commit)
      from  5e01705ca90830c27a4cbd8bad41243915f4538a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 3e3b520fb32a37c5c23762531a7b3168e112ac36
Author: NIIBE Yutaka <gniibe at fsij.org>
Date:   Wed Apr 11 08:45:22 2018 +0900

    hmac: Use xtrymalloc.
    * src/hmac256.c (_gcry_hmac256_new): Use xtrymalloc.
    (_gcry_hmac256_file): Likewise.
    Don't require config.h but stdint.h for STANDALONE.
    Drop STANDALONE support for WindowsCE.
    GnuPG-bug-id: 3877
    Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>

diff --git a/src/hmac256.c b/src/hmac256.c
index ca1eb75..2d66079 100644
--- a/src/hmac256.c
+++ b/src/hmac256.c
@@ -24,8 +24,7 @@
     internal consistency checks.  It should not be used for sensitive
     data because no mechanisms to clear the stack etc are used.
-    This module may be used standalone and requires only a few
-    standard definitions to be provided in a config.h file.
+    This module may be used standalone.
@@ -46,7 +45,19 @@
                            for testing this included module.
+#include <stdint.h>
+#define HAVE_U32_TYPEDEF 1
+typedef uint32_t u32;
+#define VERSION "standalone"
+/* For GCC, we can detect endianness.  If not GCC, please define manually.  */
 #include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -56,13 +67,11 @@
 # include <fcntl.h> /* We need setmode().  */
-/* For a native WindowsCE binary we need to include gpg-error.h to
-   provide a replacement for strerror.  In other cases we need a
-   replacement macro for gpg_err_set_errno.  */
-#ifdef __MINGW32CE__
-# include <gpg-error.h>
+#define xtrymalloc(a) malloc((a))
+#define gpg_err_set_errno(a) (errno = (a))
-# define gpg_err_set_errno(a) (errno = (a))
+#include "g10lib.h"
 #include "hmac256.h"
@@ -296,7 +305,7 @@ _gcry_hmac256_new (const void *key, size_t keylen)
   hmac256_context_t hd;
-  hd = malloc (sizeof *hd);
+  hd = xtrymalloc (sizeof *hd);
   if (!hd)
     return NULL;
@@ -469,7 +478,7 @@ _gcry_hmac256_file (void *result, size_t resultsize, const char *filename,
   buffer_size = 32768;
-  buffer = malloc (buffer_size);
+  buffer = xtrymalloc (buffer_size);
   if (!buffer)
       fclose (fp);


Summary of changes:
 src/hmac256.c | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

The GNU crypto library

Gnupg-commits mailing list
Gnupg-commits at gnupg.org

More information about the Gcrypt-devel mailing list