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

title PARA "Test Key generation"
output=$("${TESTBLDDIR}"/tgenkey "RSA,RSA-PSS,EC,RSAKeyUsage" 2>&1)
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 d2c4440

Please sign in to comment.