From: Howard Chu Date: Wed, 10 Dec 2014 22:24:25 +0000 (+0000) Subject: ITS#8000 silence warnings X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=b8912c33baefaf05ac80e2108c87e98b344eb0c5;p=openldap ITS#8000 silence warnings --- diff --git a/contrib/slapd-modules/passwd/sha2/sha2.c b/contrib/slapd-modules/passwd/sha2/sha2.c index b0c551571b..0d2ba5708e 100644 --- a/contrib/slapd-modules/passwd/sha2/sha2.c +++ b/contrib/slapd-modules/passwd/sha2/sha2.c @@ -568,6 +568,7 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { sha2_word32 *d = (sha2_word32*)digest; + sha2_word64 *p; unsigned int usedspace; /* Sanity check: */ @@ -605,7 +606,8 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { *context->buffer = 0x80; } /* Set the bit count: */ - *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount; + p = (sha2_word64 *)&context->buffer[SHA256_SHORT_BLOCK_LENGTH]; + *p = context->bitcount; /* Final transform: */ SHA256_Transform(context, (sha2_word32*)context->buffer); @@ -889,6 +891,7 @@ void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { } void SHA512_Last(SHA512_CTX* context) { + sha2_word64 *p; unsigned int usedspace; usedspace = (context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH; @@ -922,8 +925,9 @@ void SHA512_Last(SHA512_CTX* context) { *context->buffer = 0x80; } /* Store the length of input data (in bits): */ - *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH] = context->bitcount[1]; - *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; + p = (sha2_word64 *)&context->buffer[SHA512_SHORT_BLOCK_LENGTH]; + p[0] = context->bitcount[1]; + p[1] = context->bitcount[0]; /* Final transform: */ SHA512_Transform(context, (sha2_word64*)context->buffer);