Skip to content

Commit

Permalink
Merge pull request #491 from z4yx/dev
Browse files Browse the repository at this point in the history
Support Ed25519 in test-signature action
  • Loading branch information
aveenismail authored Jul 3, 2024
2 parents ad9bbd3 + 82910bb commit f4ca831
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tool/yubico-piv-tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -2074,6 +2074,28 @@ static bool test_signature(ykpiv_state *state, enum enum_slot slot,
}
}
break;
case YKPIV_ALGO_ED25519:
{
EVP_MD_CTX *ctx;
int rc;
ctx = EVP_MD_CTX_new();
if (!ctx || EVP_DigestVerifyInit(ctx, NULL, NULL, NULL, pubkey) <= 0) {
fprintf(stderr, "Failed routine initialization\n");
EVP_MD_CTX_free(ctx); // It's OK if ctx is NULL
goto test_out;
}
rc = EVP_DigestVerify(ctx, signature, (int)sig_len, data, (int)data_len);
EVP_MD_CTX_free(ctx);
if(rc == 1) {
fprintf(stderr, "Successful EDDSA verification.\n");
ret = true;
goto test_out;
} else {
fprintf(stderr, "Failed EDDSA verification.\n");
goto test_out;
}
}
break;
default:
fprintf(stderr, "Unknown algorithm.\n");
goto test_out;
Expand Down

0 comments on commit f4ca831

Please sign in to comment.