* apt-pkg/contrib/sha2_internal.cc:
authorDavid Kalnischkies <kalnischkies@gmail.com>
Sun, 30 Oct 2011 19:17:09 +0000 (14:17 -0500)
committerDavid Kalnischkies <kalnischkies@gmail.com>
Sun, 30 Oct 2011 19:17:09 +0000 (14:17 -0500)
  - use a pointer-union to peace gcc strict-aliasing warning

apt-pkg/contrib/sha2_internal.cc
debian/changelog

index ff995cd..6d27e8f 100644 (file)
@@ -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);
index 406f1e8..03e5116 100644 (file)
@@ -4,8 +4,10 @@ apt (0.8.16~exp8) experimental; urgency=low
   * apt-pkg/packagemanager.cc:
     - do not fail on unpacked packages in SmartUnPack, just don't
       shedule them for unpack, but do all checks and configure them
+  * apt-pkg/contrib/sha2_internal.cc:
+    - use a pointer-union to peace gcc strict-aliasing warning
 
- -- David Kalnischkies <kalnischkies@gmail.com>  Mon, 17 Oct 2011 11:21:21 +0200
+ -- David Kalnischkies <kalnischkies@gmail.com>  Sun, 30 Oct 2011 14:15:53 -0500
 
 apt (0.8.16~exp7) experimental; urgency=low