[LTP] [PATCH v2 1/1] tst_af_alg: Another fix for disabled weak cipher

Petr Vorel pvorel@suse.cz
Wed Dec 22 15:45:29 CET 2021


Hi Cyril,

...
> > >  	if (!tst_have_alg("hash", hash_algname)) {
> > > -		tst_res(TCONF, "kernel doesn't have hash algorithm '%s'",
> > > -			hash_algname);
> > > +		if (errno != ELIBBAD)
> > > +			tst_res(TCONF, "kernel doesn't have hash algorithm '%s'",
> > > +				hash_algname);

> > What about moving the tst_res(TCONF, ...) in the case of ENOENT to the
> > tst_have_alg() function?

> > That way we would have here just

> > 	if (!tst_have_alg("hash", hash_algname))
> > 		return;

> Hm, if I haven't overlook anything, it could work even for af_alg04.c,
> which uses it !tst_have_alg() once without TCONF:

>  28     sprintf(vmac_algname, "vmac64(%s)", symm_enc_algname);
>  29     if (!tst_have_alg("hash", vmac_algname)) {
>  30         sprintf(vmac_algname, "vmac(%s)", symm_enc_algname);

> Moved to tst_have_alg():
> tst_fips.c:22: TINFO: FIPS: on
> tst_af_alg.c:90: TCONF: FIPS enabled => hash algorithm 'vmac64(aes)' disabled
> tst_af_alg.c:94: TCONF: kernel doesn't have hash algorithm 'vmac(aes)'
> tst_af_alg.c:94: TCONF: kernel doesn't have hash algorithm 'vmac64(sm4)'
> tst_af_alg.c:94: TCONF: kernel doesn't have hash algorithm 'vmac(sm4)'
> tst_af_alg.c:94: TCONF: kernel doesn't have hash algorithm 'vmac64(sm4-generic)'
> tst_af_alg.c:94: TCONF: kernel doesn't have hash algorithm 'vmac(sm4-generic)'

> => I'll send v3.

OK, this would not work for af_alg03.c, where false positive TCONF would be
printed:
tst_test.c:1426: TINFO: Timeout per run is 0h 05m 00s
tst_af_alg.c:81: TCONF: kernel doesn't have aead algorithm 'rfc7539(chacha20,sha256)'
af_alg03.c:24: TPASS: couldn't instantiate rfc7539 template with wrong digest size

Kind regards,
Petr

> Kind regards,
> Petr

> > Other than these two minor things this version does look good:

> > Reviewed-by: Cyril Hrubis <chrubis@suse.cz>

> > >  		return;
> > >  	}
> > >  	sprintf(hmac_algname, "hmac(%s)", hash_algname);
> > > -- 
> > > 2.34.1


More information about the ltp mailing list