1 /* cssmErrorString per-thread basher */
4 #include "testParams.h"
5 #include <Security/SecBasePriv.h>
6 #include <Security/cssmerr.h>
8 /* nothing here for now */
9 int cssmErrStrInit(TestParams
*tp
)
14 CSSM_RETURN variousErrors
[] = {
15 CSSMERR_CSP_INVALID_CONTEXT
,
16 CSSMERR_CSP_INVALID_ALGORITHM
,
17 CSSMERR_CSP_INVALID_ATTR_KEY
,
18 CSSMERR_CSP_MISSING_ATTR_KEY
,
19 CSSMERR_CSP_INVALID_ATTR_INIT_VECTOR
,
20 CSSMERR_CSP_MISSING_ATTR_INIT_VECTOR
,
21 CSSMERR_CSP_INVALID_ATTR_SALT
,
22 CSSMERR_CSP_MISSING_ATTR_SALT
,
23 CSSMERR_CSP_INVALID_ATTR_PADDING
,
24 CSSMERR_CSP_MISSING_ATTR_PADDING
,
25 CSSMERR_CSP_INVALID_ATTR_RANDOM
,
26 CSSMERR_CSP_MISSING_ATTR_RANDOM
,
27 CSSMERR_CSP_INVALID_ATTR_SEED
,
28 CSSMERR_CSP_MISSING_ATTR_SEED
,
29 CSSMERR_CSP_INVALID_ATTR_PASSPHRASE
,
30 CSSMERR_CSP_MISSING_ATTR_PASSPHRASE
,
31 CSSMERR_CSP_INVALID_ATTR_KEY_LENGTH
,
32 CSSMERR_CSP_MISSING_ATTR_KEY_LENGTH
,
33 CSSMERR_CSP_INVALID_ATTR_BLOCK_SIZE
,
34 CSSMERR_CSP_MISSING_ATTR_BLOCK_SIZE
,
35 CSSMERR_CSP_INVALID_ATTR_OUTPUT_SIZE
,
36 CSSMERR_CSP_MISSING_ATTR_OUTPUT_SIZE
,
37 CSSMERR_CSP_INVALID_ATTR_ROUNDS
39 #define NUM_ERRORS (sizeof(variousErrors) / sizeof(variousErrors[0]))
41 int cssmErrStr(TestParams
*testParams
)
43 for(unsigned loopNum
=0; loopNum
<testParams
->numLoops
; loopNum
++) {
44 if(testParams
->verbose
) {
45 printf("cssmErrStr loop %d\n", loopNum
);
47 else if(!testParams
->quiet
) {
48 printChar(testParams
->progressChar
);
51 for(unsigned dex
=0; dex
<NUM_ERRORS
; dex
++) {
52 unsigned whichErr
= (dex
+ testParams
->threadNum
) % NUM_ERRORS
;
53 const char *es
= cssmErrorString(variousErrors
[whichErr
]);
54 if(testParams
->verbose
) {