initial commit
[iso2ps2.git] / ps2classic / tools.h
1 // some functions borrowed from:
2 // Sven Peter <svenpeter@gmail.com>
3 // Segher Boessenkool <segher@kernel.crashing.org>
4 // Licensed under the terms of the GNU GPL, version 2
5 // http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
6
7 #ifndef TOOLS_H__
8 #define TOOLS_H__ 1
9 #include <stdint.h>
10 #include <stdio.h>
11 #include <stdlib.h>
12 #include <string.h>
13
14 #include "types.h"
15 #include "aes.h"
16 #include "sha1.h"
17
18 void fail(const char *a, ...);
19 void *mmap_file(const char *path);
20
21 void aes256cbc(u8 *key, u8 *iv, u8 *in, u64 len, u8 *out);
22 void aes256cbc_enc(u8 *key, u8 *iv, u8 *in, u64 len, u8 *out);
23 void aes128cbc(u8 *key, u8 *iv_in, u8 *in, u64 len, u8 *out);
24 void aes128cbc_enc(u8 *key, u8 *iv, u8 *in, u64 len, u8 *out);
25 void aesOmacMode1(u8* output, u8* input, int len, u8* aes_key_data, int aes_key_bits);
26
27 void sha1(u8 *data, u32 len, u8 *digest);
28
29 void get_rand(u8 *bfr, u32 size);
30 #endif