Re: [PATCH] Documentation: crypto: add info about "fips=" boot option

2021-03-29 Thread Herbert Xu
On Mon, Mar 29, 2021 at 10:00:45PM -0700, Randy Dunlap wrote:
> On 3/29/21 9:37 PM, Herbert Xu wrote:
> > On Mon, Mar 29, 2021 at 09:00:01PM -0700, Randy Dunlap wrote:
> >>
> >> +  If fips_enabled = 1, some crypto tests are skipped.
> > 
> > I don't think any tests are skipped.  It does however disable
> > many algorithms by essentially failing them at the testing stage.
> 
> That statement was based on crypto/testmgr.c (in 4 places):
> 
>   if (fips_enabled && template[i].fips_skip)
>   continue;

By skipping the test, the algorithm effectively fails the self-test
and therefore is disabled.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


Re: [PATCH] Documentation: crypto: add info about "fips=" boot option

2021-03-29 Thread Randy Dunlap
On 3/29/21 9:37 PM, Herbert Xu wrote:
> On Mon, Mar 29, 2021 at 09:00:01PM -0700, Randy Dunlap wrote:
>>
>> +If fips_enabled = 1, some crypto tests are skipped.
> 
> I don't think any tests are skipped.  It does however disable
> many algorithms by essentially failing them at the testing stage.

That statement was based on crypto/testmgr.c (in 4 places):

if (fips_enabled && template[i].fips_skip)
continue;

and

if (fips_enabled && vec->fips_skip)
return 0;

and

if (fips_enabled && !alg_test_descs[i].fips_allowed)
goto non_fips_alg;

and

if (fips_enabled && ((i >= 0 && !alg_test_descs[i].fips_allowed) ||
 (j >= 0 && !alg_test_descs[j].fips_allowed)))
goto non_fips_alg;


so it appears (at least to me) that there are some methods (infrastructure)
for tests to be skipped, but maybe none are actually using that possiblilty.

In any case, I don't mind dropping that part of the documentation.

thanks.
-- 
~Randy



Re: [PATCH] Documentation: crypto: add info about "fips=" boot option

2021-03-29 Thread Herbert Xu
On Mon, Mar 29, 2021 at 09:00:01PM -0700, Randy Dunlap wrote:
>
> + If fips_enabled = 1, some crypto tests are skipped.

I don't think any tests are skipped.  It does however disable
many algorithms by essentially failing them at the testing stage.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


[PATCH] Documentation: crypto: add info about "fips=" boot option

2021-03-29 Thread Randy Dunlap
Having just seen a report of using "fips=1" on the kernel command line,
I could not find it documented anywhere, so add some help for it.

Signed-off-by: Randy Dunlap 
Cc: Dexuan Cui 
Cc: linux-cry...@vger.kernel.org
Cc: Eric Biggers 
Cc: Herbert Xu 
Cc: "David S. Miller" 
Cc: Jonathan Corbet 
Cc: linux-...@vger.kernel.org
---
Updates/corrections welcome.

 Documentation/admin-guide/kernel-parameters.txt |   15 ++
 1 file changed, 15 insertions(+)

--- linux-next-20210329.orig/Documentation/admin-guide/kernel-parameters.txt
+++ linux-next-20210329/Documentation/admin-guide/kernel-parameters.txt
@@ -1370,6 +1370,21 @@
See Documentation/admin-guide/sysctl/net.rst for
fb_tunnels_only_for_init_ns
 
+   fips=   Format: { 0 | 1}
+   Use to disable (0) or enable (1) FIPS mode.
+   If enabled, any process that is waiting on the
+   'fips_fail_notif_chain' will be notified of fips
+   failures.
+   This setting can also be modified via sysctl at
+   /proc/sysctl/crypto/fips_enabled, i.e.,
+   crypto.fips_enabled.
+   If fips_enabled = 1, some crypto tests are skipped.
+   It can also effect which ECC curve is used.
+   If fips_enabled = 1 and a test fails, it will cause a
+   kernel panic.
+   If fips_enabled = 1, RSA test requires a key size of
+   2K or larger.
+
floppy= [HW]
See Documentation/admin-guide/blockdev/floppy.rst.