rv = DSA_SignDigestWithSeed((DSAPrivateKey *)cipherInfo->cx, &cipherInfo->output.pBuf, &cipherInfo->input.pBuf, cipherInfo->params.dsa.sigseed.buf.data); CHECKERROR(rv, __LINE__); TIMESTART(); for (i=0; i<cipherInfo->repetitions; i++) { rv |= DSA_SignDigestWithSeed((DSAPrivateKey *)cipherInfo->cx, &dummyOut, &cipherInfo->input.pBuf, cipherInfo->params.dsa.sigseed.buf.data); } TIMEFINISH(cipherInfo->optime, 1.0); CHECKERROR(rv, __LINE__); } else { rv = DSA_SignDigest((DSAPrivateKey *)cipherInfo->cx, &cipherInfo->output.pBuf, &cipherInfo->input.pBuf); CHECKERROR(rv, __LINE__); TIMESTART(); for (i=0; i<cipherInfo->repetitions; i++) { DSA_SignDigest((DSAPrivateKey *)cipherInfo->cx, &dummyOut, &cipherInfo->input.pBuf); } TIMEFINISH(cipherInfo->optime, 1.0); } bltestCopyIO(cipherInfo->arena, &cipherInfo->params.dsa.sig, &cipherInfo->output);
TIMESTART(); rv = DSA_SignDigestWithSeed((DSAPrivateKey *)cipherInfo->cx, &cipherInfo->output.pBuf, &cipherInfo->input.pBuf, cipherInfo->params.dsa.sigseed.buf.data); TIMEFINISH(cipherInfo->optime, 1.0); CHECKERROR(rv, __LINE__); cipherInfo->repetitions = 0; if (cipherInfo->repetitionsToPerfom != 0) { TIMESTART(); for (i=0; i<cipherInfo->repetitionsToPerfom; i++, cipherInfo->repetitions++) { rv = DSA_SignDigestWithSeed((DSAPrivateKey *)cipherInfo->cx, &dummyOut, &cipherInfo->input.pBuf, cipherInfo->params.dsa.sigseed.buf.data); CHECKERROR(rv, __LINE__); } } else { int opsBetweenChecks = 0; TIMEMARK(cipherInfo->seconds); while (! (TIMETOFINISH())) { int j = 0; for (;j < opsBetweenChecks;j++) { rv = DSA_SignDigestWithSeed((DSAPrivateKey *)cipherInfo->cx, &dummyOut, &cipherInfo->input.pBuf, cipherInfo->params.dsa.sigseed.buf.data); CHECKERROR(rv, __LINE__); } cipherInfo->repetitions += j; } } TIMEFINISH(cipherInfo->optime, 1.0); } else { TIMESTART(); rv = DSA_SignDigest((DSAPrivateKey *)cipherInfo->cx, &cipherInfo->output.pBuf, &cipherInfo->input.pBuf); TIMEFINISH(cipherInfo->optime, 1.0); CHECKERROR(rv, __LINE__); cipherInfo->repetitions = 0; if (cipherInfo->repetitionsToPerfom != 0) { TIMESTART(); for (i=0; i<cipherInfo->repetitionsToPerfom; i++, cipherInfo->repetitions++) { rv = DSA_SignDigest((DSAPrivateKey *)cipherInfo->cx, &dummyOut, &cipherInfo->input.pBuf); CHECKERROR(rv, __LINE__); } } else { int opsBetweenChecks = 0; TIMEMARK(cipherInfo->seconds); while (! (TIMETOFINISH())) { int j = 0; for (;j < opsBetweenChecks;j++) { rv = DSA_SignDigest((DSAPrivateKey *)cipherInfo->cx, &dummyOut, &cipherInfo->input.pBuf); CHECKERROR(rv, __LINE__); } cipherInfo->repetitions += j; } } TIMEFINISH(cipherInfo->optime, 1.0); } bltestCopyIO(cipherInfo->arena, &cipherInfo->params.dsa.sig, &cipherInfo->output);
dsaOp(bltestCipherInfo *cipherInfo){    PRIntervalTime time1, time2;    SECStatus rv = SECSuccess;    int i;    int maxLen = cipherInfo->output.pBuf.len;    SECItem dummyOut = { 0, 0, 0 };    SECITEM_AllocItem(NULL, &dummyOut, maxLen);    if (cipherInfo->cipher.pubkeyCipher == dsa_signDigest) {	if (cipherInfo->params.dsa.sigseed.buf.len > 0) {	    rv = DSA_SignDigestWithSeed((DSAPrivateKey *)cipherInfo->cx,				       &cipherInfo->output.pBuf,				       &cipherInfo->input.pBuf,				       cipherInfo->params.dsa.sigseed.buf.data);	    CHECKERROR(rv, __LINE__);	    TIMESTART();	    for (i=0; i<cipherInfo->repetitions; i++) {		rv |= DSA_SignDigestWithSeed((DSAPrivateKey *)cipherInfo->cx,				       &dummyOut,				       &cipherInfo->input.pBuf,				       cipherInfo->params.dsa.sigseed.buf.data);	    }	    TIMEFINISH(cipherInfo->optime, 1.0);	    CHECKERROR(rv, __LINE__);	} else {	    rv = DSA_SignDigest((DSAPrivateKey *)cipherInfo->cx,				&cipherInfo->output.pBuf,				&cipherInfo->input.pBuf);	    CHECKERROR(rv, __LINE__);	    TIMESTART();	    for (i=0; i<cipherInfo->repetitions; i++) {		DSA_SignDigest((DSAPrivateKey *)cipherInfo->cx, &dummyOut,			       &cipherInfo->input.pBuf);	    }	    TIMEFINISH(cipherInfo->optime, 1.0);	}	bltestCopyIO(cipherInfo->arena, &cipherInfo->params.dsa.sig, 	             &cipherInfo->output);    } else {	rv = DSA_VerifyDigest((DSAPublicKey *)cipherInfo->cx,			      &cipherInfo->params.dsa.sig.buf,			      &cipherInfo->input.pBuf);	CHECKERROR(rv, __LINE__);	TIMESTART();	for (i=0; i<cipherInfo->repetitions; i++) {	    DSA_VerifyDigest((DSAPublicKey *)cipherInfo->cx,			     &cipherInfo->params.dsa.sig.buf,			     &cipherInfo->input.pBuf);	}	TIMEFINISH(cipherInfo->optime, 1.0);    }    SECITEM_FreeItem(&dummyOut, PR_FALSE);    return rv;}