summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/sha2_internal.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-11-10 16:10:55 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2011-11-10 16:10:55 +0100
commit37adedc9d0b66eeae7efb88aebd08dfbc6e06f77 (patch)
treeb0769df88e2b6496f23e3d899aeb1c240a3488d9 /apt-pkg/contrib/sha2_internal.cc
parentcf4f17a9d87a36b20ef5afa2cb5145e466d8ad3b (diff)
parent04340db392f14e2610189db6f8787e10fbf3c6d0 (diff)
merged from lp:~donkult/apt/experimental
Diffstat (limited to 'apt-pkg/contrib/sha2_internal.cc')
-rw-r--r--apt-pkg/contrib/sha2_internal.cc16
1 files changed, 13 insertions, 3 deletions
diff --git a/apt-pkg/contrib/sha2_internal.cc b/apt-pkg/contrib/sha2_internal.cc
index ff995cdf2..6d27e8f2b 100644
--- a/apt-pkg/contrib/sha2_internal.cc
+++ b/apt-pkg/contrib/sha2_internal.cc
@@ -605,7 +605,12 @@ 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;
+ union {
+ sha2_byte* c;
+ sha2_word64* l;
+ } bitcount;
+ bitcount.c = &context->buffer[SHA256_SHORT_BLOCK_LENGTH];
+ *(bitcount.l) = context->bitcount;
/* Final transform: */
SHA256_Transform(context, (sha2_word32*)context->buffer);
@@ -922,8 +927,13 @@ 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];
+ union {
+ sha2_byte* c;
+ sha2_word64* l;
+ } bitcount;
+ bitcount.c = &context->buffer[SHA512_SHORT_BLOCK_LENGTH];
+ bitcount.l[0] = context->bitcount[1];
+ bitcount.l[1] = context->bitcount[0];
/* Final transform: */
SHA512_Transform(context, (sha2_word64*)context->buffer);