summaryrefslogtreecommitdiffstats
path: root/crypto/sha
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2013-12-18 21:27:35 +0100
committerAndy Polyakov <appro@openssl.org>2013-12-18 22:56:00 +0100
commite34b7e99fde6ffd6db6a2ff5cdf0857bb630b441 (patch)
treeb97b232ba4157594ebe1c6fe4c23ffc93ec380fd /crypto/sha
parenta32ba49352258067cdb6ae796481557614153c57 (diff)
sha512.c: fullfull implicit API contract in SHA512_Transform.
SHA512_Transform was initially added rather as tribute to tradition than for practucal reasons. But use was recently found in ssl/s3_cbc.c and it turned to be problematic on platforms that don't tolerate misasligned references to memory and lack assembly subroutine. (cherry picked from commit cdd1acd788020d2c525331da1712ada778f1373c)
Diffstat (limited to 'crypto/sha')
-rw-r--r--crypto/sha/sha512.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/crypto/sha/sha512.c b/crypto/sha/sha512.c
index 6b21a7aa94..9cda2172ed 100644
--- a/crypto/sha/sha512.c
+++ b/crypto/sha/sha512.c
@@ -233,7 +233,14 @@ int SHA384_Update (SHA512_CTX *c, const void *data, size_t len)
{ return SHA512_Update (c,data,len); }
void SHA512_Transform (SHA512_CTX *c, const unsigned char *data)
-{ sha512_block_data_order (c,data,1); }
+ {
+#ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA
+ if ((size_t)data%sizeof(c->u.d[0]) != 0)
+ memcpy(c->u.p,data,sizeof(c->u.p)),
+ data = c->u.p;
+#endif
+ sha512_block_data_order (c,data,1);
+ }
unsigned char *SHA384(const unsigned char *d, size_t n, unsigned char *md)
{