Create HMAC SHA1 in C using pure linux crypto api

I need to apply HMAC SHA1 to some diffusers in program C. I have an example code written for kernel 2.4 hmac crypto api that uses this function:

void crypto_hmac(struct crypto_tfm *tfm, u8 *key, unsigned int *keylen, struct scatterlist *sg, unsigned int nsg, u8 *out)

but the crypto API in the kernel 3.13 and after that is SO MUCH DIFFERENT than 2.4!

I searched everywhere to find some example of using a new weird minimized function

static int hmac_create(struct crypto_template *tmpl, struct rtattr **tb)

provided in hmac.c (source / crypto) , but I can not find any topic or examples that use the crypto api kernel specifically for hmac conversion.

Does any authority have experience using the Linux Crypto HMAC API in C ? Using this procedure will be no more than a few lines of C codes.

+4
source share

Source: https://habr.com/ru/post/1614396/


All Articles