[key.c]
     style+cleanup
This commit is contained in:
Ben Lindstrom 2001-03-12 02:59:31 +00:00
Родитель bee3f2224c
Коммит f0b4853d86
2 изменённых файлов: 19 добавлений и 18 удалений

Просмотреть файл

@ -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 $

31
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);