X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=fips%2Frsa%2Ffips_rsavtest.c;h=9bfc5e688bce721f77b7c619b3259cb2e223efa4;hp=5886a19b031e710c067b867b1f9178443f0ee6ac;hb=8ea92ddd13495e63855a61dcc96963ffdf6df495;hpb=3deb010dc01a9e23cd48feab25abef3c2d124d7d diff --git a/fips/rsa/fips_rsavtest.c b/fips/rsa/fips_rsavtest.c index 5886a19b03..9bfc5e688b 100644 --- a/fips/rsa/fips_rsavtest.c +++ b/fips/rsa/fips_rsavtest.c @@ -82,23 +82,25 @@ int main(int argc, char *argv[]) #include "fips_utl.h" -int rsa_test(FILE *out, FILE *in, int saltlen); +int rsa_vtest(FILE *out, FILE *in, int saltlen); static int rsa_printver(FILE *out, BIGNUM *n, BIGNUM *e, const EVP_MD *dgst, unsigned char *Msg, long Msglen, unsigned char *S, long Slen, int Saltlen); +#ifdef FIPS_ALGVS +int fips_rsavtest_main(int argc, char **argv) +#else int main(int argc, char **argv) +#endif { FILE *in = NULL, *out = NULL; int ret = 1; int Saltlen = -1; - fips_set_error_print(); - if(!FIPS_mode_set(1)) - goto end; + fips_algtest_init(); if ((argc > 2) && !strcmp("-saltlen", argv[1])) { @@ -140,7 +142,7 @@ int main(int argc, char **argv) goto end; } - if (!rsa_test(out, in, Saltlen)) + if (!rsa_vtest(out, in, Saltlen)) { fprintf(stderr, "FATAL RSAVTEST file processing error\n"); goto end; @@ -161,7 +163,7 @@ int main(int argc, char **argv) #define RSA_TEST_MAXLINELEN 10240 -int rsa_test(FILE *out, FILE *in, int Saltlen) +int rsa_vtest(FILE *out, FILE *in, int Saltlen) { char *linebuf, *olinebuf, *p, *q; char *keyword, *value; @@ -321,7 +323,6 @@ static int rsa_printver(FILE *out, int ret = 0, r, pad_mode; /* Setup RSA and EVP_PKEY structures */ RSA *rsa_pubkey = NULL; - EVP_MD_CTX ctx; unsigned char *buf = NULL; rsa_pubkey = FIPS_rsa_new(); if (!rsa_pubkey) @@ -331,8 +332,6 @@ static int rsa_printver(FILE *out, if (!rsa_pubkey->n || !rsa_pubkey->e) goto error; - FIPS_md_ctx_init(&ctx); - if (Saltlen >= 0) pad_mode = RSA_PKCS1_PSS_PADDING; else if (Saltlen == -2) @@ -340,26 +339,18 @@ static int rsa_printver(FILE *out, else pad_mode = RSA_PKCS1_PADDING; - if (!FIPS_digestinit(&ctx, dgst)) - goto error; - if (!FIPS_digestupdate(&ctx, Msg, Msglen)) - goto error; - no_err = 1; - r = FIPS_rsa_verify_ctx(rsa_pubkey, &ctx, + r = FIPS_rsa_verify(rsa_pubkey, Msg, Msglen, dgst, pad_mode, Saltlen, NULL, S, Slen); no_err = 0; - - FIPS_md_ctx_cleanup(&ctx); - if (r < 0) goto error; if (r == 0) - fputs("Result = F\n", out); + fputs("Result = F" RESP_EOL, out); else - fputs("Result = P\n", out); + fputs("Result = P" RESP_EOL, out); ret = 1;