Make fips algorithm test utilities use RESP_EOL for end of line character(s).

This should be CRLF even under *nix.
This commit is contained in:
Dr. Stephen Henson 2011-10-01 20:42:52 +00:00
parent 04c3aa5c1a
commit 4cc2bbab67
11 changed files with 88 additions and 66 deletions

View file

@ -283,7 +283,7 @@ static int do_mct(char *amode,
/* printf("Iteration %d\n", i); */ /* printf("Iteration %d\n", i); */
if (i > 0) if (i > 0)
{ {
fprintf(rfp,"COUNT = %d\n",i); fprintf(rfp,"COUNT = %d" RESP_EOL ,i);
OutputValue("KEY",key[i],nkeysz,rfp,0); OutputValue("KEY",key[i],nkeysz,rfp,0);
if (imode != ECB) /* ECB */ if (imode != ECB) /* ECB */
OutputValue("IV",iv[i],AES_BLOCK_SIZE,rfp,0); OutputValue("IV",iv[i],AES_BLOCK_SIZE,rfp,0);
@ -419,7 +419,7 @@ static int do_mct(char *amode,
/* Output Ciphertext | Plaintext */ /* Output Ciphertext | Plaintext */
OutputValue(t_tag[dir],dir ? ctext[j] : ptext[j],len,rfp, OutputValue(t_tag[dir],dir ? ctext[j] : ptext[j],len,rfp,
imode == CFB1); imode == CFB1);
fprintf(rfp, "\n"); /* add separator */ fprintf(rfp, RESP_EOL); /* add separator */
/* Compute next KEY */ /* Compute next KEY */
if (dir == XENCRYPT) if (dir == XENCRYPT)
@ -622,7 +622,7 @@ static int proc_file(char *rqfile, char *rspfile)
} }
else else
{ {
fputs(ibuf, rfp); copy_line(ibuf, rfp);
++ step; ++ step;
} }
} }
@ -638,11 +638,12 @@ static int proc_file(char *rqfile, char *rspfile)
if (akeysz) if (akeysz)
{ /* insert current time & date */ { /* insert current time & date */
time_t rtim = time(0); time_t rtim = time(0);
fprintf(rfp, "# %s", ctime(&rtim)); fputs("# ", rfp);
copy_line(ctime(&rtim), rfp);
} }
else else
{ {
fputs(ibuf, rfp); copy_line(ibuf, rfp);
if (strncmp(pp, "AESVS ", 6) == 0) if (strncmp(pp, "AESVS ", 6) == 0)
{ {
strcpy(algo, "AES"); strcpy(algo, "AES");
@ -674,7 +675,7 @@ static int proc_file(char *rqfile, char *rspfile)
case 1: /* [ENCRYPT] | [DECRYPT] */ case 1: /* [ENCRYPT] | [DECRYPT] */
if (ibuf[0] == '[') if (ibuf[0] == '[')
{ {
fputs(ibuf, rfp); copy_line(ibuf, rfp);
++step; ++step;
if (fips_strncasecmp(ibuf, "[ENCRYPT]", 9) == 0) if (fips_strncasecmp(ibuf, "[ENCRYPT]", 9) == 0)
dir = 1; dir = 1;
@ -697,7 +698,7 @@ static int proc_file(char *rqfile, char *rspfile)
step = 2; step = 2;
case 2: /* KEY = xxxx */ case 2: /* KEY = xxxx */
fputs(ibuf, rfp); copy_line(ibuf, rfp);
if(*ibuf == '\n') if(*ibuf == '\n')
break; break;
if(!fips_strncasecmp(ibuf,"COUNT = ",8)) if(!fips_strncasecmp(ibuf,"COUNT = ",8))
@ -729,7 +730,7 @@ static int proc_file(char *rqfile, char *rspfile)
break; break;
case 3: /* IV = xxxx */ case 3: /* IV = xxxx */
fputs(ibuf, rfp); copy_line(ibuf, rfp);
if (fips_strncasecmp(ibuf, "IV = ", 5) != 0) if (fips_strncasecmp(ibuf, "IV = ", 5) != 0)
{ {
printf("Missing IV\n"); printf("Missing IV\n");
@ -750,7 +751,7 @@ static int proc_file(char *rqfile, char *rspfile)
break; break;
case 4: /* PLAINTEXT = xxxx */ case 4: /* PLAINTEXT = xxxx */
fputs(ibuf, rfp); copy_line(ibuf, rfp);
if (fips_strncasecmp(ibuf, "PLAINTEXT = ", 12) != 0) if (fips_strncasecmp(ibuf, "PLAINTEXT = ", 12) != 0)
{ {
printf("Missing PLAINTEXT\n"); printf("Missing PLAINTEXT\n");
@ -794,7 +795,7 @@ static int proc_file(char *rqfile, char *rspfile)
break; break;
case 5: /* CIPHERTEXT = xxxx */ case 5: /* CIPHERTEXT = xxxx */
fputs(ibuf, rfp); copy_line(ibuf, rfp);
if (fips_strncasecmp(ibuf, "CIPHERTEXT = ", 13) != 0) if (fips_strncasecmp(ibuf, "CIPHERTEXT = ", 13) != 0)
{ {
printf("Missing KEY\n"); printf("Missing KEY\n");
@ -839,7 +840,7 @@ static int proc_file(char *rqfile, char *rspfile)
} }
else if (strcmp(atest, "MCT") != 0) else if (strcmp(atest, "MCT") != 0)
{ /* MCT already added terminating nl */ { /* MCT already added terminating nl */
fputs(ibuf, rfp); copy_line(ibuf, rfp);
} }
step = 1; step = 1;
break; break;

View file

@ -243,7 +243,7 @@ static void gcmtest(FILE *in, FILE *out, int encrypt)
} }
rv = FIPS_cipher(&ctx, NULL, NULL, 0); rv = FIPS_cipher(&ctx, NULL, NULL, 0);
if (rv < 0) if (rv < 0)
fprintf(out, "FAIL\n"); fprintf(out, "FAIL" RESP_EOL);
else else
OutputValue("PT", pt, ptlen, out, 0); OutputValue("PT", pt, ptlen, out, 0);
if (iv) if (iv)
@ -479,11 +479,11 @@ static void ccmtest(FILE *in, FILE *out)
{ {
if (rv == 0) if (rv == 0)
Payload[0] = 0; Payload[0] = 0;
fputs("Result = Pass\n", out); fputs("Result = Pass" RESP_EOL, out);
OutputValue("Payload", Payload, len, out, 0); OutputValue("Payload", Payload, len, out, 0);
} }
else else
fputs("Result = Fail\n", out); fputs("Result = Fail" RESP_EOL, out);
OPENSSL_free(CT); OPENSSL_free(CT);
OPENSSL_free(Payload); OPENSSL_free(Payload);
CT = Payload = NULL; CT = Payload = NULL;

View file

@ -464,7 +464,7 @@ static int print_cmac_gen(const EVP_CIPHER *cipher, FILE *out,
fputs("Mac = ", out); fputs("Mac = ", out);
for (i = 0; i < Tlen; i++) for (i = 0; i < Tlen; i++)
fprintf(out, "%02x", res[i]); fprintf(out, "%02x", res[i]);
fputs("\n", out); fputs(RESP_EOL, out);
rc = 1; rc = 1;
} }
CMAC_CTX_free(cmac_ctx); CMAC_CTX_free(cmac_ctx);
@ -502,9 +502,9 @@ static int print_cmac_ver(const EVP_CIPHER *cipher, FILE *out,
else else
{ {
if (!memcmp(Mac, res, Maclen)) if (!memcmp(Mac, res, Maclen))
fputs("Result = P\n", out); fputs("Result = P" RESP_EOL, out);
else else
fputs("Result = F\n", out); fputs("Result = F" RESP_EOL, out);
} }
CMAC_CTX_free(cmac_ctx); CMAC_CTX_free(cmac_ctx);
return rc; return rc;

View file

@ -186,7 +186,7 @@ static void do_mct(char *amode,
EVP_CIPHER_CTX ctx; EVP_CIPHER_CTX ctx;
FIPS_cipher_ctx_init(&ctx); FIPS_cipher_ctx_init(&ctx);
fprintf(rfp,"\nCOUNT = %d\n",i); fprintf(rfp,RESP_EOL "COUNT = %d" RESP_EOL,i);
if(kp == 1) if(kp == 1)
OutputValue("KEY",akey,8,rfp,0); OutputValue("KEY",akey,8,rfp,0);
else else
@ -341,7 +341,7 @@ static int proc_file(char *rqfile, char *rspfile)
} }
else else
{ {
fputs(ibuf, rfp); copy_line(ibuf, rfp);
++ step; ++ step;
} }
} }
@ -357,11 +357,12 @@ static int proc_file(char *rqfile, char *rspfile)
if(*amode) if(*amode)
{ /* insert current time & date */ { /* insert current time & date */
time_t rtim = time(0); time_t rtim = time(0);
fprintf(rfp, "# %s", ctime(&rtim)); fputs("# ", rfp);
copy_line(ctime(&rtim), rfp);
} }
else else
{ {
fputs(ibuf, rfp); copy_line(ibuf, rfp);
if(!strncmp(pp,"INVERSE ",8) || !strncmp(pp,"DES ",4) if(!strncmp(pp,"INVERSE ",8) || !strncmp(pp,"DES ",4)
|| !strncmp(pp,"TDES ",5) || !strncmp(pp,"TDES ",5)
|| !strncmp(pp,"PERMUTATION ",12) || !strncmp(pp,"PERMUTATION ",12)
@ -397,7 +398,7 @@ static int proc_file(char *rqfile, char *rspfile)
break; break;
if (ibuf[0] == '[') if (ibuf[0] == '[')
{ {
fputs(ibuf, rfp); copy_line(ibuf, rfp);
++step; ++step;
if (fips_strncasecmp(ibuf, "[ENCRYPT]", 9) == 0) if (fips_strncasecmp(ibuf, "[ENCRYPT]", 9) == 0)
dir = 1; dir = 1;
@ -422,17 +423,17 @@ static int proc_file(char *rqfile, char *rspfile)
case 2: /* KEY = xxxx */ case 2: /* KEY = xxxx */
if(*ibuf == '\n') if(*ibuf == '\n')
{ {
fputs(ibuf, rfp); copy_line(ibuf, rfp);
break; break;
} }
if(!fips_strncasecmp(ibuf,"COUNT = ",8)) if(!fips_strncasecmp(ibuf,"COUNT = ",8))
{ {
fputs(ibuf, rfp); copy_line(ibuf, rfp);
break; break;
} }
if(!fips_strncasecmp(ibuf,"COUNT=",6)) if(!fips_strncasecmp(ibuf,"COUNT=",6))
{ {
fputs(ibuf, rfp); copy_line(ibuf, rfp);
break; break;
} }
if(!fips_strncasecmp(ibuf,"NumKeys = ",10)) if(!fips_strncasecmp(ibuf,"NumKeys = ",10))
@ -441,7 +442,7 @@ static int proc_file(char *rqfile, char *rspfile)
break; break;
} }
if (echo) if (echo)
fputs(ibuf, rfp); copy_line(ibuf, rfp);
if(!fips_strncasecmp(ibuf,"KEY = ",6)) if(!fips_strncasecmp(ibuf,"KEY = ",6))
{ {
akeysz=64; akeysz=64;
@ -497,7 +498,7 @@ static int proc_file(char *rqfile, char *rspfile)
case 3: /* IV = xxxx */ case 3: /* IV = xxxx */
if (echo) if (echo)
fputs(ibuf, rfp); copy_line(ibuf, rfp);
if (fips_strncasecmp(ibuf, "IV = ", 5) != 0) if (fips_strncasecmp(ibuf, "IV = ", 5) != 0)
{ {
printf("Missing IV\n"); printf("Missing IV\n");
@ -519,7 +520,7 @@ static int proc_file(char *rqfile, char *rspfile)
case 4: /* PLAINTEXT = xxxx */ case 4: /* PLAINTEXT = xxxx */
if (echo) if (echo)
fputs(ibuf, rfp); copy_line(ibuf, rfp);
if (fips_strncasecmp(ibuf, "PLAINTEXT = ", 12) != 0) if (fips_strncasecmp(ibuf, "PLAINTEXT = ", 12) != 0)
{ {
printf("Missing PLAINTEXT\n"); printf("Missing PLAINTEXT\n");
@ -562,7 +563,7 @@ static int proc_file(char *rqfile, char *rspfile)
case 5: /* CIPHERTEXT = xxxx */ case 5: /* CIPHERTEXT = xxxx */
if (echo) if (echo)
fputs(ibuf, rfp); copy_line(ibuf, rfp);
if (fips_strncasecmp(ibuf, "CIPHERTEXT = ", 13) != 0) if (fips_strncasecmp(ibuf, "CIPHERTEXT = ", 13) != 0)
{ {
printf("Missing KEY\n"); printf("Missing KEY\n");
@ -608,7 +609,7 @@ static int proc_file(char *rqfile, char *rspfile)
} }
else if (strcmp(atest, "MCT") != 0) else if (strcmp(atest, "MCT") != 0)
{ /* MCT already added terminating nl */ { /* MCT already added terminating nl */
fputs(ibuf, rfp); copy_line(ibuf, rfp);
} }
step = 1; step = 1;
break; break;

View file

@ -101,7 +101,7 @@ static void primes(FILE *in, FILE *out)
pp=BN_new(); pp=BN_new();
do_hex2bn(&pp,value); do_hex2bn(&pp,value);
fprintf(out, "result= %c\n", fprintf(out, "result= %c" RESP_EOL,
BN_is_prime_ex(pp,20,NULL,NULL) ? 'P' : 'F'); BN_is_prime_ex(pp,20,NULL,NULL) ? 'P' : 'F');
} }
} }
@ -190,13 +190,12 @@ static void pqg(FILE *in, FILE *out)
seed, M_EVP_MD_size(md), out, 0); seed, M_EVP_MD_size(md), out, 0);
if (!dsa2) if (!dsa2)
{ {
fprintf(out, "c = %d\n",counter); fprintf(out, "c = %d" RESP_EOL, counter);
fprintf(out, "H = %lx\n\n",h); fprintf(out, "H = %lx" RESP_EOL RESP_EOL,h);
} }
else else
{ {
fprintf(out, "counter = %d\n",counter); fprintf(out, "counter = %d" RESP_EOL RESP_EOL, counter);
fputs("\n", out);
} }
} }
} }
@ -343,16 +342,16 @@ static void pqgver(FILE *in, FILE *out)
if (idx >= 0) if (idx >= 0)
{ {
if (BN_cmp(dsa->g, g)) if (BN_cmp(dsa->g, g))
fprintf(out, "Result = F\n"); fprintf(out, "Result = F" RESP_EOL);
else else
fprintf(out, "Result = P\n"); fprintf(out, "Result = P" RESP_EOL);
} }
else if (BN_cmp(dsa->p, p) || BN_cmp(dsa->q, q) || else if (BN_cmp(dsa->p, p) || BN_cmp(dsa->q, q) ||
(!part_test && (!part_test &&
((BN_cmp(dsa->g, g) || (counter != counter2) || (h != h2))))) ((BN_cmp(dsa->g, g) || (counter != counter2) || (h != h2)))))
fprintf(out, "Result = F\n"); fprintf(out, "Result = F" RESP_EOL);
else else
fprintf(out, "Result = P\n"); fprintf(out, "Result = P" RESP_EOL);
BN_free(p); BN_free(p);
BN_free(q); BN_free(q);
BN_free(g); BN_free(g);
@ -470,13 +469,13 @@ static void keyver(FILE *in, FILE *out)
paramcheck = -1; paramcheck = -1;
} }
if (paramcheck != 1) if (paramcheck != 1)
fprintf(out, "Result = F\n"); fprintf(out, "Result = F" RESP_EOL);
else else
{ {
if (!BN_mod_exp(Y2, g, X, p, ctx) || BN_cmp(Y2, Y)) if (!BN_mod_exp(Y2, g, X, p, ctx) || BN_cmp(Y2, Y))
fprintf(out, "Result = F\n"); fprintf(out, "Result = F" RESP_EOL);
else else
fprintf(out, "Result = P\n"); fprintf(out, "Result = P" RESP_EOL);
} }
BN_free(X); BN_free(X);
BN_free(Y); BN_free(Y);
@ -537,7 +536,7 @@ static void keypair(FILE *in, FILE *out)
do_bn_print_name(out, "P",dsa->p); do_bn_print_name(out, "P",dsa->p);
do_bn_print_name(out, "Q",dsa->q); do_bn_print_name(out, "Q",dsa->q);
do_bn_print_name(out, "G",dsa->g); do_bn_print_name(out, "G",dsa->g);
fputs("\n", out); fputs(RESP_EOL, out);
while(n--) while(n--)
{ {
@ -546,7 +545,7 @@ static void keypair(FILE *in, FILE *out)
do_bn_print_name(out, "X",dsa->priv_key); do_bn_print_name(out, "X",dsa->priv_key);
do_bn_print_name(out, "Y",dsa->pub_key); do_bn_print_name(out, "Y",dsa->pub_key);
fputs("\n", out); fputs(RESP_EOL, out);
} }
} }
} }
@ -594,7 +593,7 @@ static void siggen(FILE *in, FILE *out)
do_bn_print_name(out, "P",dsa->p); do_bn_print_name(out, "P",dsa->p);
do_bn_print_name(out, "Q",dsa->q); do_bn_print_name(out, "Q",dsa->q);
do_bn_print_name(out, "G",dsa->g); do_bn_print_name(out, "G",dsa->g);
fputs("\n", out); fputs(RESP_EOL, out);
} }
else if(!strcmp(keyword,"Msg")) else if(!strcmp(keyword,"Msg"))
{ {
@ -616,7 +615,7 @@ static void siggen(FILE *in, FILE *out)
do_bn_print_name(out, "R",sig->r); do_bn_print_name(out, "R",sig->r);
do_bn_print_name(out, "S",sig->s); do_bn_print_name(out, "S",sig->s);
fputs("\n", out); fputs(RESP_EOL, out);
FIPS_dsa_sig_free(sig); FIPS_dsa_sig_free(sig);
FIPS_md_ctx_cleanup(&mctx); FIPS_md_ctx_cleanup(&mctx);
} }
@ -685,7 +684,7 @@ static void sigver(FILE *in, FILE *out)
no_err = 0; no_err = 0;
FIPS_md_ctx_cleanup(&mctx); FIPS_md_ctx_cleanup(&mctx);
fprintf(out, "Result = %c\n\n", r == 1 ? 'P' : 'F'); fprintf(out, "Result = %c" RESP_EOL RESP_EOL, r == 1 ? 'P' : 'F');
} }
} }
} }

