linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: crypto API and IBM z990 hardware support
@ 2003-07-02 12:35 Thomas Spatzier
  2003-07-02 16:57 ` James Morris
  0 siblings, 1 reply; 22+ messages in thread
From: Thomas Spatzier @ 2003-07-02 12:35 UTC (permalink / raw)
  To: James Morris; +Cc: linux-kernel


> Are there any details available on how all of this is implemented?  Are
> these instructions synchronous?

Yes, the instructions are sunchronous.

> The plan is to provide crypto/arch/ subdirectories where arch optimized
> versions of the crypto algorithms are implemented, and built
automatically
> (via configuration defaults) instead of the generic C versions.
>
> So, there might be:
>
> crypto/aes.c
> crypto/arch/i386/aes.s
>
> where on i386, aes.s would be built into aes.o and aes.c would not be
> built.
>
> The simple solution for you might be something like:
>
> crypto/aes.c -> aes.o
> crypto/arch/s390/aes_z990.c -> aes_z990.o
>
> and the administrator of the system could configure modprobe.conf to
alias
> aes to aes_z990 if the latter is supported in hardware.

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 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);
      }
}


Regards,

Thomas Spatzier
--------------------------------------------------
+49-7031-16-1219
TSPAT@de.ibm.com


^ permalink raw reply	[flat|nested] 22+ messages in thread
[parent not found: <4P45.5YN.11@gated-at.bofh.it>]
* Re: crypto API and IBM z990 hardware support
@ 2003-07-02 20:23 Ulrich Weigand
  0 siblings, 0 replies; 22+ messages in thread
From: Ulrich Weigand @ 2003-07-02 20:23 UTC (permalink / raw)
  To: jmorris; +Cc: linux-kernel, tspat

James Morris wrote:

>Are there any details available on how all of this is implemented?  Are 
>these instructions synchronous?

FYI, the relevant instructions are documented in the z/Architecture
Principles of Operation, available on the Web at:

http://publibfp.boulder.ibm.com/cgi-bin/bookmgr/BOOKS/dz9zr002

Check Chapter 7 for the instructions:
CHIPER MESSAGE (KM)
CHIPER MESSAGE WITH CHAINING (KMC)
COMPUTE INTERMEDIATE MESSAGE DIGEST (KIMD)
COMPUTE LAST MESSAGE DIGEST (KLMD)
COMPUTE MESSAGE AUTHENTICATION CODE (KMAC)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  weigand@informatik.uni-erlangen.de

^ permalink raw reply	[flat|nested] 22+ messages in thread
* crypto API and IBM z990 hardware support
@ 2003-07-02  7:07 Thomas Spatzier
  2003-07-02  9:35 ` James Morris
  0 siblings, 1 reply; 22+ messages in thread
From: Thomas Spatzier @ 2003-07-02  7:07 UTC (permalink / raw)
  To: jmorris; +Cc: linux-kernel

Hello James,

I'm currently looking at the crypto API and considering adding support for
new hardware instructions implemented in the IBM z990 architecture. Since I
found your name in most of the files I find it appropriate to ask for your
opinion on how to integrate the new code (from a design point of view).
z990 provides hardware support for AES, DES and SHA. The problem is, that
the respective instructions might not be implemented on all z990 systems
(export restrictions etc). Hence, a check must be run to test whether the
instruction set is present, and if not, a fall-back to the current software
implementation must be taken. I basically have two solutions in mind: (1)
to integrate the new code into the current crypto files; add some #ifdef s
to prevent the code from being compiled when building a non-z990 kernel;
add some ifs for runtime check. (2) include the new code into an
arch/s390/crypto directory.
The advantage of (1) is that there are no seperate crypto directories, the
code doesn't drift apart. Furthermore, it's probably the best solution with
respect to the kernel module loader. On the other hand, the hardware
support is very arch-specific, which would fit in option (2). (2) however
has the disadvantage that there are multiple crypto modules; the user has
to select one to load -> must have different names for one algorithm.
What is your opinion on this subject?

Regards,
Thomas Spatzier
--------------------------------------------------
+49-7031-16-1219
TSPAT@de.ibm.com


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2003-07-10 23:57 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-02 12:35 crypto API and IBM z990 hardware support Thomas Spatzier
2003-07-02 16:57 ` James Morris
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

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).