diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2011-09-11 18:05:40 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2011-09-11 18:05:40 +0000 |
commit | 288fe07a6e3e4d61e71db84ce31135cc6d1789ce (patch) | |
tree | 261f18bffe37a9ed0461230e36680f81932d0c7f /fips/des | |
parent | 7fdcb45745c01b90b256fe97e87eae31453e11e6 (diff) |
Fix 3DES Monte Carlo test file output which previously outputted
extra bogus lines. Update fipsalgtest.pl to tolerate the old format.
Diffstat (limited to 'fips/des')
-rw-r--r-- | fips/des/fips_desmovs.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/fips/des/fips_desmovs.c b/fips/des/fips_desmovs.c index ee65e098d2..30fa01fa3c 100644 --- a/fips/des/fips_desmovs.c +++ b/fips/des/fips_desmovs.c @@ -177,7 +177,6 @@ static void do_mct(char *amode, printf("Unrecognized mode: %s\n", amode); EXIT(1); } - for(i=0 ; i < 400 ; ++i) { int j; @@ -277,7 +276,7 @@ static int proc_file(char *rqfile, char *rspfile) char atest[100] = ""; int akeysz=0; unsigned char iVec[20], aKey[40]; - int dir = -1, err = 0, step = 0; + int dir = -1, err = 0, step = 0, echo = 1; unsigned char plaintext[2048]; unsigned char ciphertext[2048]; char *rp; @@ -383,6 +382,8 @@ static int proc_file(char *rqfile, char *rspfile) n = strlen(xp+1)-1; strncpy(amode, xp+1, n); amode[n] = '\0'; + if (!strcmp(atest, "Monte")) + echo = 0; /* amode[3] = '\0'; */ if (VERBOSE) printf("Test=%s, Mode=%s\n",atest,amode); @@ -439,8 +440,8 @@ static int proc_file(char *rqfile, char *rspfile) numkeys=atoi(ibuf+10); break; } - - fputs(ibuf, rfp); + if (echo) + fputs(ibuf, rfp); if(!fips_strncasecmp(ibuf,"KEY = ",6)) { akeysz=64; @@ -495,7 +496,8 @@ static int proc_file(char *rqfile, char *rspfile) break; case 3: /* IV = xxxx */ - fputs(ibuf, rfp); + if (echo) + fputs(ibuf, rfp); if (fips_strncasecmp(ibuf, "IV = ", 5) != 0) { printf("Missing IV\n"); @@ -516,7 +518,8 @@ static int proc_file(char *rqfile, char *rspfile) break; case 4: /* PLAINTEXT = xxxx */ - fputs(ibuf, rfp); + if (echo) + fputs(ibuf, rfp); if (fips_strncasecmp(ibuf, "PLAINTEXT = ", 12) != 0) { printf("Missing PLAINTEXT\n"); @@ -558,7 +561,8 @@ static int proc_file(char *rqfile, char *rspfile) break; case 5: /* CIPHERTEXT = xxxx */ - fputs(ibuf, rfp); + if (echo) + fputs(ibuf, rfp); if (fips_strncasecmp(ibuf, "CIPHERTEXT = ", 13) != 0) { printf("Missing KEY\n"); |