使用纯粹的linux crypto API在C中创buildHMAC SHA1

我需要在C程序中的某些散列表上应用HMAC SHA1。 我有一个为内核2.4 hmacencryptionapi编写的示例代码,它使用此函数:

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

但是内核3.13和之后的encryptionAPI比2.4差很多!

我到处寻找使用新的奇怪的最小化函数的例子

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

提供在hmac.c(源/encryption) ,但我找不到任何使用内核encryptionAPI 具体 hmac变换的主题或例子。

任何机构有任何使用Linux中Crypto API HMAC的经验吗? 使用这个程序不会超过几行C代码。