sprintf(filename, "tests/%s/%s", mode, "numtests");
sprintf(filename, "%s/tests/%s/%s", testdir, mode, "numtests");
blapi_selftest(char **modesToTest, int numModesToTest){	blapitestCryptoFn cryptofn;	blapitestInfo info;	SECItem output, asciiOut, item, inpCopy;	SECStatus rv;	char filename[32];	PRFileDesc *file;	char *mode;	int i, j, nummodes;	PORT_Memset(&info, 0, sizeof(info));	info.repetitions = 1;	info.useseed = PR_TRUE;	info.usesigseed = PR_TRUE;	if (modesToTest) {		/* user gave a list of modes to test */		nummodes = numModesToTest;	} else {		/* test all modes */		nummodes = sizeof(mode_strings) / sizeof(char *);	}	for (i=0; i<nummodes; i++) {		if (modesToTest) {			mode = modesToTest[i];		} else {			mode = mode_strings[i];		}		cryptofn = get_test_mode(mode);		if (mode[0] == '#') continue;		/* get the number of tests in the directory */		sprintf(filename, "tests/%s/%s", mode, "numtests");		file = PR_Open(filename, PR_RDONLY, 00440);		rv = SECU_FileToItem(&item, file);		PR_Close(file);		/* loop over the tests in the directory */		for (j=0; j<(int)(item.data[0] - '0'); j++) {			rv = get_ascii_file_data(&info.key, mode, "key", j);			rv = get_ascii_file_data(&info.iv, mode, "iv", j);			rv = get_ascii_file_data(&info.in, mode, "plaintext", j);			rv = get_ascii_file_data(&info.seed, mode, "pqgseed", j);			rv = get_ascii_file_data(&info.sigseed, mode, "sigseed", j);			SECITEM_CopyItem(NULL, &inpCopy, &info.in);			get_params(&info, mode, j);			sprintf(filename, "tests/%s/%s%d", mode, "ciphertext", j);			file = PR_Open(filename, PR_RDONLY, 00440);			rv = SECU_FileToItem(&asciiOut, file);			PR_Close(file);			rv = atob(&asciiOut, &output);			info.encrypt = info.hash = info.sign = PR_TRUE;			(*cryptofn)(&info);			if (SECITEM_CompareItem(&output, &info.out) != 0) {				fprintf(stderr, "encrypt self-test for %s failed!\n", mode);			} else {				fprintf(stderr, "encrypt self-test for %s passed.\n", mode);			}			info.encrypt = info.hash = info.sign = PR_FALSE;			info.decrypt = info.verify = PR_TRUE;			SECITEM_ZfreeItem(&info.out, PR_FALSE);			SECITEM_ZfreeItem(&info.in, PR_FALSE);			SECITEM_CopyItem(NULL, &info.in, &output);			info.out.len = 0;			rv = (*cryptofn)(&info);			if (rv == SECSuccess) {				if (SECITEM_CompareItem(&inpCopy, &info.out) != 0) {					fprintf(stderr, "decrypt self-test for %s failed!\n", mode);				} else {					fprintf(stderr, "decrypt self-test for %s passed.\n", mode);				}			}		}	}}