From b7f46b56779fc97b73eb8499ab5228845a948edc Mon Sep 17 00:00:00 2001 From: Simo Sorce <simo@redhat.com> Date: Fri, 12 Apr 2024 15:51:21 -0400 Subject: [PATCH] Add key generation test for ED25519 Signed-off-by: Simo Sorce <simo@redhat.com> --- tests/tedwards | 12 ++++++++++++ tests/tgenkey.c | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/tests/tedwards b/tests/tedwards index 905eea69..b225f785 100755 --- a/tests/tedwards +++ b/tests/tedwards @@ -46,4 +46,16 @@ $CHECKER ./tcmpkeys "$EDPRIURI" "${TMPPDIR}"/edout.pub title PARA "Match private ED key against public key (commutativity)" $CHECKER ./tcmpkeys "${TMPPDIR}"/edout.pub "$EDPRIURI" +title PARA "Test Key generation" +output=$(${TESTBLDDIR}/tgenkey "ED25519" 2>&1 || true) +FAIL=0 +echo "$output" | grep "Performed tests: 1" || FAIL=1 +if [ $FAIL -ne 0 ]; then + echo + echo "Original command output:" + echo "$output" + echo + exit 1 +fi + exit 0 diff --git a/tests/tgenkey.c b/tests/tgenkey.c index 9a086be7..89bb1319 100644 --- a/tests/tgenkey.c +++ b/tests/tgenkey.c @@ -532,13 +532,13 @@ int main(int argc, char *argv[]) miniid = (id[0] << 24) + (id[1] << 16) + (id[2] << 8) + id[3]; ret = asprintf(&label, "Test-Ed-gen-%08x", miniid); if (ret == -1) { - fprintf(stderr, "Failed to make label"); + fprintf(stderr, "Failed to make label\n"); exit(EXIT_FAILURE); } hexify(idhex, id, 16); ret = asprintf(&uri, "pkcs11:object=%s;id=%s", label, idhex); if (ret == -1) { - fprintf(stderr, "Failed to make label"); + fprintf(stderr, "Failed to make label\n"); exit(EXIT_FAILURE); } params[0] = OSSL_PARAM_construct_utf8_string("pkcs11_uri", uri, 0);