View file

@ -234,7 +234,7 @@ static int KeyPair(FILE *in, FILE *out)
do_bn_print_name(out, "d", d); do_bn_print_name(out, "d", d);
do_bn_print_name(out, "Qx", Qx); do_bn_print_name(out, "Qx", Qx);
do_bn_print_name(out, "Qy", Qy); do_bn_print_name(out, "Qy", Qy);
fputs("\n", out); fputs(RESP_EOL, out);
EC_KEY_free(key); EC_KEY_free(key);
} }
@ -287,7 +287,7 @@ static int PKV(FILE *in, FILE *out)
no_err = 1; no_err = 1;
rv = EC_KEY_set_public_key_affine_coordinates(key, Qx, Qy); rv = EC_KEY_set_public_key_affine_coordinates(key, Qx, Qy);
no_err = 0; no_err = 0;
fprintf(out, "Result = %s\n", rv ? "P":"F"); fprintf(out, "Result = %s" RESP_EOL, rv ? "P":"F");
} }
} }
@ -453,7 +453,7 @@ static int SigVer(FILE *in, FILE *out)
rv = FIPS_ecdsa_verify_ctx(key, &mctx, sig); rv = FIPS_ecdsa_verify_ctx(key, &mctx, sig);
no_err = 0; no_err = 0;
fprintf(out, "Result = %s\n", rv ? "P":"F"); fprintf(out, "Result = %s" RESP_EOL, rv ? "P":"F");
} }
} }

