int main(void) { int* data = generateRandomData(); filterKernel(data); free(data); return 0; }
/// <summary> /// Get 15 minutes data series into the timeStamps, highData, lowData, openData, closeData /// and volData arrays. /// </summary> /// <param name="startDate">The starting date/time for the data series.</param> /// <param name="endDate">The ending date/time for the data series.</param> void CFinancedemoDlg::get15MinData(CString ticker, double startDate, double endDate) { // // In this demo, we use a random number generator to generate the data. In practice, // you may get the data from a database or by other means. If you do not have 15 // minute data, you may modify the "drawChart" method below to not using 15 minute // data. // generateRandomData(ticker, startDate, endDate, 900); }
/// <summary> /// Get daily data series into the timeStamps, highData, lowData, openData, closeData and /// volData arrays. /// </summary> /// <param name="startDate">The starting date/time for the data series.</param> /// <param name="endDate">The ending date/time for the data series.</param> void CFinancedemoDlg::getDailyData(CString ticker, double startDate, double endDate) { // // In this demo, we use a random number generator to generate the data. In practice, // you may get the data from a database or by other means. Replace the code below // with your own data acquisition code. // generateRandomData(ticker, startDate, endDate, 86400); }
/** ***************************************************************************** * @ingroup dsaPerformance * dsaGenRandom * * @description * Populate a CpaFlatBuffer with a random number which is less than Q * *****************************************************************************/ void dsaGenRandom(CpaFlatBuffer* dsaRand, CpaFlatBuffer* dsaQ) { /*generate random data */ generateRandomData(dsaRand->pData, dsaRand->dataLenInBytes); /*make sure MSB is set */ setCpaFlatBufferMSB(dsaRand); /*make sure its < q */ makeParam1SmallerThanParam2(dsaRand->pData, dsaQ->pData, dsaRand->dataLenInBytes, CPA_TRUE); }
/// <summary> /// Get monthly data series into the timeStamps, highData, lowData, openData, closeData and /// volData arrays. /// </summary> /// <param name="startDate">The starting date/time for the data series.</param> /// <param name="endDate">The ending date/time for the data series.</param> void CFinancedemoDlg::getMonthlyData(CString ticker, double startDate, double endDate) { // // In this demo, we use a random number generator to generate the data. In practice, // you may get the data from a database or by other means. If you do not have monthly // data, you may call "getDailyData" to get daily data first, and then call // "convertDailyToMonthlyData" to convert it to monthly data, like: // // getDailyData(startDate, endDate); // convertDailyToMonthlyData(); // generateRandomData(ticker, startDate, endDate, 86400 * 30); }
int main() { std::vector<T> scanInputs(DATA_SIZE); std::vector<T> scanOutputsCpu(DATA_SIZE); std::vector<T> scanOutputsGpu(DATA_SIZE); generateRandomData(scanInputs); blellochScanGpu(scanInputs, scanOutputsGpu); exclusiveScanCpu(scanInputs, scanOutputsCpu); verifyGpuScan(scanOutputsCpu, scanOutputsGpu); return 0; }
void Base64TestCase::EncodeDecodeRandom() { size_t size = rand() * 3000 / RAND_MAX + 11; unsigned char *buff = new unsigned char[size]; generateRandomData(buff, size); wxString str = wxBase64Encode(buff, size); wxMemoryBuffer mbuff = wxBase64Decode(str); CPPUNIT_ASSERT(memcmp(mbuff.GetData(), buff, mbuff.GetDataLen()) == 0); generateGibberish(buff, size); char *buff2 = new char[size]; size_t realsize = size; CPPUNIT_ASSERT(wxBase64Decode(buff2, realsize, (char *)buff, size)); CPPUNIT_ASSERT(wxBase64Encode(buff2, size, buff2, realsize)); }
Aes256::Aes256(BinData key): key_( std::move(key) ), iv_( generateRandomData( ivSize() ) ), td_(MCRYPT_RIJNDAEL_256, MCRYPT_CFB) { if( key_.size()!=iv_.size() ) throw std::runtime_error("key and IV size differ"); assert( static_cast<size_t>(mcrypt_enc_get_key_size(td_.get()))==keySize() ); assert( static_cast<size_t>(mcrypt_enc_get_iv_size(td_.get())) ==ivSize() ); int ret; if( (ret = mcrypt_generic_init(td_.get(), key_.data(), key_.size(), iv_.data())) < 0 ) throw std::runtime_error( (Util::ErrStrm{}<<"mcrypt_generic_init(): "<<mcrypt_strerror(ret)).str().c_str() ); }
int main(){ std::vector<int> histogramInputs(DATA_SIZE); std::vector<int> histogtamOutputsCpu(BINS); std::vector<int> histogtamOutputsGpu(BINS); generateRandomData(histogtamInputs); histogramGpu(histogtamInputs, histogtamOutputsGpu); histogramCpu(histogtamInputs, histogtamOutputsCpu); //printVector(scanInputs); //printVector(scanOutputsCpu); //printVector(scanOutputsGpu); return 0; }
bool runTest(int argc, const char **argv) { bool ok = true; float *host_output; float *device_output; float *input; float *coeff; int defaultDim; int dimx; int dimy; int dimz; int outerDimx; int outerDimy; int outerDimz; int radius; int timesteps; size_t volumeSize; memsize_t memsize; const float lowerBound = 0.0f; const float upperBound = 1.0f; // Determine default dimensions shrLog("Set-up, based upon target device GMEM size...\n"); if (ok) { // Get the memory size of the target device shrLog(" getTargetDeviceGlobalMemSize\n"); ok = getTargetDeviceGlobalMemSize(&memsize, argc, argv); } if (ok) { // We can never use all the memory so to keep things simple we aim to // use around half the total memory memsize /= 2; // Most of our memory use is taken up by the input and output buffers - // two buffers of equal size - and for simplicity the volume is a cube: // dim = floor( (N/2)^(1/3) ) defaultDim = (int)floor(pow((memsize / (2.0 * sizeof(float))), 1.0/3.0)); // By default, make the volume edge size an integer multiple of 128B to // improve performance by coalescing memory accesses, in a real // application it would make sense to pad the lines accordingly int roundTarget = 128 / sizeof(float); defaultDim = defaultDim / roundTarget * roundTarget; defaultDim -= k_radius_default * 2; // Check dimension is valid if (defaultDim < k_dim_min) { shrLogEx(LOGBOTH | ERRORMSG, -1000, STDERROR); shrLog("\tinsufficient device memory (maximum volume on device is %d, must be between %d and %d).\n", defaultDim, k_dim_min, k_dim_max); ok = false; } else if (defaultDim > k_dim_max) { defaultDim = k_dim_max; } } // For QA testing, override default volume size if (ok) { if (shrCheckCmdLineFlag(argc, argv, "qatest")) { defaultDim = MIN(defaultDim, k_dim_qa); } } // Parse command line arguments if (ok) { char *dim = 0; if (shrGetCmdLineArgumentstr(argc, argv, "dimx", &dim)) { dimx = (int)atoi(dim); if (dimx < k_dim_min || dimx > k_dim_max) { shrLogEx(LOGBOTH | ERRORMSG, -1001, STDERROR); shrLog("\tdimx out of range (%d requested, must be between %d and %d), see header files for details.\n", dimx, k_dim_min, k_dim_max); ok = false; } } else { dimx = defaultDim; } if (shrGetCmdLineArgumentstr(argc, argv, "dimy", &dim)) { dimy = (int)atoi(dim); if (dimy < k_dim_min || dimy > k_dim_max) { shrLogEx(LOGBOTH | ERRORMSG, -1002, STDERROR); shrLog("\tdimy out of range (%d requested, must be between %d and %d), see header files for details.\n", dimy, k_dim_min, k_dim_max); ok = false; } } else { dimy = defaultDim; } if (shrGetCmdLineArgumentstr(argc, argv, "dimz", &dim)) { dimz = (int)atoi(dim); if (dimz < k_dim_min || dimz > k_dim_max) { shrLogEx(LOGBOTH | ERRORMSG, -1003, STDERROR); shrLog("\tdimz out of range (%d requested, must be between %d and %d), see header files for details.\n", dimz, k_dim_min, k_dim_max); ok = false; } } else { dimz = defaultDim; } if (shrGetCmdLineArgumentstr(argc, argv, "radius", &dim)) { radius = (int)atoi(dim); if (radius < k_radius_min || radius >= k_radius_max) { shrLogEx(LOGBOTH | ERRORMSG, -1004, STDERROR); shrLog("\tradius out of range (%d requested, must be between %d and %d), see header files for details.\n", radius, k_radius_min, k_radius_max); ok = false; } } else { radius = k_radius_default; } if (shrGetCmdLineArgumentstr(argc, argv, "timesteps", &dim)) { timesteps = (int)atoi(dim); if (timesteps < k_timesteps_min || radius >= k_timesteps_max) { shrLogEx(LOGBOTH | ERRORMSG, -1005, STDERROR); shrLog("\ttimesteps out of range (%d requested, must be between %d and %d), see header files for details.\n", timesteps, k_timesteps_min, k_timesteps_max); ok = false; } } else { timesteps = k_timesteps_default; } if (dim) free(dim); } // Determine volume size if (ok) { outerDimx = dimx + 2 * radius; outerDimy = dimy + 2 * radius; outerDimz = dimz + 2 * radius; volumeSize = outerDimx * outerDimy * outerDimz; } // Allocate memory if (ok) { shrLog(" calloc host_output\n"); if ((host_output = (float *)calloc(volumeSize, sizeof(float))) == NULL) { shrLogEx(LOGBOTH | ERRORMSG, -1006, STDERROR); shrLog("\tInsufficient memory for host_output calloc, please try a smaller volume (use --help for syntax).\n"); ok = false; } } if (ok) { shrLog(" malloc input\n"); if ((input = (float *)malloc(volumeSize * sizeof(float))) == NULL) { shrLogEx(LOGBOTH | ERRORMSG, -1007, STDERROR); shrLog("\tInsufficient memory for input malloc, please try a smaller volume (use --help for syntax).\n"); ok = false; } } if (ok) { shrLog(" malloc coeff\n"); if ((coeff = (float *)malloc((radius + 1) * sizeof(float))) == NULL) { shrLogEx(LOGBOTH | ERRORMSG, -1008, STDERROR); shrLog("\tInsufficient memory for coeff malloc, please try a smaller volume (use --help for syntax).\n"); ok = false; } } // Create coefficients if (ok) { for (int i = 0 ; i <= radius ; i++) { coeff[i] = 0.1f; } } // Generate data if (ok) { shrLog(" generateRandomData\n\n"); generateRandomData(input, outerDimx, outerDimy, outerDimz, lowerBound, upperBound); } if (ok) { shrLog("FDTD on %d x %d x %d volume with symmetric filter radius %d for %d timesteps...\n\n", dimx, dimy, dimz, radius, timesteps); } // Execute on the host if (ok) { shrLog("fdtdReference...\n"); ok = fdtdReference(host_output, input, coeff, dimx, dimy, dimz, radius, timesteps); shrLog("fdtdReference complete\n"); } // Allocate memory if (ok) { shrLog(" calloc device_output\n"); if ((device_output = (float *)calloc(volumeSize, sizeof(float))) == NULL) { shrLogEx(LOGBOTH | ERRORMSG, -1009, STDERROR); shrLog("\tInsufficient memory for device output calloc, please try a smaller volume (use --help for syntax).\n"); ok = false; } } // Execute on the device if (ok) { shrLog("fdtdGPU...\n"); ok = fdtdGPU(device_output, input, coeff, dimx, dimy, dimz, radius, timesteps, argc, argv); shrLog("fdtdGPU complete\n"); } // Compare the results if (ok) { float tolerance = 0.0001f; shrLog("\nCompareData (tolerance %f)...\n", tolerance); ok = compareData(device_output, host_output, dimx, dimy, dimz, radius, tolerance); } return ok; }
/** ***************************************************************************** * @ingroup dsaPerformance * dsaPerform * * @description * This function generates all the DSA parameters required to perform a DSA * sign and DSA verify operation. A user defined number of random messages * are generated and signed, then the signature is verified * *****************************************************************************/ CpaStatus dsaPerform(dsa_test_params_t* setup) { Cpa32U i=0; Cpa32U outerLoop = 0; CpaBoolean verifyStatus = CPA_TRUE; CpaStatus status = CPA_STATUS_SUCCESS; /*DSA parameters */ /*DSA Q parameter, this shall be populated by the hard coded Q at the top * of this file */ CpaFlatBuffer dsaQ = {0}; /*random number X used to generate Y and Sign R&S */ CpaFlatBuffer* dsaX = NULL; /*DSA P parameter, this shall be populated by the hard coded P at the top * of this file */ CpaFlatBuffer dsaP = {0}; /*H is used to generate G, H is hard coded to DEFAULT_H_VALUE */ CpaFlatBuffer dsaH = {0}; /* DSA G parameter used to generate Y, the signature R&S, and to verify */ CpaFlatBuffer dsaG = {0}; /*DSA Y parameter is used in the verification stage */ CpaFlatBuffer* dsaY = NULL; /*K is a random number used in the generation of signature R&S */ CpaFlatBuffer* dsaK = NULL; /*M is the message to be signed */ CpaFlatBuffer* dsaM = NULL; /*R&S is used to store the DSA Signature */ CpaFlatBuffer* dsaR = NULL; CpaFlatBuffer* dsaS = NULL; /*Z is the digest of the message in dsaM */ CpaFlatBuffer* dsaZ = NULL; perf_data_t* pDsaData = NULL; /*GCC compiler complains without the double {{}} to init the following * structures*/ CpaCyDsaGParamGenOpData gOpData = {{0, NULL}, {0, NULL}, {0, NULL}}; CpaCyDsaYParamGenOpData yOpData = {{0}}; CpaCyDsaRSSignOpData rsOpData = {{0}}; CpaCyDsaVerifyOpData* verifyOpData = NULL; Cpa8U* pDataPtr = NULL; Cpa32U sizeOfp = 0; Cpa8U* qDataPtr = NULL; Cpa32U sizeOfq = 0; Cpa32U node = 0; CpaCyDsaVerifyCbFunc cbFunc = NULL; status = sampleCodeCyGetNode(setup->cyInstanceHandle, &node); if(CPA_STATUS_SUCCESS != status) { PRINT_ERR("Could not determibne node for memory allocation\n"); return status; } pDsaData = setup->performanceStats; pDsaData->threadReturnStatus = CPA_STATUS_FAIL; pDsaData->numOperations = (Cpa64U)setup->numBuffers * setup->numLoops; /*check the p and q input len and set the pointers to the data */ if(MODULUS_1024_BIT / NUM_BITS_IN_BYTE == setup->pLenInBytes && EXPONENT_160_BIT / NUM_BITS_IN_BYTE == setup->qLenInBytes) { pDataPtr = dsa_1024_160_p; qDataPtr = dsa_1024_160_q; sizeOfp = sizeof(dsa_1024_160_p); sizeOfq = sizeof(dsa_1024_160_q); } else if(MODULUS_2048_BIT / NUM_BITS_IN_BYTE == setup->pLenInBytes && EXPONENT_224_BIT / NUM_BITS_IN_BYTE == setup->qLenInBytes) { pDataPtr = dsa_2048_224_p; qDataPtr = dsa_2048_224_q; sizeOfp = sizeof(dsa_2048_224_p); sizeOfq = sizeof(dsa_2048_224_q); } else if(MODULUS_2048_BIT / NUM_BITS_IN_BYTE == setup->pLenInBytes && EXPONENT_256_BIT / NUM_BITS_IN_BYTE == setup->qLenInBytes) { pDataPtr = dsa_2048_256_p; qDataPtr = dsa_2048_256_q; sizeOfp = sizeof(dsa_2048_256_p); sizeOfq = sizeof(dsa_2048_256_q); } else if(MODULUS_3072_BIT / NUM_BITS_IN_BYTE == setup->pLenInBytes && EXPONENT_256_BIT / NUM_BITS_IN_BYTE == setup->qLenInBytes) { pDataPtr = dsa_3072_256_p; qDataPtr = dsa_3072_256_q; sizeOfp = sizeof(dsa_3072_256_p); sizeOfq = sizeof(dsa_3072_256_q); } else { PRINT_ERR("P & Q len not supported\n"); /*thread status is init to fail so just reutrn fail here*/ return CPA_STATUS_FAIL; } /* Completion used in callback */ sampleCodeSemaphoreInit(&pDsaData->comp, 0); #define ALLOC_STRUCT(ptr, size) \ do{ \ ptr = qaeMemAlloc(size * setup->numBuffers); \ if(NULL == ptr) \ { \ PRINT_ERR("Could not allocate memory\n"); \ FREE_DSA_MEM; \ return CPA_STATUS_FAIL; \ } \ memset(ptr,0,size * setup->numBuffers); \ }while(0) /*Allocate all the buffers */ ALLOC_STRUCT(dsaX, sizeof(CpaFlatBuffer)); ALLOC_STRUCT(dsaY, sizeof(CpaFlatBuffer)); ALLOC_STRUCT(dsaK, sizeof(CpaFlatBuffer)); ALLOC_STRUCT(dsaM, sizeof(CpaFlatBuffer)); ALLOC_STRUCT(dsaR, sizeof(CpaFlatBuffer)); ALLOC_STRUCT(dsaS, sizeof(CpaFlatBuffer)); ALLOC_STRUCT(dsaZ, sizeof(CpaFlatBuffer)); ALLOC_STRUCT(verifyOpData, sizeof(CpaCyDsaVerifyOpData)); /************************************************************************ * STAGE 1 Setup up the DSA parameters, generate X, G, Y, K, Z, * generate user defined number of messages to be signed * calculate the digest of the messages * sign all the messages * setup the verification data structure **************************************************************************/ /*set Q */ ALLOC_FLAT_BUFF_DATA(setup->cyInstanceHandle, &dsaQ, setup->qLenInBytes, qDataPtr, sizeOfq, FREE_DSA_MEM); /*generate X for each buffer */ for(i=0; i<setup->numBuffers; i++) { /*Choose X is generated by random method, where 0 < X < Q */ ALLOC_FLAT_BUFF_DATA(setup->cyInstanceHandle, &dsaX[i], setup->qLenInBytes, NULL, 0, FREE_DSA_MEM); dsaGenRandom(&dsaX[i], &dsaQ); } /*set P */ ALLOC_FLAT_BUFF_DATA(setup->cyInstanceHandle, &dsaP, setup->pLenInBytes, pDataPtr, sizeOfp, FREE_DSA_MEM); /*************************************************************************** * set genG opData and generate G * ************************************************************************/ /*H is required to genG */ ALLOC_FLAT_BUFF_DATA(setup->cyInstanceHandle, &dsaH, setup->pLenInBytes, NULL, 0, FREE_DSA_MEM); memset(dsaH.pData, 0, dsaH.dataLenInBytes); dsaH.pData[setup->pLenInBytes-1] = DEFAULT_H_VALUE; /*allocate space for G */ ALLOC_FLAT_BUFF_DATA(setup->cyInstanceHandle, &dsaG, setup->pLenInBytes, NULL, 0, FREE_DSA_MEM); /*set opData to generate G */ gOpData.P.pData = dsaP.pData; gOpData.P.dataLenInBytes = dsaP.dataLenInBytes; gOpData.Q.pData = dsaQ.pData; gOpData.Q.dataLenInBytes = dsaQ.dataLenInBytes; gOpData.H.pData = dsaH.pData; gOpData.H.dataLenInBytes = dsaH.dataLenInBytes; status = dsaGenG(setup->cyInstanceHandle, &gOpData, &dsaG); if(CPA_STATUS_SUCCESS != status) { PRINT_ERR("Failed to generate DSA parameter G\n"); FREE_DSA_MEM; return CPA_STATUS_FAIL; } /*generate a Y for each buffer */ for(i=0;i<setup->numBuffers;i++) { /*set the opData to gen Y */ ALLOC_FLAT_BUFF_DATA(setup->cyInstanceHandle, &dsaY[i], setup->pLenInBytes, NULL, 0, FREE_DSA_MEM); yOpData.P.pData = dsaP.pData; yOpData.P.dataLenInBytes = dsaP.dataLenInBytes; yOpData.G.pData = dsaG.pData; yOpData.G.dataLenInBytes = dsaG.dataLenInBytes; yOpData.X.pData = dsaX[i].pData; yOpData.X.dataLenInBytes = dsaX[i].dataLenInBytes; status = dsaGenY(setup->cyInstanceHandle,&yOpData,&dsaY[i]); if(CPA_STATUS_SUCCESS != status) { PRINT_ERR("Error Generating Y for buffer %d\n", i); /*free all the pData buffers allocated and Array of pointers * allocated */ FREE_DSA_MEM; return CPA_STATUS_FAIL; } /*Generate a random per-message value K, where 0 < K < Q. */ ALLOC_FLAT_BUFF_DATA(setup->cyInstanceHandle, &dsaK[i], setup->qLenInBytes, NULL, 0, FREE_DSA_MEM); dsaGenRandom(&dsaK[i], &dsaQ); /*generate a message to sign */ /*allocate space for message */ ALLOC_FLAT_BUFF_DATA(setup->cyInstanceHandle, &dsaM[i], setup->pLenInBytes, NULL, 0, FREE_DSA_MEM); /*allocate space for digest of message */ ALLOC_FLAT_BUFF_DATA(setup->cyInstanceHandle, &dsaZ[i], setup->qLenInBytes, NULL, 0, FREE_DSA_MEM); /*generate random message */ generateRandomData(dsaM[i].pData, dsaM[i].dataLenInBytes); /*calculate digest of message */ status = dsaGenZ(setup->cyInstanceHandle, &dsaM[i], setup->hashAlg, &dsaZ[i]); if(CPA_STATUS_SUCCESS != status) { PRINT_ERR("Error Generating Z for buffer %d\n", i); FREE_DSA_MEM; return CPA_STATUS_FAIL; } /*Gen R & S signature */ rsOpData.G.pData = dsaG.pData; rsOpData.G.dataLenInBytes = dsaG.dataLenInBytes; rsOpData.K.pData = dsaK[i].pData; rsOpData.K.dataLenInBytes = dsaK[i].dataLenInBytes; rsOpData.P.pData = dsaP.pData; rsOpData.P.dataLenInBytes = dsaP.dataLenInBytes; rsOpData.Q.pData = dsaQ.pData; rsOpData.Q.dataLenInBytes = dsaQ.dataLenInBytes; rsOpData.X.pData = dsaX[i].pData; rsOpData.X.dataLenInBytes = dsaX[i].dataLenInBytes; rsOpData.Z.pData = dsaZ[i].pData; rsOpData.Z.dataLenInBytes = dsaZ[i].dataLenInBytes; ALLOC_FLAT_BUFF_DATA(setup->cyInstanceHandle, &dsaR[i], setup->qLenInBytes, NULL, 0, FREE_DSA_MEM); ALLOC_FLAT_BUFF_DATA(setup->cyInstanceHandle, &dsaS[i], setup->qLenInBytes, NULL, 0, FREE_DSA_MEM); status = dsaGenRS(setup->cyInstanceHandle, &rsOpData, &dsaR[i], &dsaS[i]); if(CPA_STATUS_SUCCESS != status) { PRINT_ERR("Error Generating R&S for buffer %d\n", i); FREE_DSA_MEM; return CPA_STATUS_FAIL; } /*Verify signature */ verifyOpData[i].P.pData = dsaP.pData; verifyOpData[i].P.dataLenInBytes = dsaP.dataLenInBytes; verifyOpData[i].Q.pData = dsaQ.pData; verifyOpData[i].Q.dataLenInBytes = dsaQ.dataLenInBytes; verifyOpData[i].G.pData= dsaG.pData; verifyOpData[i].G.dataLenInBytes = dsaG.dataLenInBytes; verifyOpData[i].Y.pData= dsaY[i].pData; verifyOpData[i].Y.dataLenInBytes = dsaY[i].dataLenInBytes; verifyOpData[i].Z.pData= dsaZ[i].pData; verifyOpData[i].Z.dataLenInBytes = dsaZ[i].dataLenInBytes; verifyOpData[i].R.pData= dsaR[i].pData; verifyOpData[i].R.dataLenInBytes = dsaR[i].dataLenInBytes; verifyOpData[i].S.pData= dsaS[i].pData; verifyOpData[i].S.dataLenInBytes = dsaS[i].dataLenInBytes; } /*set the callback function if asynchronous mode is set*/ if(ASYNC == setup->syncMode) { cbFunc = dsaVerifyCb; } /************************************************************************ * STAGE 2 repeatedly verify all the signatures and measure the performance ************************************************************************* */ /*this barrier will wait until all threads get to this point */ sampleCodeBarrier(); /* get a timestamp before submitting any requests. After submitting * all requests a final timestamp is taken in the callback function. * These two times and the number of requests submitted are used to * calculate operations per second */ pDsaData->startCyclesTimestamp = sampleCodeTimestamp(); for(outerLoop = 0; outerLoop<setup->numLoops; outerLoop++) { for(i=0;i<setup->numBuffers;i++) { do { status = cpaCyDsaVerify(setup->cyInstanceHandle, cbFunc, pDsaData, &verifyOpData[i], &verifyStatus); if(CPA_STATUS_RETRY == status) { pDsaData->retries++; /*once we get to many retries, perform a context switch * to give the acceleration engine a small break */ if(RETRY_LIMIT == (pDsaData->retries % (RETRY_LIMIT+1))) { AVOID_SOFTLOCKUP; } } } while (CPA_STATUS_RETRY == status); /*if for some reason the DSA verify returns fail, decrease the * numOperations expected in the callback so that the code does not * wait forever */ if(CPA_STATUS_SUCCESS != status) { PRINT_ERR("DSA Verify function failed with status:%d\n", status); break; } } if(CPA_STATUS_SUCCESS != status) { break; } } if (CPA_STATUS_SUCCESS == status) { status = waitForResponses(pDsaData, setup->syncMode, setup->numBuffers, setup->numLoops); } /*free Arrays of buffer pointers and pData */ FREE_DSA_MEM; sampleCodeSemaphoreDestroy(&pDsaData->comp); pDsaData->threadReturnStatus = status; if(CPA_STATUS_SUCCESS != setup->performanceStats->threadReturnStatus) { status = CPA_STATUS_FAIL; } return status; }