linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Elliott, Robert (Servers)" <elliott@hpe.com>
To: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>,
	"herbert@gondor.apana.org.au" <herbert@gondor.apana.org.au>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"jarod@redhat.com" <jarod@redhat.com>,
	"linux-crypto@vger.kernel.org" <linux-crypto@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] crypto: tcrypt - fix return value for multiple subtests
Date: Fri, 30 Sep 2022 22:42:44 +0000	[thread overview]
Message-ID: <MW5PR84MB18425977F8BD6260B5347586AB569@MW5PR84MB1842.NAMPRD84.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <ab0d9840-07e3-ec49-a9b3-c4b65d7d61bc@intel.com>



> -----Original Message-----
> From: Anirudh Venkataramanan <anirudh.venkataramanan@intel.com>
> Sent: Friday, September 30, 2022 5:10 PM
> To: Elliott, Robert (Servers) <elliott@hpe.com>; herbert@gondor.apana.org.au;
> davem@davemloft.net; jarod@redhat.com; linux-crypto@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH] crypto: tcrypt - fix return value for multiple subtests
> 
> On 9/30/2022 2:40 PM, Robert Elliott wrote:
> > When a test mode invokes multiple tests (e.g., mode 0 invokes modes
> > 1 through 199, and mode 3 tests three block cipher modes with des),
> > don't keep accumulating the return values with ret += tcrypt_test(),
> > which results in a bogus value if more than one report a nonzero
> > value (e.g., two reporting -2 (-ENOENT) end up reporting -4 (-EINTR)).
> > Instead, keep track of the minimum return value reported by any
> > subtest.
> 
> I am assuming this is for the case when fips_enabled is true?

I have some other unposted patches that print more info on the
test progress including the return values at various levels.
The Fedora 36 .config on x86 yields 23 -2 (ENOENT) errors, so
the overall result is -46 (which is defined as EPFNOSUPPORT).

> I agree that returning the cumulative sum or errors isn't particularly
> useful, but how is returning the minimum error value useful? Wouldn't it
> be more useful to return the first error return?

The first error would be more useful, but would require more complex
changes. Is there any kernel macro that would handle this in one line?

  tmp = tcrypt_test();
  if (tmp && !ret)
    ret = tmp;

Since do_test() and tcrypt_test() are static inline functions
only used within this file, a new argument containing a pointer
to the return value could be added that lets them handle
updating it while keeping the callers simple.

   ret += tcrypt_test("md5");
could become
   tcrypt_test("md5", &ret);



  reply	other threads:[~2022-09-30 22:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-30 21:40 [PATCH] crypto: tcrypt - fix return value for multiple subtests Robert Elliott
2022-09-30 22:09 ` Anirudh Venkataramanan
2022-09-30 22:42   ` Elliott, Robert (Servers) [this message]
2022-09-30 23:30     ` Anirudh Venkataramanan
2022-10-21 11:35 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MW5PR84MB18425977F8BD6260B5347586AB569@MW5PR84MB1842.NAMPRD84.PROD.OUTLOOK.COM \
    --to=elliott@hpe.com \
    --cc=anirudh.venkataramanan@intel.com \
    --cc=davem@davemloft.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=jarod@redhat.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).