Fix the comments for |SHA[256|384|512]_Transform|.

Change-Id: I6d552d26b3d72f6fffdc4d4d9fc3b5d82fb4e8bb
Reviewed-on: https://boringssl-review.googlesource.com/9010
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
CQ-Verified: CQ bot account: commit-bot@chromium.org <commit-bot@chromium.org>
This commit is contained in:
Adam Langley 2016-07-28 14:16:45 -07:00 committed by CQ bot account: commit-bot@chromium.org
parent 49054544d3
commit 5a8d48ee8c
2 changed files with 19 additions and 15 deletions

View File

@ -164,14 +164,14 @@ int SHA384_Update(SHA512_CTX *sha, const void *data, size_t len) {
return SHA512_Update(sha, data, len); return SHA512_Update(sha, data, len);
} }
void SHA512_Transform(SHA512_CTX *c, const uint8_t *data) { void SHA512_Transform(SHA512_CTX *c, const uint8_t *block) {
#ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA #ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA
if ((size_t)data % sizeof(c->u.d[0]) != 0) { if ((size_t)block % sizeof(c->u.d[0]) != 0) {
memcpy(c->u.p, data, sizeof(c->u.p)); memcpy(c->u.p, block, sizeof(c->u.p));
data = c->u.p; block = c->u.p;
} }
#endif #endif
sha512_block_data_order(c->h, (uint64_t *)data, 1); sha512_block_data_order(c->h, (uint64_t *)block, 1);
} }
int SHA512_Update(SHA512_CTX *c, const void *in_data, size_t len) { int SHA512_Update(SHA512_CTX *c, const void *in_data, size_t len) {

View File

@ -94,7 +94,8 @@ OPENSSL_EXPORT int SHA1_Final(uint8_t *md, SHA_CTX *sha);
OPENSSL_EXPORT uint8_t *SHA1(const uint8_t *data, size_t len, uint8_t *out); OPENSSL_EXPORT uint8_t *SHA1(const uint8_t *data, size_t len, uint8_t *out);
/* SHA1_Transform is a low-level function that performs a single, SHA-1 block /* SHA1_Transform is a low-level function that performs a single, SHA-1 block
* transformation using the state from |sha| and 64 bytes from |block|. */ * transformation using the state from |sha| and |SHA_CBLOCK| bytes from
* |block|. */
OPENSSL_EXPORT void SHA1_Transform(SHA_CTX *sha, const uint8_t *block); OPENSSL_EXPORT void SHA1_Transform(SHA_CTX *sha, const uint8_t *block);
struct sha_state_st { struct sha_state_st {
@ -169,9 +170,10 @@ OPENSSL_EXPORT int SHA256_Final(uint8_t *md, SHA256_CTX *sha);
* |out|. */ * |out|. */
OPENSSL_EXPORT uint8_t *SHA256(const uint8_t *data, size_t len, uint8_t *out); OPENSSL_EXPORT uint8_t *SHA256(const uint8_t *data, size_t len, uint8_t *out);
/* SHA256_Transform is a low-level function that performs a single, SHA-1 block /* SHA256_Transform is a low-level function that performs a single, SHA-256
* transformation using the state from |sha| and 64 bytes from |block|. */ * block transformation using the state from |sha| and |SHA256_CBLOCK| bytes
OPENSSL_EXPORT void SHA256_Transform(SHA256_CTX *sha, const uint8_t *data); * from |block|. */
OPENSSL_EXPORT void SHA256_Transform(SHA256_CTX *sha, const uint8_t *block);
struct sha256_state_st { struct sha256_state_st {
uint32_t h[8]; uint32_t h[8];
@ -205,9 +207,10 @@ OPENSSL_EXPORT int SHA384_Final(uint8_t *md, SHA512_CTX *sha);
* |out|. */ * |out|. */
OPENSSL_EXPORT uint8_t *SHA384(const uint8_t *data, size_t len, uint8_t *out); OPENSSL_EXPORT uint8_t *SHA384(const uint8_t *data, size_t len, uint8_t *out);
/* SHA384_Transform is a low-level function that performs a single, SHA-1 block /* SHA384_Transform is a low-level function that performs a single, SHA-384
* transformation using the state from |sha| and 64 bytes from |block|. */ * block transformation using the state from |sha| and |SHA384_CBLOCK| bytes
OPENSSL_EXPORT void SHA384_Transform(SHA512_CTX *sha, const uint8_t *data); * from |block|. */
OPENSSL_EXPORT void SHA384_Transform(SHA512_CTX *sha, const uint8_t *block);
/* SHA-512. */ /* SHA-512. */
@ -234,9 +237,10 @@ OPENSSL_EXPORT int SHA512_Final(uint8_t *md, SHA512_CTX *sha);
* |out|. */ * |out|. */
OPENSSL_EXPORT uint8_t *SHA512(const uint8_t *data, size_t len, uint8_t *out); OPENSSL_EXPORT uint8_t *SHA512(const uint8_t *data, size_t len, uint8_t *out);
/* SHA512_Transform is a low-level function that performs a single, SHA-1 block /* SHA512_Transform is a low-level function that performs a single, SHA-512
* transformation using the state from |sha| and 64 bytes from |block|. */ * block transformation using the state from |sha| and |SHA512_CBLOCK| bytes
OPENSSL_EXPORT void SHA512_Transform(SHA512_CTX *sha, const uint8_t *data); * from |block|. */
OPENSSL_EXPORT void SHA512_Transform(SHA512_CTX *sha, const uint8_t *block);
struct sha512_state_st { struct sha512_state_st {
uint64_t h[8]; uint64_t h[8];