算法层公共接口
函数原型 |
typedef void (*wcrypto_cb)(const void *msg, void *tag); |
---|---|
函数功能 |
调用算法的函数原型 |
输入说明 |
msg:算法消息 tag:用户输入的自定义标识tag |
输出说明 |
无 |
返回值说明 |
无 |
使用说明 |
|
注意事项 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | /* General Warpdrive call back tag, which is used to fill the user_data area in all kinds of algorithm messages */ struct wcrypto_cb_tag { void *ctx;/* user: context or other user relatives */ void *tag;/* to store user tag */ int ctx_id;/* user id: context ID or other user identifier */ }; /* The algorithm’s private parameters of Warpdrive queue capability */ struct wcrypto_paras { /* 0--encipher/compress .etc, 1 ---decipher/decomp .etc */ __u8 direction; /* to be extended */ }; enum wcrypto_type { WCRYPTO_RSA, WCRYPTO_DH, WCRYPTO_CIPHER, WCRYPTO_DIGEST, WCRYPTO_COMP, WCRYPTO_EC, WCRYPTO_RNG, WCRYPTO_MAX_ALG, }; |
Warpdrive算法类型定义:
算法类名称定义 |
算法类含义 |
算法类型值 |
子算法标准名称 |
---|---|---|---|
WCRYPTO_RSA |
RSA算法 |
0 |
‘rsa’ |
WCRYPTO_DH |
DH算法 |
1 |
‘dh’ |
WCRYPTO_CIPHER |
对称加解密算法 |
2 |
‘cbc(aes)’,‘cbc(sm4)’ |
WCRYPTO_DIGEST |
Hash算法 |
3 |
‘sm3’,‘md5’,‘sha256’ |
WCRYPTO_COMP |
压缩解压缩算法 |
4 |
‘zlib’,‘gzip’ |
WCRYPTO_EC |
存储EC算法类 |
5 |
‘mpcc’,‘flexec’ |
WCRYPTO_RNG |
随机数产生算法 |
6 |
‘trng’,‘drbg’ |

算法类可继续拓展
父主题: 算法层接口