diff --git a/cmd/ecperf/ecperf.c b/cmd/ecperf/ecperf.c --- a/cmd/ecperf/ecperf.c +++ b/cmd/ecperf/ecperf.c @@ -51,10 +51,11 @@ int iters = threadData->iters; unsigned char sigData[256]; SECItem sig; CK_SESSION_HANDLE session; CK_RV crv; + void *tmp = NULL; threadData->status = SECSuccess; threadData->count = 0; /* get our thread's session */ @@ -66,10 +67,11 @@ } if (threadData->isSign) { sig.data = sigData; sig.len = sizeof(sigData); + tmp = threadData->p2; threadData->p2 = (void *)&sig; } while (iters--) { threadData->status = (*op)(session, threadData->p1, @@ -77,27 +79,33 @@ if (threadData->status != SECSuccess) { break; } threadData->count++; } + + if (threadData->isSign) { + threadData->p2 = tmp; + } return; } void genericThread(void *data) { ThreadData *threadData = (ThreadData *)data; int iters = threadData->iters; unsigned char sigData[256]; SECItem sig; + void *tmp = NULL; threadData->status = SECSuccess; threadData->count = 0; if (threadData->isSign) { sig.data = sigData; sig.len = sizeof(sigData); + tmp = threadData->p2; threadData->p2 = (void *)&sig; } while (iters--) { threadData->status = (*threadData->op)(threadData->p1, @@ -105,10 +113,14 @@ if (threadData->status != SECSuccess) { break; } threadData->count++; } + + if (threadData->isSign) { + threadData->p2 = tmp; + } return; } /* Time iter repetitions of operation op. */ SECStatus