Rate This Document
Findability
Accuracy
Completeness
Readability

Common Interfaces at the Algorithm Layer

Prototype

typedef void (*wcrypto_cb)(const void *msg, void *tag);

Function

Function prototype of the invoking algorithm

Input Description

msg: algorithm message

tag: user-defined tag

Output Description

None

Return Value Description

None

Usage Instruction

  

Precautions

  
 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,
};

WD algorithm types:

Algorithm Name

Description

Algorithm Type

Subalgorithm Standard Name

WCRYPTO_RSA

RSA algorithm

0

'rsa'

WCRYPTO_DH

DH algorithm

1

'dh'

WCRYPTO_CIPHER

Symmetric encryption/decryption algorithm

2

'cbc(aes)', 'cbc(sm4)'

WCRYPTO_DIGEST

Hash algorithm

3

'sm3', 'md5', 'sha256'

WCRYPTO_COMP

Compressing and decompressing algorithm

4

'zlib', 'gzip'

WCRYPTO_EC

Storage EC algorithm

5

'mpcc', 'flexec'

WCRYPTO_RNG

Random number generation algorithm

6

'trng', 'drbg'

Algorithm types can be further extended.