Skip to content

Commit

Permalink
Add key generation test for ED25519
Browse files Browse the repository at this point in the history
Signed-off-by: Simo Sorce <[email protected]>
  • Loading branch information
simo5 committed Apr 12, 2024
1 parent 255702c commit b7f46b5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
12 changes: 12 additions & 0 deletions tests/tedwards
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions tests/tgenkey.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit b7f46b5

Please sign in to comment.