How to register my own algorithm to Linux crypto API for user mode apps

264 Views Asked by At

I'm a newbie in Linux kernel(and crypto API). Currently I'm applying hardware crypto into user mode apps like OpenSSL, etc. I searched a lot but still not understand very clearly.

My first question is, is the following all I should do?

  • First, I should register my own algorithm to Linux kernel's Crypto API.
  • Then, I need to call the algorithm registered above from OpenSSL, etc., via AF_ALG or cryptodev(not preferred because it's GPL licensed).

Within the first step, where should I deploy the registration code(hacking the linux kernel or deploying it in user mode apps?) And is there any simple example of the implementation?

My algorithms are some APIs which communicate with the hardware to start the actual crypto process, including symmetric/asymmetric encryptions and hash/hmac. For example,

uint32_t AES_ecb(uint32_t addr_src, uint32_t addr_dest, uint32_t length, uint8_t key_idx, uint8_t encORdec)

Apparently it differs a lot from the original Crypto API interface. So my second question is, for the purpose of reducing wrappers(and improve the speed), is it necessary to modify this API to fit Crypto API(or there isn't too much differences so I needn't to contact the vendor)?

I have searched a lot about Crypto API (like keywords of crypto_alg and AF_ALG), but there isn't much detailed informations about registration of an algorithm.

0

There are 0 best solutions below