aes.h
1.15 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_H__
#define __PI_AES_H__
#include <PR/ultratypes.h>
/*
aes key expansion for use in setting PI_AES_EKEY for hardware decryption.
arguments
key: input, 128 bit key
expkey: output, 44*4 byte expanded key
returns >=0 on success, -1 on error
*/
int aes_HwKeyExpand(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 aes_SwEncrypt(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 aes_SwDecrypt(u8 *key,u8 *initVector,u8 *dataIn,u32 bytes,u8 *dataOut);
#endif