---
title: 算法层公共接口
description: "| 函数原型 | typedef void (\*wcrypto\_cb)(const void \*msg, void \*tag); |"
url: https://www.hikunpeng.com/document/detail/zh/kunpengboostkithistory/252RC1/accel/kunpengaccel_17_0043.html
sourcePath: /source/zh/kunpengboostkithistory/252RC1/accel/kunpengaccel_17_0043.html
indexId: 88851d582cd6c1bb0a06b33a239bf790243dc25c8951a97c54057e6c23b85c0772
---
# 算法层公共接口

| 函数原型 | typedef void (\*wcrypto\_cb)(const void \*msg, void \*tag); |
| --- | --- |
| 函数功能 | 调用算法的函数原型 |
| 输入说明 | msg：算法消息 tag：用户输入的自定义标识tag |
| 输出说明 | 无 |
| 返回值说明 | 无 |
| 使用说明 | 无 |
| 注意事项 | 无 |


```
/* 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’ |


算法类可继续拓展
