Re: [LTP] [PATCH ltp] testcases/kernel/crypto/crypto_user02.c: try non-generic hmac names first

Eric Biggers via ltp <[email protected]>
Newsgroups it.linux.lists.ltp
Message-ID <[email protected]>
On Wed, Aug 12, 2026 at 01:27:37PM +0200, Frank Ranner wrote:
> Probe plain hmac(<hash>) driver names before the legacy *-generic
> variants when selecting a viable algorithm for crypto_user02.
> 
> Newer kernels commonly expose non-generic algorithm names while
> no longer registering the *-generic aliases, which made the current
> candidate list fall through to TCONF even when usable algorithms
> were present.
> 
> Keeping both forms preserves compatibility with older kernels while
> avoiding kernel-version checks in the testcase logic.
> 
> Signed-off-by: Frank Ranner <[email protected]>
> ---
>  testcases/kernel/crypto/crypto_user02.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/testcases/kernel/crypto/crypto_user02.c b/testcases/kernel/crypto/crypto_user02.c
> index 88ae800aa..c08d35c84 100644
> --- a/testcases/kernel/crypto/crypto_user02.c
> +++ b/testcases/kernel/crypto/crypto_user02.c
> @@ -35,6 +35,20 @@
>   * The first algorithm, that fullfils the criteria is used for the test.
>   */
>  static const char * const ALGORITHM_CANDIDATES[] = {
> +	"hmac(sha1)",
> +	"hmac(sha224)",
> +	"hmac(sha256)",
> +	"hmac(sha384)",
> +	"hmac(md5)",
> +	"hmac(sm3)",
> +	"hmac(sha512)",
> +	"hmac(rmd160)",
> +	"hmac(sha3-224)",
> +	"hmac(sha3-256)",
> +	"hmac(sha3-384)",
> +	"hmac(sha3-512)",
> +	"hmac(streebog256)",
> +	"hmac(streebog512)",
>  	"hmac(sha1-generic)",
>  	"hmac(sha224-generic)",
>  	"hmac(sha256-generic)",

This kind of defeats the point of the test, as the hmac template will no
longer be tested; the kernel now implements the stable names
"hmac(sha1)", "hmac(sha256)", etc. directly without the fragile template
system.  The test is specifically checking for a crash when deleting a
template instance.  I guess use the new driver names generated by the
template to force its use: "hmac(sha1-lib)", "hmac(sha256-lib)", etc.  

Not like this UAPI has any point in the first place.  But as long as
this test still exists and is trying to test for this historical bug, we
might as well preserve the intent.

(It's also strange that so many algorithms are listed, when just one
actually ends up being used.  But that is a separate issue.)

- Eric

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.