-/* $OpenBSD: test_file.c,v 1.1 2014/06/24 01:14:18 djm Exp $ */
+/* $OpenBSD: test_file.c,v 1.2 2014/12/22 02:15:52 djm Exp $ */
/*
* Regress test for sshkey.h key management API
*
#include "authfile.h"
#include "sshkey.h"
#include "sshbuf.h"
+#include "digest.h"
#include "common.h"
TEST_START("RSA1 key hex fingerprint");
buf = load_text_file("rsa1_1.fp");
- cp = sshkey_fingerprint(k1, SSH_FP_MD5, SSH_FP_HEX);
+ cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("RSA1 key bubblebabble fingerprint");
buf = load_text_file("rsa1_1.fp.bb");
- cp = sshkey_fingerprint(k1, SSH_FP_SHA1, SSH_FP_BUBBLEBABBLE);
+ cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA1, SSH_FP_BUBBLEBABBLE);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("RSA key hex fingerprint");
buf = load_text_file("rsa_1.fp");
- cp = sshkey_fingerprint(k1, SSH_FP_MD5, SSH_FP_HEX);
+ cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("RSA cert hex fingerprint");
buf = load_text_file("rsa_1-cert.fp");
- cp = sshkey_fingerprint(k2, SSH_FP_MD5, SSH_FP_HEX);
+ cp = sshkey_fingerprint(k2, SSH_DIGEST_MD5, SSH_FP_HEX);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("RSA key bubblebabble fingerprint");
buf = load_text_file("rsa_1.fp.bb");
- cp = sshkey_fingerprint(k1, SSH_FP_SHA1, SSH_FP_BUBBLEBABBLE);
+ cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA1, SSH_FP_BUBBLEBABBLE);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("DSA key hex fingerprint");
buf = load_text_file("dsa_1.fp");
- cp = sshkey_fingerprint(k1, SSH_FP_MD5, SSH_FP_HEX);
+ cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("DSA cert hex fingerprint");
buf = load_text_file("dsa_1-cert.fp");
- cp = sshkey_fingerprint(k2, SSH_FP_MD5, SSH_FP_HEX);
+ cp = sshkey_fingerprint(k2, SSH_DIGEST_MD5, SSH_FP_HEX);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("DSA key bubblebabble fingerprint");
buf = load_text_file("dsa_1.fp.bb");
- cp = sshkey_fingerprint(k1, SSH_FP_SHA1, SSH_FP_BUBBLEBABBLE);
+ cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA1, SSH_FP_BUBBLEBABBLE);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("ECDSA key hex fingerprint");
buf = load_text_file("ecdsa_1.fp");
- cp = sshkey_fingerprint(k1, SSH_FP_MD5, SSH_FP_HEX);
+ cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("ECDSA cert hex fingerprint");
buf = load_text_file("ecdsa_1-cert.fp");
- cp = sshkey_fingerprint(k2, SSH_FP_MD5, SSH_FP_HEX);
+ cp = sshkey_fingerprint(k2, SSH_DIGEST_MD5, SSH_FP_HEX);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("ECDSA key bubblebabble fingerprint");
buf = load_text_file("ecdsa_1.fp.bb");
- cp = sshkey_fingerprint(k1, SSH_FP_SHA1, SSH_FP_BUBBLEBABBLE);
+ cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA1, SSH_FP_BUBBLEBABBLE);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("Ed25519 key hex fingerprint");
buf = load_text_file("ed25519_1.fp");
- cp = sshkey_fingerprint(k1, SSH_FP_MD5, SSH_FP_HEX);
+ cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("Ed25519 cert hex fingerprint");
buf = load_text_file("ed25519_1-cert.fp");
- cp = sshkey_fingerprint(k2, SSH_FP_MD5, SSH_FP_HEX);
+ cp = sshkey_fingerprint(k2, SSH_DIGEST_MD5, SSH_FP_HEX);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);
TEST_START("Ed25519 key bubblebabble fingerprint");
buf = load_text_file("ed25519_1.fp.bb");
- cp = sshkey_fingerprint(k1, SSH_FP_SHA1, SSH_FP_BUBBLEBABBLE);
+ cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA1, SSH_FP_BUBBLEBABBLE);
ASSERT_PTR_NE(cp, NULL);
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
sshbuf_free(buf);