linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rolf Eike Beer <eike-kernel@sf-tec.de>
To: sparclinux@vger.kernel.org
Cc: linux-crypto@vger.kernel.org
Subject: Issues with hw crypto and random support on Niagara2
Date: Wed, 05 Oct 2022 16:17:45 +0200	[thread overview]
Message-ID: <3804667.3oa1dkRz9v@eto.sf-tec.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1814 bytes --]

[Resend with CC linux-crypto]

I recently upgraded my Sun T5120 the kernel to 5.19.12. The first thing I 
noticed afterwards was that the boot took nearly one hour and spewed lots of 
warnings about crng_init=0. As a workaround I did that:

# grep -n quality /usr/src/linux/drivers/char/hw_random/n2-drv.c 
770:    np->hwrng.quality = 5;

This has solved the issue for me, boot is now down to ~2min again. I wonder if 
I'm missing something obvious like another driver that I should activate?

Then I noticed that the hw crypto support from drivers/crypto/n2_core.c fails 
to load with -EINVAL. From looking at the code I think this is because 
statesize is not set for the hash algorithms, so registering the first one 
(md5) fails and nothing else is tried. I then set NUM_HASH_TMPLS to 0 so they 
were never attempted, which resulted in the second loop succeeding:

[   40.561230] n2_crypto: n2_crypto.c:v0.2 (July 28, 2011)
[   40.561361] n2_crypto: Found N2CP at /virtual-devices@100/n2cp@7
[   40.561506] n2_crypto: Registered NCS HVAPI version 2.0
[   40.562493] n2_crypto: ecb(des) alg registered
[   40.562567] n2_crypto: cbc(des) alg registered
[   40.562687] n2_crypto: cfb(des) alg registered
[   40.562760] n2_crypto: ecb(des3_ede) alg registered
[   40.562833] n2_crypto: cbc(des3_ede) alg registered
[   40.562906] n2_crypto: cfb(des3_ede) alg registered
[   40.563007] n2_crypto: ecb(aes) alg registered
[   40.563084] n2_crypto: cbc(aes) alg registered
[   40.563156] n2_crypto: ctr(aes) alg registered
[   40.563890] n2_crypto: Found NCP at /virtual-devices@100/ncp@6

Maybe someone with the knowledge about the right statesize could send a patch? 
I'm open for testing. This is probably broken for a very long time, i.e. 
8996eafdcbad149ac0f772fb1649fbb75c482a6a (kernel v4.3).

Greetings,

Eike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

             reply	other threads:[~2022-10-05 14:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05 14:17 Rolf Eike Beer [this message]
2022-10-05 15:32 ` Issues with hw crypto and random support on Niagara2 Corentin Labbe

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=3804667.3oa1dkRz9v@eto.sf-tec.de \
    --to=eike-kernel@sf-tec.de \
    --cc=linux-crypto@vger.kernel.org \
    --cc=sparclinux@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).