hkdf_sha256: okm is a void *.
authorRusty Russell <rusty@rustcorp.com.au>
Mon, 5 Dec 2016 05:25:08 +0000 (15:55 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Mon, 5 Dec 2016 05:53:26 +0000 (16:23 +1030)
Making arbitrary bytes a uchar* is always a bit nasty for the caller.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
ccan/crypto/hkdf_sha256/hkdf_sha256.c
ccan/crypto/hkdf_sha256/hkdf_sha256.h

index 0f26485703270c87d51f60f0542e5472f405ac52..f36bf67ade03c4a24219bc9ef55fdb49696318fe 100644 (file)
@@ -4,7 +4,7 @@
 #include <assert.h>
 #include <string.h>
 
-void hkdf_sha256(unsigned char *okm, size_t okm_size,
+void hkdf_sha256(void *okm, size_t okm_size,
                 const void *s, size_t ssize,
                 const void *k, size_t ksize,
                 const void *info, size_t isize)
@@ -83,7 +83,7 @@ void hkdf_sha256(unsigned char *okm, size_t okm_size,
 
        while (okm_size > sizeof(t)) {
                memcpy(okm, &t, sizeof(t));
-               okm += sizeof(t);
+               okm = (char *)okm + sizeof(t);
                okm_size -= sizeof(t);
 
                c++;
index cb295027fd72e35497b0c6dfc395ea65479cfa96..cf95c5afd8e74809433300cf6f0d784775a8309f 100644 (file)
@@ -15,7 +15,7 @@
  * @info: pointer to info
  * @isize: the number of bytes pointed to by @info
  */
-void hkdf_sha256(unsigned char *okm, size_t okm_size,
+void hkdf_sha256(void *okm, size_t okm_size,
                 const void *s, size_t ssize,
                 const void *k, size_t ksize,
                 const void *info, size_t isize);