mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Morris <jmorris@intercode.com.au>
To: Thomas Spatzier <TSPAT@de.ibm.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: crypto API and IBM z990 hardware support
Date: Thu, 3 Jul 2003 02:57:30 +1000 (EST)	[thread overview]
Message-ID: <Mutt.LNX.4.44.0307030234400.1298-100000@excalibur.intercode.com.au> (raw)
In-Reply-To: <OF014BDDD3.522D4623-ONC1256D57.003FFD79-C1256D57.0044F37D@de.ibm.com>

On Wed, 2 Jul 2003, Thomas Spatzier wrote:

> I agree on having arch-specific implementations in crypto/arch directories.
> However, I've got some problems with having this kind of 'static' aliasing
> in modules.conf. In my case I do not know beforehand, whether a specific
> crypto instruction is enabled. I query some processor status flags during
> runime. If the check fails, I'd like to switch back to the original
> software implementation.

I did say it was the simple solution :-)

> I read in your autoconf.c file that a more sophisticated version of
> crypto_alg_autoload is planned. I would suggest first trying to load the
> arch-specific aes_z990.ko in crypto_alg_autoload. In my init_module
> function i could query the processor. If init_module for my implementation
> fails -> request_module fails -> load the standard module aes.ko.
> Something similar to this:
> 
> #ifndef CRYPTO_ARCH      //defined in arch makefile as "_z990"
> #define CRYPTO_ARCH ""
> #endif
> 
> void crypto_alg_autoload(const char *name)
> {
>       if (request_module("%s%s", name, CRYPTO_ARCH) != 0){
>             request_module("%s", name);
>       }
> }


I'd like to avoid these kind of macros, and make it a general case 
solution (e.g. which can be used for various hardware implementations).

One possibility would be to allow registration with an alias list in
crypto API with attributes indicating whether the module is hardware,
arch-specific etc.

So, during init, the s390 arch could register an alias like:

  name .= "aes_z990"
  algorithm .= "aes"
  attributes .= CRYPTO_ATTR_ARCH|CRYPTO_ATTR_HW

Then, when a caller specifies "aes", crypto_alg_autoload() would first
check the alias list, giving preference to CRYPTO_ALG_ARCH by default.  
In this case, it would find aes_z990 and try and load it.  If this fails,
it continues along the alias list then ultimately falls back to the
current behavior.

This would allow subsystems and hardware drivers to dynamically provide 
information to the API.  Callers of crypto_alloc_tfm() could then pass 
flags specifying preferences for algorithm implementations e.g. generic 
sw, arch sw, arch hw, misc hw.

This would also need to take into account modprobe.conf configuration and 
compiled in modules.



- James
-- 
James Morris
<jmorris@intercode.com.au>


  reply	other threads:[~2003-07-02 16:43 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-02 12:35 Thomas Spatzier
2003-07-02 16:57 ` James Morris [this message]
2003-07-07  7:11   ` Christoph Hellwig
2003-07-07 10:27     ` James Morris
     [not found] <4P45.5YN.11@gated-at.bofh.it>
     [not found] ` <4T81.24d.41@gated-at.bofh.it>
2003-07-02 22:06   ` Arnd Bergmann
2003-07-06 14:08     ` James Morris
2003-07-06 17:46       ` Arnd Bergmann
2003-07-07  7:14       ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2003-07-02 20:23 Ulrich Weigand
2003-07-02  7:07 Thomas Spatzier
2003-07-02  9:35 ` James Morris
2003-07-07  7:09   ` Christoph Hellwig
2003-07-08  2:53     ` David S. Miller
2003-07-08  3:37       ` Roland Dreier
2003-07-08  3:35         ` David S. Miller
2003-07-10  1:08       ` Werner Almesberger
2003-07-10  1:08         ` David S. Miller
2003-07-10  2:06           ` Werner Almesberger
2003-07-10  2:06             ` David S. Miller
2003-07-10  2:37               ` Werner Almesberger
2003-07-11  0:02                 ` David S. Miller
     [not found]       ` <mailman.1057799700.15422.linux-kernel2news@redhat.com>
2003-07-10  5:55         ` Pete Zaitcev

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=Mutt.LNX.4.44.0307030234400.1298-100000@excalibur.intercode.com.au \
    --to=jmorris@intercode.com.au \
    --cc=TSPAT@de.ibm.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®