sha: allow any signedness in input data

This commit is contained in:
Richard Aas 2014-04-11 11:40:46 +00:00
parent 218d7c339d
commit 5d9ee8b07a
2 changed files with 4 additions and 3 deletions

View file

@ -28,7 +28,7 @@ typedef SHA1_CTX SHA_CTX;
#define SHA_DIGEST_LENGTH SHA1_DIGEST_SIZE #define SHA_DIGEST_LENGTH SHA1_DIGEST_SIZE
void SHA1_Init(SHA1_CTX* context); 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); void SHA1_Final(uint8_t digest[SHA1_DIGEST_SIZE], SHA1_CTX* context);
#endif #endif

View file

@ -207,11 +207,12 @@ void SHA1_Init(SHA1_CTX* context)
* Run your data through this * Run your data through this
* *
* @param context SHA1-Context * @param context SHA1-Context
* @param data Buffer to run SHA1 on * @param p Buffer to run SHA1 on
* @param len Number of bytes * @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; size_t i, j;
j = (context->count[0] >> 3) & 63; j = (context->count[0] >> 3) & 63;