ISVP-SDK  3.12.0
Ingenic Smart Video Platform SDK
su_cipher.h
Go to the documentation of this file.
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
Encryption algorithm used in processing data.
Definition: su_cipher.h:76
int SU_CIPHER_Init(void)
Open encryption module.
enum IN_UNF_CIPHER_WORK_MODE_E IN_UNF_CIPHER_WORK_MODE
Select the encryption mode.
enum IN_UNF_CIPHER_ALG_E IN_UNF_CIPHER_ALG
Select an encryption algorithm.
unsigned int IV[4]
IV Vector used in a encryption.
Definition: su_cipher.h:74
unsigned int key[4]
KEY used in a encryption.
Definition: su_cipher.h:73
Select the encryption process control structure.
Definition: su_cipher.h:71
int SU_CIPHER_Exit(void)
Close encryption module.
IN_UNF_CIPHER_BIT_WIDTH_E
Select the data length of encryption algorithm at a process.
Definition: su_cipher.h:63
int SU_CIPHER_DestroyHandle(int fd)
Destroy a encryption module handle.
IN_UNF_CIPHER_ALG_E
Select an encryption algorithm.
Definition: su_cipher.h:33
enum IN_UNF_CIPHER_KEY_LENGTH_E IN_UNF_CIPHER_KEY_LENGTH
Select the encryption key length used.
struct IN_UNF_CIPHER_CTRL_S IN_UNF_CIPHER_CTRL
Select the encryption process control structure.
IN_UNF_CIPHER_WORK_MODE enWorkMode
Encryption algorithm mode used to process data.
Definition: su_cipher.h:78
int SU_CIPHER_Decrypt(int hCipher, unsigned int *srcAddr, unsigned int *dstAddr, unsigned int dataLen)
Start decrypt data.
IN_UNF_CIPHER_KEY_LENGTH_E
Select the encryption key length used.
Definition: su_cipher.h:54
IN_UNF_CIPHER_WORK_MODE_E
Select the encryption mode.
Definition: su_cipher.h:43
int SU_CIPHER_ConfigHandle(int hCipher, IN_UNF_CIPHER_CTRL *Ctrl)
Config encryption module.
unsigned int enDataLen
Total length of data to be processed.
Definition: su_cipher.h:75
enum IN_UNF_CIPHER_BIT_WIDTH_E IN_UNF_CIPHER_BIT_WIDTH
Select the data length of encryption algorithm at a process.
IN_UNF_CIPHER_KEY_LENGTH enKeyLen
KEY length of the encryption algorithm.
Definition: su_cipher.h:79
int SU_CIPHER_Encrypt(int hCipher, unsigned int *srcAddr, unsigned int *dstAddr, unsigned int dataLen)
Start encrypt data.
int SU_CIPHER_CreateHandle(void)
Get a encryption module handle.
IN_UNF_CIPHER_BIT_WIDTH enBitWidth
Data length of Encryption algorithm in once process.
Definition: su_cipher.h:77