OP-TEE/optee_os — pull request #35 by jforissier (2014-09-02 13:08:33+00:00)
Title: Add crypto provider internal API.

This commit re-factors the crypto code to make it more modular. It will make
it possible to choose an alternative implementation at compile-time.
The main changes are:

- Add core/include/tee/tee_cryp_provider.h.
Defines struct crypto_ops which gathers the functions that were previously in
core/include/tee/tee_{acipher,authenc,cipher,hash,mac}.h and also contains
some functions to manipulate "big numbers".
Prototypes of asymmetric cypher functions were adjusted to use generic key
types (rsa_keypair_s, rsa_public_key_s, and so on), in which the big numbers
are accessible though an opaque type (bignum *).
- The code that was previously in tee/tee_{acipher,authenc,cipher,hash,mac}.c
was moved to lib/libtomcrypt/src/tee_ltc_provider.c, which also
replaces tee_ltc_wrapper.c. This file uses LibTomCrypt and libmpa to implement
the crypto_ops interface.
- tee_svc_cryp.c still handles data copying to/from user and parameter checking
and formatting, but it has no direct dependency on LibTomCrypt/libmpa anymore.
Instead, it relies on a global crypto_ops instance to implement the crypto
algorithms.

This code compiles but was not tested.