This patch adds module rsa.ko in the kernel (built-in or as a kernel module)
and offers an API for fast modular exponentiation, using the Montgomery
algorithm, thus the exponentiation is not generic but can be used only when
the modulus is odd, such as RSA public/private key pairs. This module is the
computational core (using multiple precision integer arithmetics) and does not
provide any means to do key management, implement padding schemas e.t.c. so the
calling code should implement all those as needed.
This module exports some symbols, through its header file include/crypto/rsa.h
and does not use the glue code of include/crypto.h. This decision was taken
because this glue code is not really suitable for asymmetric cryptography in my
opinion. First of all RSA is not a block cipher but a stream cipher. It does not
only have a key but also an exponent that are two different entities. And the most
important is that the key size can be of any length. So it is not practical -yet-
to register the algorithm with the crypto API using a struct such as crypto_alg.
So another module can include the file include/crypto/rsa.h and call its interface
functions to create the operands for the modular exponentiation, execute the
exponentiation and use the results. All these functions and structures are
well documented kernel-doc style. Also in this way the calling in-kernel code can
implement key management, padding schemas, hashing e.t.c as needed. The main purpose
behind the creation of this module was to create the cryptographic infrastructure
to develop an in-kernel system of signed code.
For comments/questions/bug reports contact
_wremoId0