Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions libsql-ffi/bundled/sqlean/crypto/sha2.c
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ int sha256_final(SHA256_CTX* context, sha2_byte digest[SHA256_DIGEST_LENGTH]) {
*context->buffer = 0x80;
}
/* Set the bit count: */
*(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount;
MEMCPY_BCOPY(&context->buffer[SHA256_SHORT_BLOCK_LENGTH], &context->bitcount, sizeof(context->bitcount));

/* Final transform: */
SHA256_Transform(context, (sha2_word32*)context->buffer);
Expand Down Expand Up @@ -854,8 +854,8 @@ static 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];
MEMCPY_BCOPY(&context->buffer[SHA512_SHORT_BLOCK_LENGTH], &context->bitcount[1], sizeof(context->bitcount[1]));
MEMCPY_BCOPY(&context->buffer[SHA512_SHORT_BLOCK_LENGTH + 8], &context->bitcount[0], sizeof(context->bitcount[0]));

/* Final transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);
Expand Down
Loading