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>
diff --git a/crypto/sha/sha512.c b/crypto/sha/sha512.c
index f473046..355011f 100644
--- a/crypto/sha/sha512.c
+++ b/crypto/sha/sha512.c
@@ -164,14 +164,14 @@
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
- if ((size_t)data % sizeof(c->u.d[0]) != 0) {
- memcpy(c->u.p, data, sizeof(c->u.p));
- data = c->u.p;
+ if ((size_t)block % sizeof(c->u.d[0]) != 0) {
+ memcpy(c->u.p, block, sizeof(c->u.p));
+ block = c->u.p;
}
#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) {
diff --git a/include/openssl/sha.h b/include/openssl/sha.h
index 48a52e8..2ddcb62 100644
--- a/include/openssl/sha.h
+++ b/include/openssl/sha.h
@@ -94,7 +94,8 @@
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
- * 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);
struct sha_state_st {
@@ -169,9 +170,10 @@
* |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
- * transformation using the state from |sha| and 64 bytes from |block|. */
-OPENSSL_EXPORT void SHA256_Transform(SHA256_CTX *sha, const uint8_t *data);
+/* SHA256_Transform is a low-level function that performs a single, SHA-256
+ * block transformation using the state from |sha| and |SHA256_CBLOCK| bytes
+ * from |block|. */
+OPENSSL_EXPORT void SHA256_Transform(SHA256_CTX *sha, const uint8_t *block);
struct sha256_state_st {
uint32_t h[8];
@@ -205,9 +207,10 @@
* |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
- * transformation using the state from |sha| and 64 bytes from |block|. */
-OPENSSL_EXPORT void SHA384_Transform(SHA512_CTX *sha, const uint8_t *data);
+/* SHA384_Transform is a low-level function that performs a single, SHA-384
+ * block transformation using the state from |sha| and |SHA384_CBLOCK| bytes
+ * from |block|. */
+OPENSSL_EXPORT void SHA384_Transform(SHA512_CTX *sha, const uint8_t *block);
/* SHA-512. */
@@ -234,9 +237,10 @@
* |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
- * transformation using the state from |sha| and 64 bytes from |block|. */
-OPENSSL_EXPORT void SHA512_Transform(SHA512_CTX *sha, const uint8_t *data);
+/* SHA512_Transform is a low-level function that performs a single, SHA-512
+ * block transformation using the state from |sha| and |SHA512_CBLOCK| bytes
+ * from |block|. */
+OPENSSL_EXPORT void SHA512_Transform(SHA512_CTX *sha, const uint8_t *block);
struct sha512_state_st {
uint64_t h[8];