upstream commit
adapt tests to new minimum RSA size and default FP format Upstream-Regress-ID: a4b30afd174ce82b96df14eb49fb0b81398ffd0e
This commit is contained in:
parent
6a977a4b68
commit
7c8c174c69
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh
|
||||
# $OpenBSD: mktestdata.sh,v 1.4 2015/01/18 19:54:46 djm Exp $
|
||||
# $OpenBSD: mktestdata.sh,v 1.5 2015/07/07 14:53:30 markus Exp $
|
||||
|
||||
PW=mekmitasdigoat
|
||||
|
||||
|
@ -94,8 +94,8 @@ rm -f rsa1_1_pw rsa_1_pw dsa_1_pw ecdsa_1_pw ed25519_1_pw
|
|||
rm -f rsa_n_pw dsa_n_pw ecdsa_n_pw
|
||||
rm -f pw *.pub *.bn.* *.param.* *.fp *.fp.bb
|
||||
|
||||
ssh-keygen -t rsa1 -b 768 -C "RSA1 test key #1" -N "" -f rsa1_1
|
||||
ssh-keygen -t rsa -b 768 -C "RSA test key #1" -N "" -f rsa_1
|
||||
ssh-keygen -t rsa1 -b 1024 -C "RSA1 test key #1" -N "" -f rsa1_1
|
||||
ssh-keygen -t rsa -b 1024 -C "RSA test key #1" -N "" -f rsa_1
|
||||
ssh-keygen -t dsa -b 1024 -C "DSA test key #1" -N "" -f dsa_1
|
||||
ssh-keygen -t ecdsa -b 256 -C "ECDSA test key #1" -N "" -f ecdsa_1
|
||||
ssh-keygen -t ed25519 -C "ED25519 test key #1" -N "" -f ed25519_1
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: test_file.c,v 1.3 2015/03/04 23:22:35 djm Exp $ */
|
||||
/* $OpenBSD: test_file.c,v 1.4 2015/07/07 14:53:30 markus Exp $ */
|
||||
/*
|
||||
* Regress test for sshkey.h key management API
|
||||
*
|
||||
|
@ -83,7 +83,7 @@ sshkey_file_tests(void)
|
|||
|
||||
TEST_START("RSA1 key hex fingerprint");
|
||||
buf = load_text_file("rsa1_1.fp");
|
||||
cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
|
||||
cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA256, SSH_FP_BASE64);
|
||||
ASSERT_PTR_NE(cp, NULL);
|
||||
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
|
||||
sshbuf_free(buf);
|
||||
|
@ -167,7 +167,7 @@ sshkey_file_tests(void)
|
|||
|
||||
TEST_START("RSA key hex fingerprint");
|
||||
buf = load_text_file("rsa_1.fp");
|
||||
cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
|
||||
cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA256, SSH_FP_BASE64);
|
||||
ASSERT_PTR_NE(cp, NULL);
|
||||
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
|
||||
sshbuf_free(buf);
|
||||
|
@ -176,7 +176,7 @@ sshkey_file_tests(void)
|
|||
|
||||
TEST_START("RSA cert hex fingerprint");
|
||||
buf = load_text_file("rsa_1-cert.fp");
|
||||
cp = sshkey_fingerprint(k2, SSH_DIGEST_MD5, SSH_FP_HEX);
|
||||
cp = sshkey_fingerprint(k2, SSH_DIGEST_SHA256, SSH_FP_BASE64);
|
||||
ASSERT_PTR_NE(cp, NULL);
|
||||
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
|
||||
sshbuf_free(buf);
|
||||
|
@ -260,7 +260,7 @@ sshkey_file_tests(void)
|
|||
|
||||
TEST_START("DSA key hex fingerprint");
|
||||
buf = load_text_file("dsa_1.fp");
|
||||
cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
|
||||
cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA256, SSH_FP_BASE64);
|
||||
ASSERT_PTR_NE(cp, NULL);
|
||||
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
|
||||
sshbuf_free(buf);
|
||||
|
@ -269,7 +269,7 @@ sshkey_file_tests(void)
|
|||
|
||||
TEST_START("DSA cert hex fingerprint");
|
||||
buf = load_text_file("dsa_1-cert.fp");
|
||||
cp = sshkey_fingerprint(k2, SSH_DIGEST_MD5, SSH_FP_HEX);
|
||||
cp = sshkey_fingerprint(k2, SSH_DIGEST_SHA256, SSH_FP_BASE64);
|
||||
ASSERT_PTR_NE(cp, NULL);
|
||||
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
|
||||
sshbuf_free(buf);
|
||||
|
@ -360,7 +360,7 @@ sshkey_file_tests(void)
|
|||
|
||||
TEST_START("ECDSA key hex fingerprint");
|
||||
buf = load_text_file("ecdsa_1.fp");
|
||||
cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
|
||||
cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA256, SSH_FP_BASE64);
|
||||
ASSERT_PTR_NE(cp, NULL);
|
||||
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
|
||||
sshbuf_free(buf);
|
||||
|
@ -369,7 +369,7 @@ sshkey_file_tests(void)
|
|||
|
||||
TEST_START("ECDSA cert hex fingerprint");
|
||||
buf = load_text_file("ecdsa_1-cert.fp");
|
||||
cp = sshkey_fingerprint(k2, SSH_DIGEST_MD5, SSH_FP_HEX);
|
||||
cp = sshkey_fingerprint(k2, SSH_DIGEST_SHA256, SSH_FP_BASE64);
|
||||
ASSERT_PTR_NE(cp, NULL);
|
||||
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
|
||||
sshbuf_free(buf);
|
||||
|
@ -427,7 +427,7 @@ sshkey_file_tests(void)
|
|||
|
||||
TEST_START("Ed25519 key hex fingerprint");
|
||||
buf = load_text_file("ed25519_1.fp");
|
||||
cp = sshkey_fingerprint(k1, SSH_DIGEST_MD5, SSH_FP_HEX);
|
||||
cp = sshkey_fingerprint(k1, SSH_DIGEST_SHA256, SSH_FP_BASE64);
|
||||
ASSERT_PTR_NE(cp, NULL);
|
||||
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
|
||||
sshbuf_free(buf);
|
||||
|
@ -436,7 +436,7 @@ sshkey_file_tests(void)
|
|||
|
||||
TEST_START("Ed25519 cert hex fingerprint");
|
||||
buf = load_text_file("ed25519_1-cert.fp");
|
||||
cp = sshkey_fingerprint(k2, SSH_DIGEST_MD5, SSH_FP_HEX);
|
||||
cp = sshkey_fingerprint(k2, SSH_DIGEST_SHA256, SSH_FP_BASE64);
|
||||
ASSERT_PTR_NE(cp, NULL);
|
||||
ASSERT_STRING_EQ(cp, (const char *)sshbuf_ptr(buf));
|
||||
sshbuf_free(buf);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $OpenBSD: test_sshkey.c,v 1.5 2015/07/03 04:39:23 djm Exp $ */
|
||||
/* $OpenBSD: test_sshkey.c,v 1.6 2015/07/07 14:53:30 markus Exp $ */
|
||||
/*
|
||||
* Regress test for sshkey.h key management API
|
||||
*
|
||||
|
@ -288,13 +288,15 @@ sshkey_tests(void)
|
|||
#endif
|
||||
|
||||
TEST_START("generate KEY_RSA");
|
||||
ASSERT_INT_EQ(sshkey_generate(KEY_RSA, 768, &kr), 0);
|
||||
ASSERT_INT_EQ(sshkey_generate(KEY_RSA, 768, &kr),
|
||||
SSH_ERR_INVALID_ARGUMENT);
|
||||
ASSERT_INT_EQ(sshkey_generate(KEY_RSA, 1024, &kr), 0);
|
||||
ASSERT_PTR_NE(kr, NULL);
|
||||
ASSERT_PTR_NE(kr->rsa, NULL);
|
||||
ASSERT_PTR_NE(kr->rsa->n, NULL);
|
||||
ASSERT_PTR_NE(kr->rsa->e, NULL);
|
||||
ASSERT_PTR_NE(kr->rsa->p, NULL);
|
||||
ASSERT_INT_EQ(BN_num_bits(kr->rsa->n), 768);
|
||||
ASSERT_INT_EQ(BN_num_bits(kr->rsa->n), 1024);
|
||||
TEST_DONE();
|
||||
|
||||
TEST_START("generate KEY_DSA");
|
||||
|
@ -397,7 +399,7 @@ sshkey_tests(void)
|
|||
TEST_DONE();
|
||||
|
||||
TEST_START("equal different keys");
|
||||
ASSERT_INT_EQ(sshkey_generate(KEY_RSA, 768, &k1), 0);
|
||||
ASSERT_INT_EQ(sshkey_generate(KEY_RSA, 1024, &k1), 0);
|
||||
ASSERT_INT_EQ(sshkey_equal(kr, k1), 0);
|
||||
sshkey_free(k1);
|
||||
ASSERT_INT_EQ(sshkey_generate(KEY_DSA, 1024, &k1), 0);
|
||||
|
|
Loading…
Reference in New Issue