All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] crypto_user02: Find a valid template
Date: Mon, 29 Mar 2021 11:53:07 -0700	[thread overview]
Message-ID: <YGIiE5/DnjXrcHzK@gmail.com> (raw)
In-Reply-To: <20210315130349.1155389-1-lkml@jv-coder.de>

On Mon, Mar 15, 2021 at 02:03:49PM +0100, Joerg Vehlow wrote:
> From: Joerg Vehlow <joerg.vehlow@aox-tech.de>
> 
> The test requires a crypto template, that is not in use by someone else,
> otherwise deleting it is not possible.
> This adds a list of templates, that are tested in order, until one is found,
> that can be used for the test, otherwise TCONF is returned.
> 
> Signed-off-by: Joerg Vehlow <joerg.vehlow@aox-tech.de>

Generally looks good.  A few nits below.

> +/*
> + * List of possible templates to use try (not exhaustive).
> + * The template has to be valid (i.e. the drivers must exists
> + * and be a valid combination) and it has to be deleteable.
> + * To be deletable it cannot be used by someone else.
> + * The first algorithm, that fullfils the criteria is used for the test.
> + */
> +static const char* TEMPLATE_CANDIDATES[] = {
> +	"hmac(sha1-generic)",
> +	"hmac(sha224-generic)",
> +	"hmac(sha256-generic)",
> +	"hmac(sha384-generic)",
> +	"hmac(md5-generic)"
> +};

"template" means something like "hmac" by itself.  This probably should be
called something like ALGORITHM_CANDIDATES, and similarly template => algorithm
in a couple places below.

Also it should be 'const char * const', not just 'const char *'.

>  static void setup(void)
>  {
> +	int rc;
> +	unsigned i;
> +	struct crypto_user_alg alg, alg_out;

alg_out is unused.

> +	if (!template) {
> +		tst_brk(TCONF, "No viable template found");
> +	}

Single-line statements shouldn't have braces like this.

- Eric

  parent reply	other threads:[~2021-03-29 18:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 13:03 [LTP] [PATCH] crypto_user02: Find a valid template Joerg Vehlow
2021-03-29  9:04 ` Petr Vorel
2021-03-29 18:53 ` Eric Biggers [this message]
2021-04-01  7:22   ` Petr Vorel
2021-04-01  7:23   ` Petr Vorel

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=YGIiE5/DnjXrcHzK@gmail.com \
    --to=ebiggers@kernel.org \
    --cc=ltp@lists.linux.it \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.