summaryrefslogtreecommitdiff
path: root/digest-libc.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2014-12-21 22:27:55 +0000
committerDamien Miller <djm@mindrot.org>2014-12-22 09:32:29 +1100
commit56d1c83cdd1ac76f1c6bd41e01e80dad834f3994 (patch)
tree700a872e702c686c1815bb1049eb93e88079b598 /digest-libc.c
parent058f839fe15c51be8b3a844a76ab9a8db550be4f (diff)
upstream commit
Add FingerprintHash option to control algorithm used for key fingerprints. Default changes from MD5 to SHA256 and format from hex to base64. Feedback and ok naddy@ markus@
Diffstat (limited to 'digest-libc.c')
-rw-r--r--digest-libc.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/digest-libc.c b/digest-libc.c
index 1b4423a05..169ded075 100644
--- a/digest-libc.c
+++ b/digest-libc.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: digest-libc.c,v 1.3 2014/06/24 01:13:21 djm Exp $ */ 1/* $OpenBSD: digest-libc.c,v 1.4 2014/12/21 22:27:56 djm Exp $ */
2/* 2/*
3 * Copyright (c) 2013 Damien Miller <djm@mindrot.org> 3 * Copyright (c) 2013 Damien Miller <djm@mindrot.org>
4 * Copyright (c) 2014 Markus Friedl. All rights reserved. 4 * Copyright (c) 2014 Markus Friedl. All rights reserved.
@@ -126,6 +126,26 @@ ssh_digest_by_alg(int alg)
126 return &(digests[alg]); 126 return &(digests[alg]);
127} 127}
128 128
129int
130ssh_digest_alg_by_name(const char *name)
131{
132 int alg;
133
134 for (alg = 0; alg < SSH_DIGEST_MAX; alg++) {
135 if (strcasecmp(name, digests[alg].name) == 0)
136 return digests[alg].id;
137 }
138 return -1;
139}
140
141const char *
142ssh_digest_alg_name(int alg)
143{
144 const struct ssh_digest *digest = ssh_digest_by_alg(alg);
145
146 return digest == NULL ? NULL : digest->name;
147}
148
129size_t 149size_t
130ssh_digest_bytes(int alg) 150ssh_digest_bytes(int alg)
131{ 151{