gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] [libmicrohttpd] branch master updated (5cfc0390 -> 78a90394


From: gnunet
Subject: [GNUnet-SVN] [libmicrohttpd] branch master updated (5cfc0390 -> 78a90394)
Date: Fri, 19 Apr 2019 09:36:01 +0200

This is an automated email from the git hooks/post-receive script.

karlson2k pushed a change to branch master
in repository libmicrohttpd.

    from 5cfc0390 sha256.h: added missed include
     new 866b60ae SHA256: rename sha256_digest() -> sha256_finish()
     new 78a90394 sha256_update(): added shortcut for empty data, avoid 
wrong/undefined behaviour of memcpy() with null pointer

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/microhttpd/digestauth.c  | 2 +-
 src/microhttpd/sha256.c      | 3 +++
 src/microhttpd/sha256.h      | 2 --
 src/microhttpd/test_sha256.c | 8 ++++----
 4 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/microhttpd/digestauth.c b/src/microhttpd/digestauth.c
index 0cd0219f..9a07a596 100644
--- a/src/microhttpd/digestauth.c
+++ b/src/microhttpd/digestauth.c
@@ -1198,7 +1198,7 @@ MHD_digest_auth_check (struct MHD_Connection *connection,
     da.sessionkey = skey.sha256;                        \
     da.init = &sha256_init;                             \
     da.update = &sha256_update;                         \
-    da.digest = &sha256_digest;                         \
+    da.digest = &sha256_finish;                         \
     break;                                              \
   }
 
diff --git a/src/microhttpd/sha256.c b/src/microhttpd/sha256.c
index 2c3c057d..e3989d57 100644
--- a/src/microhttpd/sha256.c
+++ b/src/microhttpd/sha256.c
@@ -250,6 +250,9 @@ sha256_update (void *ctx_,
 
   mhd_assert((data != NULL) || (length == 0));
 
+  if (0 == length)
+    return; /* Do nothing */
+
   /* Note: (count & (SHA256_BLOCK_SIZE-1))
            equal (count % SHA256_BLOCK_SIZE) for this block size. */
   bytes_have = (unsigned)(ctx->count & (SHA256_BLOCK_SIZE-1));
diff --git a/src/microhttpd/sha256.h b/src/microhttpd/sha256.h
index 8e6a9414..7926e7ea 100644
--- a/src/microhttpd/sha256.h
+++ b/src/microhttpd/sha256.h
@@ -90,6 +90,4 @@ void
 sha256_finish (void *ctx_,
                uint8_t digest[SHA256_DIGEST_SIZE]);
 
-#define sha256_digest sha256_finish
-
 #endif /* MHD_SHA256_H */
diff --git a/src/microhttpd/test_sha256.c b/src/microhttpd/test_sha256.c
index 50e119f8..b30ebc22 100644
--- a/src/microhttpd/test_sha256.c
+++ b/src/microhttpd/test_sha256.c
@@ -255,7 +255,7 @@ int test1_str(void)
 
       sha256_init (&ctx);
       sha256_update (&ctx, (const uint8_t*)data_units1[i].str_l.str, 
data_units1[i].str_l.len);
-      sha256_digest (&ctx, digest);
+      sha256_finish (&ctx, digest);
       num_failed += check_result (__FUNCTION__, i, digest,
                                   data_units1[i].digest);
     }
@@ -272,7 +272,7 @@ int test1_bin(void)
 
       sha256_init (&ctx);
       sha256_update (&ctx, data_units2[i].bin_l.bin, data_units2[i].bin_l.len);
-      sha256_digest (&ctx, digest);
+      sha256_finish (&ctx, digest);
       num_failed += check_result (__FUNCTION__, i, digest,
                                   data_units2[i].digest);
     }
@@ -292,7 +292,7 @@ int test2_str(void)
       sha256_init (&ctx);
       sha256_update (&ctx, (const uint8_t*)data_units1[i].str_l.str, part_s);
       sha256_update (&ctx, (const uint8_t*)data_units1[i].str_l.str + part_s, 
data_units1[i].str_l.len - part_s);
-      sha256_digest (&ctx, digest);
+      sha256_finish (&ctx, digest);
       num_failed += check_result (__FUNCTION__, i, digest,
                                   data_units1[i].digest);
     }
@@ -311,7 +311,7 @@ int test2_bin(void)
       sha256_init (&ctx);
       sha256_update (&ctx, data_units2[i].bin_l.bin, part_s);
       sha256_update (&ctx, data_units2[i].bin_l.bin + part_s, 
data_units2[i].bin_l.len - part_s);
-      sha256_digest (&ctx, digest);
+      sha256_finish (&ctx, digest);
       num_failed += check_result (__FUNCTION__, i, digest,
                                   data_units2[i].digest);
     }

-- 
To stop receiving notification emails like this one, please contact
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]