ISVP-SDK  3.12.0
Ingenic Smart Video Platform SDK
su_cipher.h
浏览该文件的文档.
1 /*
2  * Cipher utils header file.
3  *
4  * Copyright (C) 2014 Ingenic Semiconductor Co.,Ltd
5  */
6 
7 #ifndef __SU_CIPHER_H__
8 #define __SU_CIPHER_H__
9 
10 #ifdef __cplusplus
11 #if __cplusplus
12 extern "C"
13 {
14 #endif
15 #endif /* __cplusplus */
16 
33 typedef enum IN_UNF_CIPHER_ALG_E
34 {
35  IN_UNF_CIPHER_ALG_AES = 0x0,
36  IN_UNF_CIPHER_ALG_DES = 0x1
38 
44 {
45  IN_UNF_CIPHER_WORK_MODE_ECB = 0x0,
46  IN_UNF_CIPHER_WORK_MODE_CBC = 0x1,
47  IN_UNF_CIPHER_WORK_MODE_OTHER = 0x2
49 
55 {
56  IN_UNF_CIPHER_KEY_AES_128BIT = 0x0,
58 
64 {
65  IN_UNF_CIPHER_BIT_WIDTH_128BIT = 0x0,
67 
71 typedef struct IN_UNF_CIPHER_CTRL_S
72 {
73  unsigned int key[4];
74  unsigned int IV[4];
75  unsigned int enDataLen;
81 
96 int SU_CIPHER_Init(void);
97 
112 int SU_CIPHER_Exit(void);
113 
131 int SU_CIPHER_CreateHandle(void);
132 
148 int SU_CIPHER_DestroyHandle(int fd);
149 
166 int SU_CIPHER_ConfigHandle(int hCipher, IN_UNF_CIPHER_CTRL* Ctrl);
167 
186 int SU_CIPHER_Encrypt(int hCipher, unsigned int * srcAddr, unsigned int * dstAddr, unsigned int dataLen);
187 
206 int SU_CIPHER_Decrypt(int hCipher, unsigned int * srcAddr, unsigned int * dstAddr, unsigned int dataLen);
207 
211 #define REINIT -10
212 #define INIT_FAILED -11
213 #define FAILED_GETHANDLE -12
214 #define INVALID_PARA -13
215 #define SET_PARA_FAILED -14
216 #define FAILURE -15
217 #define SET_DATALEN_ERR -16
218 #define EXIT_ERR -17
219 #define UNINIT -18
220 #define FAILED_DESHANDLE -19
225 #ifdef __cplusplus
226 #if __cplusplus
227 }
228 #endif
229 #endif /* __cplusplus */
230 
231 #endif /* __SU_CIPHER_H__ */
IN_UNF_CIPHER_ALG enAlg
处理数据使用的加密算法
Definition: su_cipher.h:76
int SU_CIPHER_Init(void)
加密模块打开接口.
enum IN_UNF_CIPHER_WORK_MODE_E IN_UNF_CIPHER_WORK_MODE
选择加密模式.
enum IN_UNF_CIPHER_ALG_E IN_UNF_CIPHER_ALG
选择加密算法.
unsigned int IV[4]
加密时使用的IV向量
Definition: su_cipher.h:74
unsigned int key[4]
加密时使用的密钥
Definition: su_cipher.h:73
选择加密处理控制结构体.
Definition: su_cipher.h:71
int SU_CIPHER_Exit(void)
加密模块关闭接口.
IN_UNF_CIPHER_BIT_WIDTH_E
选择加密算法一次处理的数据长度.
Definition: su_cipher.h:63
int SU_CIPHER_DestroyHandle(int fd)
销毁加密模块句柄.
IN_UNF_CIPHER_ALG_E
选择加密算法.
Definition: su_cipher.h:33
enum IN_UNF_CIPHER_KEY_LENGTH_E IN_UNF_CIPHER_KEY_LENGTH
选择加密使用的密钥长度.
struct IN_UNF_CIPHER_CTRL_S IN_UNF_CIPHER_CTRL
选择加密处理控制结构体.
IN_UNF_CIPHER_WORK_MODE enWorkMode
处理数据使用的加密算法的模式
Definition: su_cipher.h:78
int SU_CIPHER_Decrypt(int hCipher, unsigned int *srcAddr, unsigned int *dstAddr, unsigned int dataLen)
开始进行数据的解密.
IN_UNF_CIPHER_KEY_LENGTH_E
选择加密使用的密钥长度.
Definition: su_cipher.h:54
IN_UNF_CIPHER_WORK_MODE_E
选择加密模式.
Definition: su_cipher.h:43
int SU_CIPHER_ConfigHandle(int hCipher, IN_UNF_CIPHER_CTRL *Ctrl)
对加密模块进行配置.
unsigned int enDataLen
需要处理的数据总长度
Definition: su_cipher.h:75
enum IN_UNF_CIPHER_BIT_WIDTH_E IN_UNF_CIPHER_BIT_WIDTH
选择加密算法一次处理的数据长度.
IN_UNF_CIPHER_KEY_LENGTH enKeyLen
加密算法使用的KEY的长度
Definition: su_cipher.h:79
int SU_CIPHER_Encrypt(int hCipher, unsigned int *srcAddr, unsigned int *dstAddr, unsigned int dataLen)
开始进行数据的加密.
int SU_CIPHER_CreateHandle(void)
获得加密模块句柄接口.
IN_UNF_CIPHER_BIT_WIDTH enBitWidth
加密算法一次处理的数据长度
Definition: su_cipher.h:77