return blapi_selftest(modesToTest, numModesToTest);
return blapi_selftest(modesToTest, numModesToTest, info.encrypt, info.decrypt);
int main(int argc, char **argv) {	char *infile, *outfile, *keyfile, *ivfile, *sigfile, *seedfile,	     *sigseedfile, *pqgfile;	PRBool b64 = PR_TRUE;	blapitestInfo info;	blapitestCryptoFn cryptofn = NULL;	PLOptState *optstate;	PLOptStatus status;	PRBool dofips = PR_FALSE;	PRBool doselftest = PR_FALSE;	PRBool zerobuffer = PR_FALSE;	char *dumpfile = NULL;	char *mode = NULL;	char *modesToTest[20];	int numModesToTest = 0;	SECStatus rv;	PORT_Memset(&info, 0, sizeof(info));	info.bufsize = 8;	info.keysize = DES_KEY_LENGTH;	info.rsapubexp = 17;	info.rounds = 10;	info.wordsize = 4;	infile=outfile=keyfile=pqgfile=ivfile=sigfile=seedfile=sigseedfile=NULL;	info.repetitions = 1;    progName = strrchr(argv[0], '/');    progName = progName ? progName+1 : argv[0];	optstate = PL_CreateOptState(argc, argv, 	    "DEFHP:STVab:d:ce:g:j:i:o:p:k:m:t:qr:s:v:w:xyz:");	while ((status = PL_GetNextOpt(optstate)) == PL_OPT_OK) {		switch (optstate->option) {		case 'D':  info.decrypt = PR_TRUE; break;		case 'E':  info.encrypt = PR_TRUE; break;		case 'F':  dofips = PR_TRUE; break;		case 'H':  info.hash = PR_TRUE; break;		case 'P':  dumpfile = PL_strdup(optstate->value); break;		case 'S':  info.sign = PR_TRUE; break;		case 'T':  doselftest = PR_TRUE; break;		case 'V':  info.verify = PR_TRUE; break;		case 'a':  b64 = PR_FALSE; break;		case 'b':  info.bufsize = PORT_Atoi(optstate->value); break;		case 'c':  info.multihash = PR_TRUE; break;		case 'd':  testdir = PL_strdup(optstate->value); break;		case 'e':  info.rsapubexp = PORT_Atoi(optstate->value); break;		case 'g':  info.keysize = PORT_Atoi(optstate->value); break;		case 'i':  infile  = PL_strdup(optstate->value); break;		case 'j':  pqgfile = PL_strdup(optstate->value); break;		case 'k':  keyfile = PL_strdup(optstate->value); break;		case 'm':  cryptofn = get_test_mode(optstate->value);		           mode = PL_strdup(optstate->value); 		           break;		case 'o':  outfile = PL_strdup(optstate->value); break;		case 'p':  info.performance = PR_TRUE; 			   info.repetitions = PORT_Atoi(optstate->value); 			   break;		case 'q':  zerobuffer = PR_TRUE; break;		case 'r':  info.rounds = PORT_Atoi(optstate->value); break;		case 's':  sigfile  = PL_strdup(optstate->value); break;		case 't':  sigseedfile = PL_strdup(optstate->value); break;		case 'v':  ivfile  = PL_strdup(optstate->value); break;		case 'w':  info.wordsize = PORT_Atoi(optstate->value); break;		case 'x':  info.useseed = PR_TRUE; break;		case 'y':  info.usesigseed = PR_TRUE; break;		case 'z':  seedfile  = PL_strdup(optstate->value); break;		case '\0': if (optstate->value[0] != '-')					   modesToTest[numModesToTest++] = 						PL_strdup(optstate->value);				   break;		default: break;		}	}	if (dumpfile)		return dump_file(mode, dumpfile);	if (doselftest) {		if (numModesToTest > 0) {			return blapi_selftest(modesToTest, numModesToTest);		} else {			return blapi_selftest(NULL, 0);		}	}	if (dofips) {		CK_RV foo = pk11_fipsPowerUpSelfTest();		PR_fprintf(PR_STDOUT, "CK_RV: %d.\n", foo);		return 0;	}	if (!info.encrypt && !info.decrypt && !info.hash && 	    !info.sign && !info.verify)		Usage();	if (!cryptofn) {		printmodes(&info);		return -1;	}	if (info.decrypt && !infile)		Usage();	if (info.performance) {		char buf[256];		PRStatus stat;		stat = PR_GetSystemInfo(PR_SI_HOSTNAME, buf, sizeof(buf));		printf("HOST: %s\n", buf);		stat = PR_GetSystemInfo(PR_SI_SYSNAME, buf, sizeof(buf));		printf("SYSTEM: %s\n", buf);		stat = PR_GetSystemInfo(PR_SI_RELEASE, buf, sizeof(buf));		printf("RELEASE: %s\n", buf);		stat = PR_GetSystemInfo(PR_SI_ARCHITECTURE, buf, sizeof(buf));		printf("ARCH: %s\n", buf);	}	RNG_RNGInit();	if (keyfile) {		/* RSA and DSA keys are always b64 encoded. */		if (b64 || PL_strcmp(mode,"rsa")==0 || PL_strcmp(mode,"dsa")==0)			get_file_data(keyfile, &info.key, PR_TRUE);		else			get_file_data(keyfile, &info.key, b64);	}	if (ivfile)		get_file_data(ivfile, &info.iv, b64);	if (infile)		get_file_data(infile, &info.in, b64);	if (sigfile)		get_file_data(sigfile, &info.out, PR_TRUE);	if (seedfile) {		get_file_data(seedfile, &info.seed, b64);		info.useseed = PR_TRUE;	}	if (sigseedfile) {		get_file_data(sigseedfile, &info.sigseed, b64);		info.usesigseed = PR_TRUE;	}	if (pqgfile)		get_file_data(pqgfile, &info.pqg, PR_TRUE);	if (zerobuffer) {		PRFileDesc *ifile;		info.in.len = info.bufsize;		info.in.data = PORT_ZAlloc(info.in.len);		ifile = PR_Open("tmp.pt", PR_WRONLY|PR_CREATE_FILE, 00660);		rv = btoa_file(&info.in, ifile);		CHECKERROR((rv < 0), __LINE__);		PR_Close(ifile);	}	rv = (*cryptofn)(&info);		CHECKERROR(rv, __LINE__);	if (!sigfile && info.out.len > 0) {		PRFileDesc *ofile;		if (!outfile)			ofile = PR_Open("tmp.out", PR_WRONLY|PR_CREATE_FILE, 00660);		else			ofile = PR_Open(outfile, PR_WRONLY|PR_CREATE_FILE, 00660);		rv = btoa_file(&info.out, ofile);		PR_Close(ofile);		CHECKERROR((rv < 0), __LINE__);	}	RNG_RNGShutdown();	return SECSuccess;}