]> git.ozlabs.org Git - ccan/blobdiff - ccan/crypto/hmac_sha256/hmac_sha256.c
bytestring, crypto/hmac_sha256, darray, mem, tal: avoid mem* with NULL.
[ccan] / ccan / crypto / hmac_sha256 / hmac_sha256.c
index 0392afe5c1127134e61e48d864dffe94252aeaa8..2238f9dc8fffbd4ee049ec8c965e0c11aeef37e2 100644 (file)
@@ -35,7 +35,8 @@ void hmac_sha256_init(struct hmac_sha256_ctx *ctx,
         *  (e.g., if K is of length 20 bytes and B=64, then K will be
         *   appended with 44 zero bytes 0x00)
         */
-       memcpy(k_ipad, k, ksize);
+       if (ksize != 0)
+               memcpy(k_ipad, k, ksize);
        memset((char *)k_ipad + ksize, 0, HMAC_SHA256_BLOCKSIZE - ksize);
 
        /*