diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2011-10-01 20:42:52 +0000 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2011-10-01 20:42:52 +0000 |
commit | 4cc2bbab6758b73e005d69cb454cb9ba269859df (patch) | |
tree | 6c3d6059670677b55dd7756b1b24840880d20088 /fips/aes | |
parent | 04c3aa5c1ab4244293ca60f6aeabb431e8b44cbe (diff) |
Make fips algorithm test utilities use RESP_EOL for end of line character(s).
This should be CRLF even under *nix.
Diffstat (limited to 'fips/aes')
-rw-r--r-- | fips/aes/fips_aesavs.c | 23 | ||||
-rw-r--r-- | fips/aes/fips_gcmtest.c | 6 |
2 files changed, 15 insertions, 14 deletions
diff --git a/fips/aes/fips_aesavs.c b/fips/aes/fips_aesavs.c index dae8023d0a..84bcbac32a 100644 --- a/fips/aes/fips_aesavs.c +++ b/fips/aes/fips_aesavs.c @@ -283,7 +283,7 @@ static int do_mct(char *amode, /* printf("Iteration %d\n", i); */ if (i > 0) { - fprintf(rfp,"COUNT = %d\n",i); + fprintf(rfp,"COUNT = %d" RESP_EOL ,i); OutputValue("KEY",key[i],nkeysz,rfp,0); if (imode != ECB) /* ECB */ OutputValue("IV",iv[i],AES_BLOCK_SIZE,rfp,0); @@ -419,7 +419,7 @@ static int do_mct(char *amode, /* Output Ciphertext | Plaintext */ OutputValue(t_tag[dir],dir ? ctext[j] : ptext[j],len,rfp, imode == CFB1); - fprintf(rfp, "\n"); /* add separator */ + fprintf(rfp, RESP_EOL); /* add separator */ /* Compute next KEY */ if (dir == XENCRYPT) @@ -622,7 +622,7 @@ static int proc_file(char *rqfile, char *rspfile) } else { - fputs(ibuf, rfp); + copy_line(ibuf, rfp); ++ step; } } @@ -638,11 +638,12 @@ static int proc_file(char *rqfile, char *rspfile) if (akeysz) { /* insert current time & date */ time_t rtim = time(0); - fprintf(rfp, "# %s", ctime(&rtim)); + fputs("# ", rfp); + copy_line(ctime(&rtim), rfp); } else { - fputs(ibuf, rfp); + copy_line(ibuf, rfp); if (strncmp(pp, "AESVS ", 6) == 0) { strcpy(algo, "AES"); @@ -674,7 +675,7 @@ static int proc_file(char *rqfile, char *rspfile) case 1: /* [ENCRYPT] | [DECRYPT] */ if (ibuf[0] == '[') { - fputs(ibuf, rfp); + copy_line(ibuf, rfp); ++step; if (fips_strncasecmp(ibuf, "[ENCRYPT]", 9) == 0) dir = 1; @@ -697,7 +698,7 @@ static int proc_file(char *rqfile, char *rspfile) step = 2; case 2: /* KEY = xxxx */ - fputs(ibuf, rfp); + copy_line(ibuf, rfp); if(*ibuf == '\n') break; if(!fips_strncasecmp(ibuf,"COUNT = ",8)) @@ -729,7 +730,7 @@ static int proc_file(char *rqfile, char *rspfile) break; case 3: /* IV = xxxx */ - fputs(ibuf, rfp); + copy_line(ibuf, rfp); if (fips_strncasecmp(ibuf, "IV = ", 5) != 0) { printf("Missing IV\n"); @@ -750,7 +751,7 @@ static int proc_file(char *rqfile, char *rspfile) break; case 4: /* PLAINTEXT = xxxx */ - fputs(ibuf, rfp); + copy_line(ibuf, rfp); if (fips_strncasecmp(ibuf, "PLAINTEXT = ", 12) != 0) { printf("Missing PLAINTEXT\n"); @@ -794,7 +795,7 @@ static int proc_file(char *rqfile, char *rspfile) break; case 5: /* CIPHERTEXT = xxxx */ - fputs(ibuf, rfp); + copy_line(ibuf, rfp); if (fips_strncasecmp(ibuf, "CIPHERTEXT = ", 13) != 0) { printf("Missing KEY\n"); @@ -839,7 +840,7 @@ static int proc_file(char *rqfile, char *rspfile) } else if (strcmp(atest, "MCT") != 0) { /* MCT already added terminating nl */ - fputs(ibuf, rfp); + copy_line(ibuf, rfp); } step = 1; break; diff --git a/fips/aes/fips_gcmtest.c b/fips/aes/fips_gcmtest.c index bfb6c2700c..3839de8f8a 100644 --- a/fips/aes/fips_gcmtest.c +++ b/fips/aes/fips_gcmtest.c @@ -243,7 +243,7 @@ static void gcmtest(FILE *in, FILE *out, int encrypt) } rv = FIPS_cipher(&ctx, NULL, NULL, 0); if (rv < 0) - fprintf(out, "FAIL\n"); + fprintf(out, "FAIL" RESP_EOL); else OutputValue("PT", pt, ptlen, out, 0); if (iv) @@ -479,11 +479,11 @@ static void ccmtest(FILE *in, FILE *out) { if (rv == 0) Payload[0] = 0; - fputs("Result = Pass\n", out); + fputs("Result = Pass" RESP_EOL, out); OutputValue("Payload", Payload, len, out, 0); } else - fputs("Result = Fail\n", out); + fputs("Result = Fail" RESP_EOL, out); OPENSSL_free(CT); OPENSSL_free(Payload); CT = Payload = NULL; |