summaryrefslogtreecommitdiff
path: root/security/nss/cmd/bltest
diff options
context:
space:
mode:
authormcgreer%netscape.com <devnull@localhost>2000-09-29 22:27:14 +0000
committermcgreer%netscape.com <devnull@localhost>2000-09-29 22:27:14 +0000
commit83dcad8f48bbae175f0980fd6d057b835c2e71a8 (patch)
tree54de25704e13adc92068f63b656d3722ed7bfb96 /security/nss/cmd/bltest
parentb881304a9aab3eeb2de7ef09da967f2f6425e9f4 (diff)
downloadnss-hg-83dcad8f48bbae175f0980fd6d057b835c2e71a8.tar.gz
changes to use blapitest on NT.
Diffstat (limited to 'security/nss/cmd/bltest')
-rw-r--r--security/nss/cmd/bltest/blapitest.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/security/nss/cmd/bltest/blapitest.c b/security/nss/cmd/bltest/blapitest.c
index c1693cf1d..91d83dc2c 100644
--- a/security/nss/cmd/bltest/blapitest.c
+++ b/security/nss/cmd/bltest/blapitest.c
@@ -1509,7 +1509,10 @@ blapi_selftest(char **modesToTest, int numModesToTest,
{
blapitestCryptoFn cryptofn;
blapitestInfo info;
- SECItem output, asciiOut, item, inpCopy;
+ SECItem output = { 0, 0, 0 };
+ SECItem asciiOut = { 0, 0, 0 };
+ SECItem inpCopy = { 0, 0, 0 };
+ SECItem item = { 0, 0, 0 };
SECStatus rv;
char filename[256];
PRFileDesc *file;
@@ -1545,20 +1548,29 @@ blapi_selftest(char **modesToTest, int numModesToTest,
fprintf(stderr, "File %s does not exist.\n", filename);
return SECFailure;
}
+ memset(&item, 0, sizeof(item));
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++) {
+ memset(&info.key, 0, sizeof(info.key));
+ memset(&info.iv, 0, sizeof(info.iv));
+ memset(&info.in, 0, sizeof(info.in));
+ memset(&info.seed, 0, sizeof(info.seed));
+ memset(&info.sigseed, 0, sizeof(info.sigseed));
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);
+#if 0
rv = get_ascii_file_data(&info.seed, mode, "keyseed", j);
+#endif
rv = get_ascii_file_data(&info.sigseed, mode, "sigseed", j);
SECITEM_CopyItem(NULL, &inpCopy, &info.in);
get_params(&info, mode, j);
sprintf(filename, "%s/tests/%s/%s%d", testdir, mode,
"ciphertext", j);
file = PR_Open(filename, PR_RDONLY, 00440);
+ memset(&asciiOut, 0, sizeof(asciiOut));
rv = SECU_FileToItem(&asciiOut, file);
PR_Close(file);
rv = atob(&asciiOut, &output);
@@ -1572,6 +1584,11 @@ blapi_selftest(char **modesToTest, int numModesToTest,
}*/
decrypt:
if (!decrypt) continue;
+ if (PL_strcmp(mode, "md2") == 0 ||
+ PL_strcmp(mode, "md5") == 0 ||
+ PL_strcmp(mode, "sha1") == 0) {
+ continue; /* hashes only go once */
+ }
info.encrypt = info.hash = info.sign = PR_FALSE;
info.decrypt = info.verify = PR_TRUE;
if (PL_strcmp(mode, "dsa") == 0) {
@@ -1608,7 +1625,7 @@ get_file_data(char *filename, SECItem *item, PRBool b64)
SECStatus rv = SECSuccess;
PRFileDesc *file = PR_Open(filename, PR_RDONLY, 006600);
if (file) {
- SECItem asciiItem;
+ SECItem asciiItem = { 0, 0, 0 };
rv = SECU_FileToItem(&asciiItem, file);
CHECKERROR(rv, __LINE__);
if (b64) {