X-Git-Url: https://git.saurik.com/apple/security.git/blobdiff_plain/80e2389990082500d76eb566d4946be3e786c3ef..d8f41ccd20de16f8ebe2ccc84d47bf1cb2b26bbb:/SecurityTests/clxutils/threadTest/digestClient.cpp?ds=inline diff --git a/SecurityTests/clxutils/threadTest/digestClient.cpp b/SecurityTests/clxutils/threadTest/digestClient.cpp new file mode 100644 index 00000000..92f1001a --- /dev/null +++ b/SecurityTests/clxutils/threadTest/digestClient.cpp @@ -0,0 +1,59 @@ +/* + * digestClient.cpp + */ +#include "testParams.h" +#include +#include + +/* for malloc debug */ +#define DO_PAUSE 0 + +int digestClientInit(TestParams *testParams) +{ + return 0; +} + +using namespace Security; +using namespace CssmClient; + +int digestClient(TestParams *testParams) +{ + unsigned loopNum; + + for(loopNum=0; loopNumnumLoops; loopNum++) { + if(testParams->verbose) { + printf("secTrustEval loop %d\n", loopNum); + } + else if(!testParams->quiet) { + printChar(testParams->progressChar); + } + try { + CSP *csp = new CSP(gGuidAppleCSP); + uint8 digData[20]; + Digest *digest = new Digest(*csp, CSSM_ALGID_SHA1); + CssmData ptext((char *)"test", 4); + CssmData dig(digData, sizeof(digData)); + digest->digest(ptext, dig); + if(dig.Length != 20) { + printf("***digest length error\n"); + return 1; + } + delete digest; + delete csp; + } + catch(...) { + printf("***CSP/Digest client threw exeption\n"); + return 1; + } + + #if DO_PAUSE + fpurge(stdin); + printf("Hit CR to continue: "); + getchar(); + #endif + } /* outer loop */ + #if HOLD_SEARCH_LIST + CFRelease(sl); + #endif + return 0; +}