view src/win32/7zip/7z/C/Aes.h @ 2:3549bbe597ed

adding makefile.am
author Robert McIntyre <rlm@mit.edu>
date Sat, 03 Mar 2012 10:31:47 -0600
parents f9f4f1b99eed
children
line wrap: on
line source
1 /* Aes.h -- AES encryption / decryption
2 2008-08-05
3 Igor Pavlov
4 Public domain */
6 #ifndef __AES_H
7 #define __AES_H
9 #include "Types.h"
11 #define AES_BLOCK_SIZE 16
13 typedef struct
14 {
15 unsigned numRounds2; /* = numRounds / 2 */
16 UInt32 rkey[(14 + 1) * 4];
17 } CAes;
19 /* Call AesGenTables one time before other AES functions */
20 void AesGenTables(void);
22 /* keySize = 16 or 24 or 32 (bytes) */
23 void Aes_SetKeyEncode(CAes *p, const Byte *key, unsigned keySize);
24 void Aes_SetKeyDecode(CAes *p, const Byte *key, unsigned keySize);
26 /* Aes_Encode32 and Aes_Decode32 functions work with little-endian words.
27 src and dest are pointers to 4 UInt32 words.
28 arc and dest can point to same block */
29 void Aes_Encode32(const CAes *p, UInt32 *dest, const UInt32 *src);
30 void Aes_Decode32(const CAes *p, UInt32 *dest, const UInt32 *src);
32 typedef struct
33 {
34 UInt32 prev[4];
35 CAes aes;
36 } CAesCbc;
38 void AesCbc_Init(CAesCbc *p, const Byte *iv); /* iv size is AES_BLOCK_SIZE */
40 /* AesCbc_Encode and AesCbc_Decode:
41 if (res <= size): Filter have converted res bytes
42 if (res > size): Filter have not converted anything. And it needs at
43 least res = AES_BLOCK_SIZE bytes to convert one block */
45 SizeT AesCbc_Encode(CAesCbc *p, Byte *data, SizeT size);
46 SizeT AesCbc_Decode(CAesCbc *p, Byte *data, SizeT size);
48 #endif