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 15, 2024
1 parent 39abbde commit 367e431
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion tests/tbasic
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,8 @@ fi
OPENSSL_CONF=${ORIG_OPENSSL_CONF}

title PARA "Test Key generation"
output=$("${TESTBLDDIR}"/tgenkey "RSA,RSA-PSS,EC,RSAKeyUsage" 2>&1)
echo "$CHECKER \"${TESTBLDDIR}\"/tgenkey \"RSA,RSA-PSS,EC,RSAKeyUsage\""
output=$($CHECKER "${TESTBLDDIR}"/tgenkey "RSA,RSA-PSS,EC,RSAKeyUsage" 2>&1)
FAIL=0
echo "$output" | grep "Performed tests: 4" || FAIL=1
if [ $FAIL -ne 0 ]; then
Expand Down
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 @@ -536,13 +536,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 367e431

Please sign in to comment.