summaryrefslogtreecommitdiff
path: root/digest-libc.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2015-01-15 02:21:31 +1100
committerDamien Miller <djm@mindrot.org>2015-01-15 02:28:36 +1100
commit72ef7c148c42db7d5632a29f137f8b87b579f2d9 (patch)
tree47954a387f4260cc8b1e0ff33bbbaf22fd6f11fc /digest-libc.c
parent4f38c61c68ae7e3f9ee4b3c38bc86cd39f65ece9 (diff)
support --without-openssl at configure time
Disables and removes dependency on OpenSSL. Many features don't work and the set of crypto options is greatly restricted. This will only work on system with native arc4random or /dev/urandom. Considered highly experimental for now.
Diffstat (limited to 'digest-libc.c')
-rw-r--r--digest-libc.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/digest-libc.c b/digest-libc.c
index 169ded075..a216e784e 100644
--- a/digest-libc.c
+++ b/digest-libc.c
@@ -18,15 +18,19 @@
18 18
19#include "includes.h" 19#include "includes.h"
20 20
21#ifndef WITH_OPENSSL
22
21#include <sys/types.h> 23#include <sys/types.h>
22#include <limits.h> 24#include <limits.h>
23#include <stdlib.h> 25#include <stdlib.h>
24#include <string.h> 26#include <string.h>
25 27
28#if 0
26#include <md5.h> 29#include <md5.h>
27#include <rmd160.h> 30#include <rmd160.h>
28#include <sha1.h> 31#include <sha1.h>
29#include <sha2.h> 32#include <sha2.h>
33#endif
30 34
31#include "ssherr.h" 35#include "ssherr.h"
32#include "sshbuf.h" 36#include "sshbuf.h"
@@ -89,30 +93,30 @@ const struct ssh_digest digests[SSH_DIGEST_MAX] = {
89 "SHA256", 93 "SHA256",
90 SHA256_BLOCK_LENGTH, 94 SHA256_BLOCK_LENGTH,
91 SHA256_DIGEST_LENGTH, 95 SHA256_DIGEST_LENGTH,
92 sizeof(SHA2_CTX), 96 sizeof(SHA256_CTX),
93 (md_init_fn *) SHA256Init, 97 (md_init_fn *) SHA256_Init,
94 (md_update_fn *) SHA256Update, 98 (md_update_fn *) SHA256_Update,
95 (md_final_fn *) SHA256Final 99 (md_final_fn *) SHA256_Final
96 }, 100 },
97 { 101 {
98 SSH_DIGEST_SHA384, 102 SSH_DIGEST_SHA384,
99 "SHA384", 103 "SHA384",
100 SHA384_BLOCK_LENGTH, 104 SHA384_BLOCK_LENGTH,
101 SHA384_DIGEST_LENGTH, 105 SHA384_DIGEST_LENGTH,
102 sizeof(SHA2_CTX), 106 sizeof(SHA384_CTX),
103 (md_init_fn *) SHA384Init, 107 (md_init_fn *) SHA384_Init,
104 (md_update_fn *) SHA384Update, 108 (md_update_fn *) SHA384_Update,
105 (md_final_fn *) SHA384Final 109 (md_final_fn *) SHA384_Final
106 }, 110 },
107 { 111 {
108 SSH_DIGEST_SHA512, 112 SSH_DIGEST_SHA512,
109 "SHA512", 113 "SHA512",
110 SHA512_BLOCK_LENGTH, 114 SHA512_BLOCK_LENGTH,
111 SHA512_DIGEST_LENGTH, 115 SHA512_DIGEST_LENGTH,
112 sizeof(SHA2_CTX), 116 sizeof(SHA512_CTX),
113 (md_init_fn *) SHA512Init, 117 (md_init_fn *) SHA512_Init,
114 (md_update_fn *) SHA512Update, 118 (md_update_fn *) SHA512_Update,
115 (md_final_fn *) SHA512Final 119 (md_final_fn *) SHA512_Final
116 } 120 }
117}; 121};
118 122
@@ -257,3 +261,4 @@ ssh_digest_buffer(int alg, const struct sshbuf *b, u_char *d, size_t dlen)
257{ 261{
258 return ssh_digest_memory(alg, sshbuf_ptr(b), sshbuf_len(b), d, dlen); 262 return ssh_digest_memory(alg, sshbuf_ptr(b), sshbuf_len(b), d, dlen);
259} 263}
264#endif /* !WITH_OPENSSL */