View file

@ -52,6 +52,12 @@
#include <openssl/fips_rand.h> #include <openssl/fips_rand.h>
#include <openssl/objects.h> #include <openssl/objects.h>
#ifdef OPENSSL_SYS_WIN32
#define RESP_EOL "\n"
#else
#define RESP_EOL "\r\n"
#endif
int hex2bin(const char *in, unsigned char *out); int hex2bin(const char *in, unsigned char *out);
unsigned char *hex2bin_m(const char *in, long *plen); unsigned char *hex2bin_m(const char *in, long *plen);
int do_hex2bn(BIGNUM **pr, const char *in); int do_hex2bn(BIGNUM **pr, const char *in);
@ -61,6 +67,7 @@ int parse_line(char **pkw, char **pval, char *linebuf, char *olinebuf);
int parse_line2(char **pkw, char **pval, char *linebuf, char *olinebuf, int eol); int parse_line2(char **pkw, char **pval, char *linebuf, char *olinebuf, int eol);
BIGNUM *hex2bn(const char *in); BIGNUM *hex2bn(const char *in);
int tidy_line(char *linebuf, char *olinebuf); int tidy_line(char *linebuf, char *olinebuf);
int copy_line(const char *in, FILE *ofp);
int bint2bin(const char *in, int len, unsigned char *out); int bint2bin(const char *in, int len, unsigned char *out);
int bin2bint(const unsigned char *in,int len,char *out); int bin2bint(const unsigned char *in,int len,char *out);
void PrintValue(char *tag, unsigned char *val, int len); void PrintValue(char *tag, unsigned char *val, int len);
@ -74,9 +81,9 @@ static int no_err;
static void put_err_cb(int lib, int func,int reason,const char *file,int line) static void put_err_cb(int lib, int func,int reason,const char *file,int line)
{ {
if (no_err) if (no_err)
return; return;
fprintf(stderr, "ERROR:%08lX:lib=%d,func=%d,reason=%d" fprintf(stderr, "ERROR:%08lX:lib=%d,func=%d,reason=%d"
":file=%s:line=%d\n", ":file=%s:line=%d\n",
ERR_PACK(lib, func, reason), ERR_PACK(lib, func, reason),
lib, func, reason, file, line); lib, func, reason, file, line);
@ -257,7 +264,7 @@ int do_bn_print_name(FILE *out, const char *name, const BIGNUM *bn)
r = do_bn_print(out, bn); r = do_bn_print(out, bn);
if (!r) if (!r)
return 0; return 0;
fputs("\n", out); fputs(RESP_EOL, out);
return 1; return 1;
} }
@ -373,6 +380,20 @@ int tidy_line(char *linebuf, char *olinebuf)
return 1; return 1;
} }
/* Copy supplied line to ofp replacing \n with \r\n */
int copy_line(const char *in, FILE *ofp)
{
const char *p;
p = strchr(in, '\n');
if (p)
{
fwrite(in, 1, (size_t)(p - in), ofp);
fputs(RESP_EOL, ofp);
}
else
fputs(in, ofp);
return 1;
}
/* NB: this return the number of _bits_ read */ /* NB: this return the number of _bits_ read */
int bint2bin(const char *in, int len, unsigned char *out) int bint2bin(const char *in, int len, unsigned char *out)
@ -412,7 +433,7 @@ void OutputValue(char *tag, unsigned char *val, int len, FILE *rfp,int bitmode)
if(bitmode) if(bitmode)
{ {
olen=bin2bint(val,len,obuf); olen=bin2bint(val,len,obuf);
fprintf(rfp, "%s = %.*s\n", tag, olen, obuf); fprintf(rfp, "%s = %.*s" RESP_EOL, tag, olen, obuf);
} }
else else
{ {
@ -420,7 +441,7 @@ void OutputValue(char *tag, unsigned char *val, int len, FILE *rfp,int bitmode)
fprintf(rfp, "%s = ", tag); fprintf(rfp, "%s = ", tag);
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
fprintf(rfp, "%02x", val[i]); fprintf(rfp, "%02x", val[i]);
fputs("\n", rfp); fputs(RESP_EOL, rfp);
} }
#if VERBOSE #if VERBOSE

