kernel crypto hmac sha256 API call code
来源:互联网 发布:巴宝莉红粉恋歌知乎 编辑:程序博客网 时间:2024/06/01 09:23
static int hmac_sha256(char *plaintext, unsigned int plain_text_size, char *key, unsigned int key_size, uint8_t *result){ struct scatterlist sg; struct crypto_hash *tfm; struct hash_desc desc; int ret; if (!result) { printk(KERN_ERR "param err\n"); return -EINVAL; } tfm = crypto_alloc_hash("hmac(sha256)", 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) { printk(KERN_ERR "crypto_alloc_ahash failed: err %ld", PTR_ERR(tfm)); return -EINVAL; } desc.tfm = tfm; desc.flags = 0; sg_set_buf(&sg, plaintext, plain_text_size); ret = crypto_hash_setkey(tfm, key, key_size); if (ret) { printk(KERN_ERR "crypto_ahash_setkey failed: err %d", ret); goto out; } ret = crypto_hash_digest(&desc, &sg, plain_text_size, result); if(ret) { printk(KERN_ERR "digest() failed ret = %d\n", ret); goto out; } printk(KERN_DEBUG, "crypto hash digest size %d\n", crypto_hash_digestsize(tfm));out: crypto_free_hash(tfm); return -EINVAL;}
0 0
- kernel crypto hmac sha256 API call code
- 详解Node.js API系列 Crypto加密模块(2) Hmac
- 各种语言HMAC SHA256实现
- HMAC implementation based on OPENSSL, Crypto API(CSP) and third party algorithm library
- 各种语言版本的基于HMAC-SHA256的base64加密
- 不同语言使用HMAC SHA256创建base64哈希加密
- 各种语言版本的基于HMAC-SHA256的base64加密
- Linux Kernel(Android) 加密算法总结(二)- A netlink-based user-space crypto API
- Linux Kernel(Android) 加密算法总结(二)- A netlink-based user-space crypto API
- SHA256加密-各种语言版本的基于HMAC-SHA256的base64加密
- Crypto API 学习笔记
- windows crypto API 笔记
- 微软crypto API
- Crypto API (Linux)
- sha256
- sha256
- Crypto API加密通信流程
- Crypto API加密通信流程
- 直方图均衡化-彩色图
- RequiredFieldValidator验证
- cloudera manager 添加开机启动
- Android UI 优化<merge/> <include/> <ViewStub>
- 如何使用Ubuntu SDK DownloadManager来同时下载多个文件
- kernel crypto hmac sha256 API call code
- LoadRunner脚本优化之—参数化迭代介
- UISearchDisplayController 实现筛选功能
- 生活的重心
- HA脑裂和对策
- 数据库(第一范式,第二范式,第三范式)
- hihoCoder 1165 益智游戏
- 阿玛塔坦克全貌曝光 全面压制全球顶尖主
- 写给未来程序员的建议