pi_aes.h
1.13 KB
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
#ifndef __PI_AES_VER_HDR__
#define __PI_AES_VER_HDR__
#include <ultratypes.h>
/*
aes key expansion for use in setting PI_AES_EKEY.
arguments
key: input, 128 bit key
expkey: output, 44*4 byte expanded key
returns >=0 on success, -1 on error
*/
int aesKeyExpand(u8 *key,u8 *expkey);
/*
aes encryption given the 128 bit key (NOT the expanded key).
arguments
key: input, 128 bit key
initVector: input, 128 bit initialization vector
dataIn: input, unencrypted data
bytes: input, number of bytes to be encrypted, must be multiple of 16.
dataOut: output, encrypted data
returns >=0 on success, -1 on error
*/
int aesEncrypt(u8 *key,u8 *initVector,u8 *dataIn,u32 bytes,u8 *dataOut);
/*
aes decryption given the 128 bit key (NOT the expanded key).
arguments
key: input, 128 bit key
initVector: input, 128 bit initialization vector
dataIn: input, encrypted data
bytes: input, number of bytes to be decrypted, must be multiple of 16.
dataOut: output, decrypted data
returns >=0 on success, -1 on error
*/
int aesDecrypt(u8 *key,u8 *initVector,u8 *dataIn,u32 bytes,u8 *dataOut);
#endif