summaryrefslogtreecommitdiff
path: root/bsp/airm2m/air32f103/libraries/AIR32F10xLib/lib/cryptlib/air_sm4.h
blob: d2afdf59c7f665f289285d37df6fc44d3bbbcf65 (plain)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* sm4.h - header file for sm4.c
 */

#ifndef __AIR_SM4_H
#define __AIR_SM4_H

#ifdef __cplusplus
extern "C" {
#endif

#include <string.h>
#include <stdint.h>
#include "air_crypt.h"

#define AIR_SM4_OPT_MODE_Mask        (BIT(0))
#define AIR_SM4_OPT_MODE_ENCRYPT     (0)
#define AIR_SM4_OPT_MODE_DECRYPT     (BIT(0))

#define AIR_SM4_OPT_BLK_Mask         (BIT(1)|BIT(2))
#define AIR_SM4_OPT_BLK_CBC          (BIT(1))
#define AIR_SM4_OPT_BLK_ECB          (BIT(2))
#define AIR_SM4_OPT_BLK_CBC_MAC      (BIT(1)|BIT(2))





#define AIR_RET_SM4_INIT                         (0x584E69AA)
#define AIR_RET_SM4_PARAM_ERR                    (AIR_RET_SM4_INIT + 0x01)
#define AIR_RET_SM4_TRNG_ERR                     (AIR_RET_SM4_INIT + 0x02)
#define AIR_RET_SM4_PACK_MODE_ERROR              (AIR_RET_SM4_INIT + 0x03)
#define AIR_RET_SM4_OUTBUF_TOO_SMALL             (AIR_RET_SM4_INIT + 0x04)
#define AIR_RET_SM4_INPUT_SIZE_ERROR             (AIR_RET_SM4_INIT + 0x05)
#define AIR_RET_SM4_ATTACKED                     (AIR_RET_SM4_INIT + 0x06)
#define AIR_RET_SM4_MODE_ERROR                   (AIR_RET_SM4_INIT + 0x07)
#define AIR_RET_SM4_SUCCESS                      (AIR_RET_SM4_INIT + 0x0100)

uint32_t AIRSM4_EncDec(AIR_SYM_CRYPT_CALL *pCall);


#endif


#ifdef __cplusplus
}
#endif