summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2009-04-15 00:55:53 +0000
committerDamien Miller <djm@cvs.openbsd.org>2009-04-15 00:55:53 +0000
commitbf10149e754acc94df24ab0d1024ce9e56dd6dc5 (patch)
tree81cd4e41f8c22fd1b3263336a64fdfa29bdb3b6a
parent2b9104bcbeb1138b0e702e8aafc3b4aa5e775a99 (diff)
allow building without SHA384 and SHA512 (i.e. SHA256 only) with
-DSHA256_ONLY in order to save space; ok deraadt@
-rw-r--r--lib/libc/hash/sha2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/hash/sha2.c b/lib/libc/hash/sha2.c
index 3494d5c6ed6..c6d2d46b17b 100644
--- a/lib/libc/hash/sha2.c
+++ b/lib/libc/hash/sha2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sha2.c,v 1.12 2008/09/06 12:00:19 djm Exp $ */
+/* $OpenBSD: sha2.c,v 1.13 2009/04/15 00:55:52 djm Exp $ */
/*
* FILE: sha2.c
@@ -201,6 +201,7 @@ const static u_int32_t sha256_initial_hash_value[8] = {
0x5be0cd19UL
};
+#ifndef SHA256_ONLY
/* Hash constant words K for SHA-384 and SHA-512: */
const static u_int64_t K512[80] = {
0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL,
@@ -268,7 +269,7 @@ const static u_int64_t sha512_initial_hash_value[8] = {
0x1f83d9abfb41bd6bULL,
0x5be0cd19137e2179ULL
};
-
+#endif /* SHA256_ONLY */
/*** SHA-256: *********************************************************/
void
@@ -550,6 +551,7 @@ SHA256Final(u_int8_t digest[SHA256_DIGEST_LENGTH], SHA2_CTX *context)
}
+#ifndef SHA256_ONLY
/*** SHA-512: *********************************************************/
void
SHA512Init(SHA2_CTX *context)
@@ -868,3 +870,4 @@ SHA384Final(u_int8_t digest[SHA384_DIGEST_LENGTH], SHA2_CTX *context)
/* Zero out state data */
memset(context, 0, sizeof(*context));
}
+#endif /* SHA256_ONLY */