path: root/src/crypto/sha1-internal.c
diff options
authorJouni Malinen <j@w1.fi>2009-08-16 11:06:00 (GMT)
committerJouni Malinen <j@w1.fi>2009-08-16 11:06:00 (GMT)
commit0a5d68aba50c385e316a30d834d5b6174a4041d2 (patch)
treeef28fcecb0dbcacf5d430c4ac187ea6174c876aa /src/crypto/sha1-internal.c
parente1ffdfc18be9027b5ff9ae254f92b6255930ac71 (diff)
Make hash functions return error value
Some crypto libraries can return in these functions (e.g., if a specific hash function is disabled), so we better provide the caller a chance to check whether the call failed. The return values are not yet used anywhere, but they will be needed for future changes.
Diffstat (limited to 'src/crypto/sha1-internal.c')
1 files changed, 3 insertions, 2 deletions
diff --git a/src/crypto/sha1-internal.c b/src/crypto/sha1-internal.c
index 1f66e92..dfe8940 100644
--- a/src/crypto/sha1-internal.c
+++ b/src/crypto/sha1-internal.c
@@ -37,9 +37,9 @@ void SHA1Transform(u32 state[5], const unsigned char buffer[64]);
* @addr: Pointers to the data areas
* @len: Lengths of the data blocks
* @mac: Buffer for the hash
+ * Returns: 0 on success, -1 of failure
-void sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len,
- u8 *mac)
+int sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len, u8 *mac)
SHA1_CTX ctx;
size_t i;
@@ -48,6 +48,7 @@ void sha1_vector(size_t num_elem, const u8 *addr[], const size_t *len,
for (i = 0; i < num_elem; i++)
SHA1Update(&ctx, addr[i], len[i]);
SHA1Final(mac, &ctx);
+ return 0;