26 #include "../crypto/internal.h"
27 #include "../crypto/test/file_test.h"
34 std::vector<uint8_t>
N;
41 TestCtx *
ctx =
reinterpret_cast<TestCtx *
>(
arg);
44 if (!t->GetInstruction(&mod_str,
"mod")) {
48 printf(
"%s", t->CurrentTestToString().c_str());
50 if (t->HasAttribute(
"n")) {
52 return t->GetBytes(&
ctx->N,
"n");
56 std::vector<uint8_t> e_bytes,
msg, sig;
57 if (!t->GetAttribute(&
hash,
"SHAAlg") ||
58 !t->GetBytes(&e_bytes,
"e") ||
59 !t->GetBytes(&
msg,
"Msg") ||
60 !t->GetBytes(&sig,
"S")) {
84 sig.data(), sig.size());
87 sig.size(),
key.get());
91 printf(
"Result = P\r\n\r\n");
103 fprintf(
stderr,
"usage: %s (pkcs15|pss) <test file>\n",
109 if (strcmp(argv[1],
"pkcs15") == 0) {
110 ctx = {std::vector<uint8_t>(),
false};
111 }
else if (strcmp(argv[1],
"pss") == 0) {
112 ctx = {std::vector<uint8_t>(),
true};
114 fprintf(
stderr,
"Unknown test type: %s\n", argv[1]);