diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2012-04-20 09:53:24 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2012-04-20 09:53:24 +0200 |
commit | 5149632eb5af0831a8728e8bb5d5c483d6e3f147 (patch) | |
tree | 17212422b57862650249948f4934e2227fce4b83 /apt-pkg/contrib/sha2_internal.cc | |
parent | 858fd39f6adea6353e9367759cf48ae2b439ffcc (diff) |
* apt-pkg/contrib/sha2_internal.cc:
- do not use the input data directly but memcpy it instead as
it could be unaligned as in the http-transport which causes
a sigbus error on sparc (Closes: #669061)
Diffstat (limited to 'apt-pkg/contrib/sha2_internal.cc')
-rw-r--r-- | apt-pkg/contrib/sha2_internal.cc | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/apt-pkg/contrib/sha2_internal.cc b/apt-pkg/contrib/sha2_internal.cc index 6d27e8f2b..83b5a98d3 100644 --- a/apt-pkg/contrib/sha2_internal.cc +++ b/apt-pkg/contrib/sha2_internal.cc @@ -552,7 +552,9 @@ void SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { } while (len >= SHA256_BLOCK_LENGTH) { /* Process as many complete blocks as we can */ - SHA256_Transform(context, (sha2_word32*)data); + sha2_byte buffer[SHA256_BLOCK_LENGTH]; + MEMCPY_BCOPY(buffer, data, SHA256_BLOCK_LENGTH); + SHA256_Transform(context, (sha2_word32*)buffer); context->bitcount += SHA256_BLOCK_LENGTH << 3; len -= SHA256_BLOCK_LENGTH; data += SHA256_BLOCK_LENGTH; @@ -879,7 +881,9 @@ void SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { } while (len >= SHA512_BLOCK_LENGTH) { /* Process as many complete blocks as we can */ - SHA512_Transform(context, (sha2_word64*)data); + sha2_byte buffer[SHA512_BLOCK_LENGTH]; + MEMCPY_BCOPY(buffer, data, SHA512_BLOCK_LENGTH); + SHA512_Transform(context, (sha2_word64*)buffer); ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3); len -= SHA512_BLOCK_LENGTH; data += SHA512_BLOCK_LENGTH; |