summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--key.c31
2 files changed, 19 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index bbb12985d..fbf2d6cde 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,10 @@
21 test if snprintf() supports %ll 21 test if snprintf() supports %ll
22 add /dev to search path for PRNGD/EGD socket 22 add /dev to search path for PRNGD/EGD socket
23 fix my mistake in USER_PATH test program 23 fix my mistake in USER_PATH test program
24 - OpenBSD CVS Sync
25 - markus@cvs.openbsd.org 2001/03/11 18:29:51
26 [key.c]
27 style+cleanup
24 28
2520010311 2920010311
26 - OpenBSD CVS Sync 30 - OpenBSD CVS Sync
@@ -4514,4 +4518,4 @@
4514 - Wrote replacements for strlcpy and mkdtemp 4518 - Wrote replacements for strlcpy and mkdtemp
4515 - Released 1.0pre1 4519 - Released 1.0pre1
4516 4520
4517$Id: ChangeLog,v 1.945 2001/03/12 01:32:12 tim Exp $ 4521$Id: ChangeLog,v 1.946 2001/03/12 02:59:31 mouring Exp $
diff --git a/key.c b/key.c
index 17a6c787d..d05c86ae7 100644
--- a/key.c
+++ b/key.c
@@ -32,7 +32,7 @@
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 */ 33 */
34#include "includes.h" 34#include "includes.h"
35RCSID("$OpenBSD: key.c,v 1.20 2001/03/11 15:13:09 jakob Exp $"); 35RCSID("$OpenBSD: key.c,v 1.21 2001/03/11 18:29:51 markus Exp $");
36 36
37#include <openssl/evp.h> 37#include <openssl/evp.h>
38 38
@@ -156,6 +156,8 @@ key_equal(Key *a, Key *b)
156u_char* 156u_char*
157key_fingerprint_raw(Key *k, enum fp_type dgst_type, size_t *dgst_raw_length) 157key_fingerprint_raw(Key *k, enum fp_type dgst_type, size_t *dgst_raw_length)
158{ 158{
159 EVP_MD *md = NULL;
160 EVP_MD_CTX ctx;
159 u_char *blob = NULL; 161 u_char *blob = NULL;
160 u_char *retval = NULL; 162 u_char *retval = NULL;
161 int len = 0; 163 int len = 0;
@@ -163,6 +165,17 @@ key_fingerprint_raw(Key *k, enum fp_type dgst_type, size_t *dgst_raw_length)
163 165
164 *dgst_raw_length = 0; 166 *dgst_raw_length = 0;
165 167
168 switch (dgst_type) {
169 case SSH_FP_MD5:
170 md = EVP_md5();
171 break;
172 case SSH_FP_SHA1:
173 md = EVP_sha1();
174 break;
175 default:
176 fatal("key_fingerprint_raw: bad digest type %d",
177 dgst_type);
178 }
166 switch (k->type) { 179 switch (k->type) {
167 case KEY_RSA1: 180 case KEY_RSA1:
168 nlen = BN_num_bytes(k->rsa->n); 181 nlen = BN_num_bytes(k->rsa->n);
@@ -184,23 +197,7 @@ key_fingerprint_raw(Key *k, enum fp_type dgst_type, size_t *dgst_raw_length)
184 break; 197 break;
185 } 198 }
186 if (blob != NULL) { 199 if (blob != NULL) {
187 EVP_MD *md = NULL;
188 EVP_MD_CTX ctx;
189
190 retval = xmalloc(EVP_MAX_MD_SIZE); 200 retval = xmalloc(EVP_MAX_MD_SIZE);
191
192 switch (dgst_type) {
193 case SSH_FP_MD5:
194 md = EVP_md5();
195 break;
196 case SSH_FP_SHA1:
197 md = EVP_sha1();
198 break;
199 default:
200 fatal("key_fingerprint_raw: bad digest type %d",
201 dgst_type);
202 }
203
204 EVP_DigestInit(&ctx, md); 201 EVP_DigestInit(&ctx, md);
205 EVP_DigestUpdate(&ctx, blob, len); 202 EVP_DigestUpdate(&ctx, blob, len);
206 EVP_DigestFinal(&ctx, retval, NULL); 203 EVP_DigestFinal(&ctx, retval, NULL);