summaryrefslogtreecommitdiff
path: root/digest-libc.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2019-07-23 21:51:22 +1000
committerDarren Tucker <dtucker@dtucker.net>2019-07-23 22:06:24 +1000
commit11cba2a4523fda447e2554ea457484655bedc831 (patch)
tree93ec07a9e0db784b0a729eb339d74a5a2c40ea9d /digest-libc.c
parent09159594a3bbd363429ee6fafde57ce77986dd7c (diff)
Re-apply portability changes to current sha2.{c,h}.
Rather than attempt to apply 14 years' worth of changes to OpenBSD's sha2 I imported the current versions directly then re-applied the portability changes. This also allowed re-syncing digest-libc.c against upstream.
Diffstat (limited to 'digest-libc.c')
-rw-r--r--digest-libc.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/digest-libc.c b/digest-libc.c
index c2b0b2403..12737e5d5 100644
--- a/digest-libc.c
+++ b/digest-libc.c
@@ -28,7 +28,11 @@
28#if 0 28#if 0
29#include <md5.h> 29#include <md5.h>
30#include <rmd160.h> 30#include <rmd160.h>
31#endif
32#ifdef HAVE_SHA1_H
31#include <sha1.h> 33#include <sha1.h>
34#endif
35#ifdef HAVE_SHA2_H
32#include <sha2.h> 36#include <sha2.h>
33#endif 37#endif
34 38
@@ -83,30 +87,30 @@ const struct ssh_digest digests[SSH_DIGEST_MAX] = {
83 "SHA256", 87 "SHA256",
84 SHA256_BLOCK_LENGTH, 88 SHA256_BLOCK_LENGTH,
85 SHA256_DIGEST_LENGTH, 89 SHA256_DIGEST_LENGTH,
86 sizeof(SHA256_CTX), 90 sizeof(SHA2_CTX),
87 (md_init_fn *) SHA256_Init, 91 (md_init_fn *) SHA256Init,
88 (md_update_fn *) SHA256_Update, 92 (md_update_fn *) SHA256Update,
89 (md_final_fn *) SHA256_Final 93 (md_final_fn *) SHA256Final
90 }, 94 },
91 { 95 {
92 SSH_DIGEST_SHA384, 96 SSH_DIGEST_SHA384,
93 "SHA384", 97 "SHA384",
94 SHA384_BLOCK_LENGTH, 98 SHA384_BLOCK_LENGTH,
95 SHA384_DIGEST_LENGTH, 99 SHA384_DIGEST_LENGTH,
96 sizeof(SHA384_CTX), 100 sizeof(SHA2_CTX),
97 (md_init_fn *) SHA384_Init, 101 (md_init_fn *) SHA384Init,
98 (md_update_fn *) SHA384_Update, 102 (md_update_fn *) SHA384Update,
99 (md_final_fn *) SHA384_Final 103 (md_final_fn *) SHA384Final
100 }, 104 },
101 { 105 {
102 SSH_DIGEST_SHA512, 106 SSH_DIGEST_SHA512,
103 "SHA512", 107 "SHA512",
104 SHA512_BLOCK_LENGTH, 108 SHA512_BLOCK_LENGTH,
105 SHA512_DIGEST_LENGTH, 109 SHA512_DIGEST_LENGTH,
106 sizeof(SHA512_CTX), 110 sizeof(SHA2_CTX),
107 (md_init_fn *) SHA512_Init, 111 (md_init_fn *) SHA512Init,
108 (md_update_fn *) SHA512_Update, 112 (md_update_fn *) SHA512Update,
109 (md_final_fn *) SHA512_Final 113 (md_final_fn *) SHA512Final
110 } 114 }
111}; 115};
112 116