[git] GCRYPT - branch, master, updated. libgcrypt-1.6.0-237-g46c0726
by Peter Wu
cvs at cvs.gnupg.org
Sun Jul 26 16:00:42 CEST 2015
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 46c072669eb81ed610cc5b3c0dc0c75a143afbb4 (commit)
from ada0a7d302cca97b327faaacac7a5d0b8043df88 (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 46c072669eb81ed610cc5b3c0dc0c75a143afbb4
Author: Peter Wu <peter at lekensteyn.nl>
Date: Sun Jul 26 16:50:33 2015 +0300
Fix undefined behavior wrt memcpy
* cipher/cipher-gcm.c: Do not copy zero bytes from an empty buffer. Let
the function continue to add padding as needed though.
* cipher/mac-poly1305.c: If the caller requested to finish the hash
function without a copy of the result, return immediately.
--
Caught by UndefinedBehaviorSanitizer.
Signed-off-by: Peter Wu <peter at lekensteyn.nl>
diff --git a/cipher/cipher-gcm.c b/cipher/cipher-gcm.c
index 6b13fc5..3711a1d 100644
--- a/cipher/cipher-gcm.c
+++ b/cipher/cipher-gcm.c
@@ -474,7 +474,7 @@ do_ghash_buf(gcry_cipher_hd_t c, byte *hash, const byte *buf,
do
{
- if (buflen + unused < blocksize || unused > 0)
+ if (buflen > 0 && (buflen + unused < blocksize || unused > 0))
{
n = blocksize - unused;
n = n < buflen ? n : buflen;
diff --git a/cipher/mac-poly1305.c b/cipher/mac-poly1305.c
index 76b369a..b80f87d 100644
--- a/cipher/mac-poly1305.c
+++ b/cipher/mac-poly1305.c
@@ -260,6 +260,9 @@ poly1305mac_read (gcry_mac_hd_t h, unsigned char *outbuf, size_t *outlen)
mac_ctx->marks.tag = 1;
}
+ if (*outlen == 0)
+ return 0;
+
if (*outlen <= POLY1305_TAGLEN)
buf_cpy (outbuf, mac_ctx->tag, *outlen);
else
-----------------------------------------------------------------------
Summary of changes:
cipher/cipher-gcm.c | 2 +-
cipher/mac-poly1305.c | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
hooks/post-receive
--
The GNU crypto library
http://git.gnupg.org
_______________________________________________
Gnupg-commits mailing list
Gnupg-commits at gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-commits
More information about the Gcrypt-devel
mailing list