From 5d9ee8b07a6e1a66fe377296378b504b33e57156 Mon Sep 17 00:00:00 2001 From: Richard Aas Date: Fri, 11 Apr 2014 11:40:46 +0000 Subject: [PATCH] sha: allow any signedness in input data --- include/re_sha.h | 2 +- src/sha/sha1.c | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/include/re_sha.h b/include/re_sha.h index c6a8fca..8fdd632 100644 --- a/include/re_sha.h +++ b/include/re_sha.h @@ -28,7 +28,7 @@ typedef SHA1_CTX SHA_CTX; #define SHA_DIGEST_LENGTH SHA1_DIGEST_SIZE void SHA1_Init(SHA1_CTX* context); -void SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len); +void SHA1_Update(SHA1_CTX* context, const void *p, size_t len); void SHA1_Final(uint8_t digest[SHA1_DIGEST_SIZE], SHA1_CTX* context); #endif diff --git a/src/sha/sha1.c b/src/sha/sha1.c index 53556f8..7395a02 100644 --- a/src/sha/sha1.c +++ b/src/sha/sha1.c @@ -207,11 +207,12 @@ void SHA1_Init(SHA1_CTX* context) * Run your data through this * * @param context SHA1-Context - * @param data Buffer to run SHA1 on + * @param p Buffer to run SHA1 on * @param len Number of bytes */ -void SHA1_Update(SHA1_CTX* context, const uint8_t* data, const size_t len) +void SHA1_Update(SHA1_CTX* context, const void *p, size_t len) { + const uint8_t* data = p; size_t i, j; j = (context->count[0] >> 3) & 63;