summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-03-12 02:59:31 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-03-12 02:59:31 +0000
commitf0b4853d867cd3f43131e9b48124eaa7ebfab6d0 (patch)
tree651561f4461bfc3bc258e60e9bcdc0090ad48768
parentbee3f2224c75adfaa2276f6cc83d2f25a0a5af77 (diff)
- markus@cvs.openbsd.org 2001/03/11 18:29:51
[key.c] style+cleanup
-rw-r--r--ChangeLog6
-rw-r--r--key.c31
2 files changed, 19 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index bbb12985..fbf2d6cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -21,6 +21,10 @@
test if snprintf() supports %ll
add /dev to search path for PRNGD/EGD socket
fix my mistake in USER_PATH test program
+ - OpenBSD CVS Sync
+ - markus@cvs.openbsd.org 2001/03/11 18:29:51
+ [key.c]
+ style+cleanup
20010311
- OpenBSD CVS Sync
@@ -4514,4 +4518,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.945 2001/03/12 01:32:12 tim Exp $
+$Id: ChangeLog,v 1.946 2001/03/12 02:59:31 mouring Exp $
diff --git a/key.c b/key.c
index 17a6c787..d05c86ae 100644
--- a/key.c
+++ b/key.c
@@ -32,7 +32,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "includes.h"
-RCSID("$OpenBSD: key.c,v 1.20 2001/03/11 15:13:09 jakob Exp $");
+RCSID("$OpenBSD: key.c,v 1.21 2001/03/11 18:29:51 markus Exp $");
#include <openssl/evp.h>
@@ -156,6 +156,8 @@ key_equal(Key *a, Key *b)
u_char*
key_fingerprint_raw(Key *k, enum fp_type dgst_type, size_t *dgst_raw_length)
{
+ EVP_MD *md = NULL;
+ EVP_MD_CTX ctx;
u_char *blob = NULL;
u_char *retval = NULL;
int len = 0;
@@ -163,6 +165,17 @@ key_fingerprint_raw(Key *k, enum fp_type dgst_type, size_t *dgst_raw_length)
*dgst_raw_length = 0;
+ switch (dgst_type) {
+ case SSH_FP_MD5:
+ md = EVP_md5();
+ break;
+ case SSH_FP_SHA1:
+ md = EVP_sha1();
+ break;
+ default:
+ fatal("key_fingerprint_raw: bad digest type %d",
+ dgst_type);
+ }
switch (k->type) {
case KEY_RSA1:
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)
break;
}
if (blob != NULL) {
- EVP_MD *md = NULL;
- EVP_MD_CTX ctx;
-
retval = xmalloc(EVP_MAX_MD_SIZE);
-
- switch (dgst_type) {
- case SSH_FP_MD5:
- md = EVP_md5();
- break;
- case SSH_FP_SHA1:
- md = EVP_sha1();
- break;
- default:
- fatal("key_fingerprint_raw: bad digest type %d",
- dgst_type);
- }
-
EVP_DigestInit(&ctx, md);
EVP_DigestUpdate(&ctx, blob, len);
EVP_DigestFinal(&ctx, retval, NULL);