| 83 | } |
| 84 | |
| 85 | void BenchMarkSigning(const char *name, PK_Signer &key, double timeTotal, bool pc=false) |
| 86 | { |
| 87 | unsigned int len = 16; |
| 88 | AlignedSecByteBlock message(len), signature(key.SignatureLength()); |
| 89 | GlobalRNG().GenerateBlock(message, len); |
| 90 | |
| 91 | const clock_t start = clock(); |
| 92 | unsigned int i; |
| 93 | double timeTaken; |
| 94 | for (timeTaken=(double)0, i=0; timeTaken < timeTotal; timeTaken = double(clock() - start) / CLOCK_TICKS_PER_SECOND, i++) |
| 95 | key.SignMessage(GlobalRNG(), message, len, signature); |
| 96 | |
| 97 | OutputResultOperations(name, "Signature", pc, i, timeTaken); |
| 98 | |
| 99 | if (!pc && key.GetMaterial().SupportsPrecomputation()) |
| 100 | { |
| 101 | key.AccessMaterial().Precompute(16); |
| 102 | BenchMarkSigning(name, key, timeTotal, true); |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | void BenchMarkVerification(const char *name, const PK_Signer &priv, PK_Verifier &pub, double timeTotal, bool pc=false) |
| 107 | { |
no test coverage detected