Fixed gcc warnings for the sha2 driver.

This commit is contained in:
Franck Joncourt 2013-01-28 21:47:57 +01:00
parent 1a8520d659
commit fcf9f43c5b

View File

@ -624,7 +624,7 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
*context->buffer = 0x80;
}
/* Set the bit count: */
*(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LEN] = context->bitcount;
memcpy(&(context->buffer[SHA256_SHORT_BLOCK_LEN]), &(context->bitcount), sizeof(sha2_word64));
/* Final transform: */
SHA256_Transform(context, (sha2_word32*)context->buffer);
@ -941,8 +941,8 @@ void SHA512_Last(SHA512_CTX* context) {
*context->buffer = 0x80;
}
/* Store the length of input data (in bits): */
*(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LEN] = context->bitcount[1];
*(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LEN+8] = context->bitcount[0];
memcpy(&(context->buffer[SHA512_SHORT_BLOCK_LEN]), &(context->bitcount[1]), sizeof(sha2_word64));
memcpy(&(context->buffer[SHA512_SHORT_BLOCK_LEN+8]), &(context->bitcount[0]), sizeof(sha2_word64));
/* Final transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);