upstream: adapt to API changes

OpenBSD-Regress-ID: 5f147990cb67094fe554333782ab268a572bb2dd
This commit is contained in:
djm@openbsd.org 2020-08-27 03:55:22 +00:00 коммит произвёл Damien Miller
Родитель bbcc858ded
Коммит e32479645c
2 изменённых файлов: 7 добавлений и 6 удалений

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

@ -1,4 +1,4 @@
/* $OpenBSD: test_fuzz.c,v 1.11 2019/11/25 10:32:35 djm Exp $ */ /* $OpenBSD: test_fuzz.c,v 1.12 2020/08/27 03:55:22 djm Exp $ */
/* /*
* Fuzz tests for key parsing * Fuzz tests for key parsing
* *
@ -88,7 +88,7 @@ sig_fuzz(struct sshkey *k, const char *sig_alg)
fuzzers |= FUZZ_2_BIT_FLIP; fuzzers |= FUZZ_2_BIT_FLIP;
ASSERT_INT_EQ(sshkey_sign(k, &sig, &l, c, sizeof(c), ASSERT_INT_EQ(sshkey_sign(k, &sig, &l, c, sizeof(c),
sig_alg, NULL, 0), 0); sig_alg, NULL, NULL, 0), 0);
ASSERT_SIZE_T_GT(l, 0); ASSERT_SIZE_T_GT(l, 0);
fuzz = fuzz_begin(fuzzers, sig, l); fuzz = fuzz_begin(fuzzers, sig, l);
ASSERT_INT_EQ(sshkey_verify(k, sig, l, c, sizeof(c), NULL, 0, NULL), 0); ASSERT_INT_EQ(sshkey_verify(k, sig, l, c, sizeof(c), NULL, 0, NULL), 0);

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

@ -1,4 +1,4 @@
/* $OpenBSD: test_sshkey.c,v 1.20 2019/11/25 10:32:35 djm Exp $ */ /* $OpenBSD: test_sshkey.c,v 1.21 2020/08/27 03:55:22 djm Exp $ */
/* /*
* Regress test for sshkey.h key management API * Regress test for sshkey.h key management API
* *
@ -101,7 +101,7 @@ build_cert(struct sshbuf *b, struct sshkey *k, const char *type,
ASSERT_INT_EQ(sshbuf_put_string(b, NULL, 0), 0); /* reserved */ ASSERT_INT_EQ(sshbuf_put_string(b, NULL, 0), 0); /* reserved */
ASSERT_INT_EQ(sshbuf_put_stringb(b, ca_buf), 0); /* signature key */ ASSERT_INT_EQ(sshbuf_put_stringb(b, ca_buf), 0); /* signature key */
ASSERT_INT_EQ(sshkey_sign(sign_key, &sigblob, &siglen, ASSERT_INT_EQ(sshkey_sign(sign_key, &sigblob, &siglen,
sshbuf_ptr(b), sshbuf_len(b), sig_alg, NULL, 0), 0); sshbuf_ptr(b), sshbuf_len(b), sig_alg, NULL, NULL, 0), 0);
ASSERT_INT_EQ(sshbuf_put_string(b, sigblob, siglen), 0); /* signature */ ASSERT_INT_EQ(sshbuf_put_string(b, sigblob, siglen), 0); /* signature */
free(sigblob); free(sigblob);
@ -120,7 +120,8 @@ signature_test(struct sshkey *k, struct sshkey *bad, const char *sig_alg,
size_t len; size_t len;
u_char *sig; u_char *sig;
ASSERT_INT_EQ(sshkey_sign(k, &sig, &len, d, l, sig_alg, NULL, 0), 0); ASSERT_INT_EQ(sshkey_sign(k, &sig, &len, d, l, sig_alg,
NULL, NULL, 0), 0);
ASSERT_SIZE_T_GT(len, 8); ASSERT_SIZE_T_GT(len, 8);
ASSERT_PTR_NE(sig, NULL); ASSERT_PTR_NE(sig, NULL);
ASSERT_INT_EQ(sshkey_verify(k, sig, len, d, l, NULL, 0, NULL), 0); ASSERT_INT_EQ(sshkey_verify(k, sig, len, d, l, NULL, 0, NULL), 0);
@ -437,7 +438,7 @@ sshkey_tests(void)
put_opt(k1->cert->extensions, "permit-X11-forwarding", NULL); put_opt(k1->cert->extensions, "permit-X11-forwarding", NULL);
put_opt(k1->cert->extensions, "permit-agent-forwarding", NULL); put_opt(k1->cert->extensions, "permit-agent-forwarding", NULL);
ASSERT_INT_EQ(sshkey_from_private(k2, &k1->cert->signature_key), 0); ASSERT_INT_EQ(sshkey_from_private(k2, &k1->cert->signature_key), 0);
ASSERT_INT_EQ(sshkey_certify(k1, k2, NULL, NULL), 0); ASSERT_INT_EQ(sshkey_certify(k1, k2, NULL, NULL, NULL), 0);
b = sshbuf_new(); b = sshbuf_new();
ASSERT_PTR_NE(b, NULL); ASSERT_PTR_NE(b, NULL);
ASSERT_INT_EQ(sshkey_putb(k1, b), 0); ASSERT_INT_EQ(sshkey_putb(k1, b), 0);