crypto-API.txt 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. crypto-API support for z990 Message Security Assist (MSA) instructions
  2. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  3. AUTHOR: Thomas Spatzier (tspat@de.ibm.com)
  4. 1. Introduction crypto-API
  5. ~~~~~~~~~~~~~~~~~~~~~~~~~~
  6. See Documentation/crypto/api-intro.txt for an introduction/description of the
  7. kernel crypto API.
  8. According to api-intro.txt support for z990 crypto instructions has been added
  9. in the algorithm api layer of the crypto API. Several files containing z990
  10. optimized implementations of crypto algorithms are placed in the
  11. arch/s390/crypto directory.
  12. 2. Probing for availability of MSA
  13. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  14. It should be possible to use Kernels with the z990 crypto implementations both
  15. on machines with MSA available an on those without MSA (pre z990 or z990
  16. without MSA). Therefore a simple probing mechanisms has been implemented:
  17. In the init function of each crypto module the availability of MSA and of the
  18. respective crypto algorithm in particular will be tested. If the algorithm is
  19. available the module will load and register its algorithm with the crypto API.
  20. If the respective crypto algorithm is not available, the init function will
  21. return -ENOSYS. In that case a fallback to the standard software implementation
  22. of the crypto algorithm must be taken ( -> the standard crypto modules are
  23. also build when compiling the kernel).
  24. 3. Ensuring z990 crypto module preference
  25. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  26. If z990 crypto instructions are available the optimized modules should be
  27. preferred instead of standard modules.
  28. 3.1. compiled-in modules
  29. ~~~~~~~~~~~~~~~~~~~~~~~~
  30. For compiled-in modules it has to be ensured that the z990 modules are linked
  31. before the standard crypto modules. Then, on system startup the init functions
  32. of z990 crypto modules will be called first and query for availability of z990
  33. crypto instructions. If instruction is available, the z990 module will register
  34. its crypto algorithm implementation -> the load of the standard module will fail
  35. since the algorithm is already registered.
  36. If z990 crypto instruction is not available the load of the z990 module will
  37. fail -> the standard module will load and register its algorithm.
  38. 3.2. dynamic modules
  39. ~~~~~~~~~~~~~~~~~~~~
  40. A system administrator has to take care of giving preference to z990 crypto
  41. modules. If MSA is available appropriate lines have to be added to
  42. /etc/modprobe.conf.
  43. Example: z990 crypto instruction for SHA1 algorithm is available
  44. add the following line to /etc/modprobe.conf (assuming the
  45. z990 crypto modules for SHA1 is called sha1_z990):
  46. alias sha1 sha1_z990
  47. -> when the sha1 algorithm is requested through the crypto API
  48. (which has a module autoloader) the z990 module will be loaded.
  49. TBD: a userspace module probin mechanism
  50. something like 'probe sha1 sha1_z990 sha1' in modprobe.conf
  51. -> try module sha1_z990, if it fails to load load standard module sha1
  52. the 'probe' statement is currently not supported in modprobe.conf
  53. 4. Currently implemented z990 crypto algorithms
  54. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  55. The following crypto algorithms with z990 MSA support are currently implemented.
  56. The name of each algorithm under which it is registered in crypto API and the
  57. name of the respective module is given in square brackets.
  58. - SHA1 Digest Algorithm [sha1 -> sha1_z990]
  59. - DES Encrypt/Decrypt Algorithm (64bit key) [des -> des_z990]
  60. - Tripple DES Encrypt/Decrypt Algorithm (128bit key) [des3_ede128 -> des_z990]
  61. - Tripple DES Encrypt/Decrypt Algorithm (192bit key) [des3_ede -> des_z990]
  62. In order to load, for example, the sha1_z990 module when the sha1 algorithm is
  63. requested (see 3.2.) add 'alias sha1 sha1_z990' to /etc/modprobe.conf.