summaryrefslogtreecommitdiff
path: root/key.c
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 /key.c
parentbee3f2224c75adfaa2276f6cc83d2f25a0a5af77 (diff)
downloadopenssh-git-f0b4853d867cd3f43131e9b48124eaa7ebfab6d0.tar.gz
- markus@cvs.openbsd.org 2001/03/11 18:29:51
[key.c] style+cleanup
Diffstat (limited to 'key.c')
-rw-r--r--key.c31
1 files changed, 14 insertions, 17 deletions
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);