-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaes.h
43 lines (33 loc) · 1.14 KB
/
aes.h
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
/* drmdecrypt -- DRM decrypting tool for Samsung TVs
*
* Copyright (C) 2014 - Bernhard Froehlich <[email protected]>
* All rights reserved.
*
* This software may be modified and distributed under the terms
* of the GPL v2 license. See the LICENSE file for details.
*/
#ifndef __AES_H
#define __AES_H
#define MAXKC (256/32)
#define MAXKB (256/8)
#define MAXNR 14
#define BLOCK_SIZE 16
typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;
typedef struct {
u32 ek[ 4*(MAXNR+1) ];
u32 dk[ 4*(MAXNR+1) ];
int rounds;
} block_state;
/* AES */
extern void block_init_aes(block_state *state, unsigned char *key, int keylen);
extern void block_finalize_aes(block_state* self);
extern void block_encrypt_aes(block_state *self, u8 *in, u8 *out);
extern void block_decrypt_aes(block_state *self, u8 *in, u8 *out);
/* AES-NI */
extern void block_init_aesni(block_state *state, unsigned char *key, int keylen);
extern void block_finalize_aesni(block_state* self);
extern void block_encrypt_aesni(block_state *self, u8 *in, u8 *out);
extern void block_decrypt_aesni(block_state *self, u8 *in, u8 *out);
#endif /* __AES_H */