Clean up bn.o
[svpe-tools.git] / tools.h
blobd0f89a83fad6e2e930fc014f455966388c860e2e
1 // Copyright 2007,2008 Segher Boessenkool <segher@kernel.crashing.org>
2 // Licensed under the terms of the GNU GPL, version 2
3 // http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
5 #ifndef _TOOLS_H
6 #define _TOOLS_H
8 // basic data types
9 typedef unsigned char u8;
10 typedef unsigned short u16;
11 typedef unsigned int u32;
12 typedef unsigned long long u64;
14 u32 be32(u8 *p);
15 u64 be64(u8 *p);
16 u64 be34(u8 *p);
18 // bignum
19 void bn_exp(u8 *d, u8 *a, u8 *N, u32 n, u8 *e, u32 en);
21 // crypto
22 void sha(u8 *data, u32 len, u8 *hash);
23 void get_key(const char *name, u8 *key, u32 len);
24 void aes_cbc_dec(u8 *key, u8 *iv, u8 *in, u32 len, u8 *out);
25 void decrypt_title_key(u8 *title_key_crypted, u8 *title_id, u8 *title_key);
26 int check_cert_chain(u8 *data, u32 data_len, u8 *cert, u32 cert_len);
28 // compression
29 void do_yaz0(u8 *in, u32 in_size, u8 *out, u32 out_size);
31 // error handling
32 void fatal(const char *s);
34 // output formatting
35 void print_bytes(u8 *x, u32 n);
36 void hexdump(u8 *x, u32 n);
38 #endif