View file

@ -313,7 +313,7 @@ static int print_hmac(const EVP_MD *emd, FILE *out,
fputs("Mac = ", out); fputs("Mac = ", out);
for (i = 0; i < Tlen; i++) for (i = 0; i < Tlen; i++)
fprintf(out, "%02x", md[i]); fprintf(out, "%02x", md[i]);
fputs("\n", out); fputs(RESP_EOL, out);
return 1; return 1;
} }

View file

@ -276,9 +276,9 @@ int rsa_stest(FILE *out, FILE *in, int Saltlen)
BN_free(bn_e); BN_free(bn_e);
fputs("n = ", out); fputs("n = ", out);
do_bn_print(out, rsa->n); do_bn_print(out, rsa->n);
fputs("\ne = ", out); fputs(RESP_EOL "e = ", out);
do_bn_print(out, rsa->e); do_bn_print(out, rsa->e);
fputs("\n", out); fputs(RESP_EOL, out);
current_keylen = keylen; current_keylen = keylen;
} }
@ -352,7 +352,7 @@ static int rsa_printsig(FILE *out, RSA *rsa, const EVP_MD *dgst,
for (i = 0; i < siglen; i++) for (i = 0; i < siglen; i++)
fprintf(out, "%02X", sigbuf[i]); fprintf(out, "%02X", sigbuf[i]);
fputs("\n", out); fputs(RESP_EOL, out);
ret = 1; ret = 1;

View file

@ -355,9 +355,9 @@ static int rsa_printver(FILE *out,
goto error; goto error;
if (r == 0) if (r == 0)
fputs("Result = F\n", out); fputs("Result = F" RESP_EOL, out);
else else
fputs("Result = P\n", out); fputs("Result = P" RESP_EOL, out);
ret = 1; ret = 1;

View file

@ -305,7 +305,7 @@ static int print_dgst(const EVP_MD *emd, FILE *out,
fputs("MD = ", out); fputs("MD = ", out);
for (i = 0; i < mdlen; i++) for (i = 0; i < mdlen; i++)
fprintf(out, "%02x", md[i]); fprintf(out, "%02x", md[i]);
fputs("\n", out); fputs(RESP_EOL, out);
return 1; return 1;
} }
@ -337,7 +337,7 @@ static int print_monte(const EVP_MD *md, FILE *out,
memcpy(m2, Seed, SeedLen); memcpy(m2, Seed, SeedLen);
memcpy(m3, Seed, SeedLen); memcpy(m3, Seed, SeedLen);
fputs("\n", out); fputs(RESP_EOL, out);
for (j = 0; j < 100; j++) for (j = 0; j < 100; j++)
{ {
@ -355,11 +355,11 @@ static int print_monte(const EVP_MD *md, FILE *out,
m3 = p; m3 = p;
FIPS_digestfinal(&ctx, m3, &m3len); FIPS_digestfinal(&ctx, m3, &m3len);
} }
fprintf(out, "COUNT = %d\n", j); fprintf(out, "COUNT = %d" RESP_EOL, j);
fputs("MD = ", out); fputs("MD = ", out);
for (k = 0; k < m3len; k++) for (k = 0; k < m3len; k++)
fprintf(out, "%02x", m3[k]); fprintf(out, "%02x", m3[k]);
fputs("\n\n", out); fputs(RESP_EOL RESP_EOL, out);
memcpy(m1, m3, m3len); memcpy(m1, m3, m3len);
memcpy(m2, m3, m3len); memcpy(m2, m3, m3len);
m1len = m2len = m3len; m1len = m2len = m3len;