summaryrefslogtreecommitdiffstats
path: root/usr.bin/dig/lib/isc/sha1.c
diff options
context:
space:
mode:
authorflorian <florian@openbsd.org>2020-02-11 17:28:46 +0000
committerflorian <florian@openbsd.org>2020-02-11 17:28:46 +0000
commit49ac168bada985824eb1faba2382ce03527f26af (patch)
tree595d1f2350c50b4736483002b396f108fea9f9d9 /usr.bin/dig/lib/isc/sha1.c
parentRemove unused functionality from dst_api.c. (diff)
downloadwireguard-openbsd-49ac168bada985824eb1faba2382ce03527f26af.tar.xz
wireguard-openbsd-49ac168bada985824eb1faba2382ce03527f26af.zip
Pretty sure sha1 works most of the time, no need to check during
runtime.
Diffstat (limited to 'usr.bin/dig/lib/isc/sha1.c')
-rw-r--r--usr.bin/dig/lib/isc/sha1.c45
1 files changed, 2 insertions, 43 deletions
diff --git a/usr.bin/dig/lib/isc/sha1.c b/usr.bin/dig/lib/isc/sha1.c
index 0a3535124cf..2d9447c0c5a 100644
--- a/usr.bin/dig/lib/isc/sha1.c
+++ b/usr.bin/dig/lib/isc/sha1.c
@@ -14,10 +14,10 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: sha1.c,v 1.1 2020/02/07 09:58:54 florian Exp $ */
+/* $Id: sha1.c,v 1.2 2020/02/11 17:28:46 florian Exp $ */
/* $NetBSD: sha1.c,v 1.5 2000/01/22 22:19:14 mycroft Exp $ */
-/* $OpenBSD: sha1.c,v 1.1 2020/02/07 09:58:54 florian Exp $ */
+/* $OpenBSD: sha1.c,v 1.2 2020/02/11 17:28:46 florian Exp $ */
/*! \file
* SHA-1 in C
@@ -85,44 +85,3 @@ isc_sha1_final(isc_sha1_t *context, unsigned char *digest) {
EVP_MD_CTX_free(context->ctx);
context->ctx = NULL;
}
-
-/*
- * Check for SHA-1 support; if it does not work, raise a fatal error.
- *
- * Use "a" as the test vector.
- *
- * Standard use is testing false and result true.
- * Testing use is testing true and result false;
- */
-isc_boolean_t
-isc_sha1_check(isc_boolean_t testing) {
- isc_sha1_t ctx;
- unsigned char input = 'a';
- unsigned char digest[ISC_SHA1_DIGESTLENGTH];
- unsigned char expected[] = {
- 0x86, 0xf7, 0xe4, 0x37, 0xfa, 0xa5, 0xa7, 0xfc,
- 0xe1, 0x5d, 0x1d, 0xdc, 0xb9, 0xea, 0xea, 0xea,
- 0x37, 0x76, 0x67, 0xb8
- };
-
- INSIST(sizeof(expected) == ISC_SHA1_DIGESTLENGTH);
-
- /*
- * Introduce a fault for testing.
- */
- if (testing) {
- input ^= 0x01;
- }
-
- /*
- * These functions do not return anything; any failure will be fatal.
- */
- isc_sha1_init(&ctx);
- isc_sha1_update(&ctx, &input, 1U);
- isc_sha1_final(&ctx, digest);
-
- /*
- * Must return true in standard case, should return false for testing.
- */
- return (ISC_TF(memcmp(digest, expected, ISC_SHA1_DIGESTLENGTH) == 0));
-}