in unittest/lib/testDl.cpp [641:728]
VOID testDlRunAlgs()
{
BYTE rbInput[TEST_DL_MAX_NUMOF_BYTES] = { 0 };
SIZE_T cbInput = 0;
BYTE rbOutput[2*TEST_DL_MAX_NUMOF_BYTES] = { 0 };
SIZE_T cbOutput = 0;
BYTE rbExtra[TEST_DL_MAX_NUMOF_BYTES] = { 0 };
SIZE_T cbExtra = 0;
PCSYMCRYPT_HASH pHashAlgorithm = NULL;
InteropRandFn randFunc = NULL;
InteropDataFn queryFn = NULL; // Sign function
InteropDataFn replyFn = NULL; // Verify function
UINT32 iImplFrom = 0;
UINT32 iImplTo = 0;
vprint( g_verbose, "\n");
for( std::vector<AlgorithmImplementation *>::iterator i = g_DlAlgList.begin(); i != g_DlAlgList.end(); i++ )
{
iImplFrom = testInteropImplToInd( *i );
vprint( g_verbose, " > Algorithm: %s From: %s\n", (*i)->m_algorithmName.c_str(), g_Implementations[iImplFrom].name );
randFunc = ((FunctionalInteropImplementation *)(*i))->m_RandFunction;
CHECK( randFunc != NULL, "No randomizing function.\n");
queryFn = ((FunctionalInteropImplementation *)(*i))->m_QueryFunction;
CHECK( queryFn != NULL, "No encryption / signing function.\n");
for( std::vector<AlgorithmImplementation *>::iterator j = g_DlAlgList.begin(); j != g_DlAlgList.end(); j++ )
{
// Run tests if the algorithms are the same and at least one implementation is SymCrypt
if (( (*i)->m_algorithmName == (*j)->m_algorithmName ) &&
( ((*i)->m_implementationName == ImpSc::name) || ((*j)->m_implementationName == ImpSc::name) ))
{
iImplTo = testInteropImplToInd( *j );
replyFn = ((FunctionalInteropImplementation *)(*j))->m_ReplyFunction;
CHECK( replyFn != NULL, "No decryption/verify function.\n");
vprint( g_verbose, " >>>> To: %s\n", g_Implementations[iImplTo].name );
for (UINT32 entry = 0; entry < TEST_DL_NUMOF_ENTRIES; entry++)
{
for (UINT32 nTries = 0; nTries<TEST_DL_NUMOF_RANDOM_TRIES; nTries++)
{
(*randFunc)(
(PBYTE) &g_DlKeyEntries[entry],
rbInput,
&cbInput,
rbOutput,
&cbOutput,
rbExtra,
&cbExtra,
&pHashAlgorithm );
(*queryFn)(
(PBYTE) &g_DlKeyEntries[entry],
rbInput,
cbInput,
rbOutput,
cbOutput,
rbExtra,
cbExtra,
pHashAlgorithm );
(*replyFn)(
(PBYTE) &g_DlKeyEntries[entry],
rbInput,
cbInput,
rbOutput,
cbOutput,
rbExtra,
cbExtra,
pHashAlgorithm );
(*i)->m_nResults ++;
}
}
}
}
}
}