1 /*  libGringotts - generic data encoding (crypto+compression) library
2  *  (c) 2002, Germano Rizzo <mano@pluto.linux.it>
3  *
4  *  libgrg_crypt.h - internal-use (opaque) parameters definition
5  *  Author: Germano Rizzo
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU Library General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20  */
21 
22 #ifndef LIBGRG_CRYPT_H
23 #define LIBGRG_CRYPT_H
24 
25 #include "libgringotts.h"
26 #include "config.h"
27 
28 //masks
29 #define GRG_ENCRYPT_MASK		0x70	//01110000
30 #define GRG_HASH_MASK			0x08	//00001000
31 #define GRG_COMP_TYPE_MASK		0x04	//00000100
32 #define GRG_COMP_LVL_MASK		0x03	//00000011
33 
34 //use of small memory requirements in BZ2 decompression
35 #define USE_BZ2_SMALL_MEM		TRUE
36 
37 //file format specs; do not touch these
38 #define LIBGRG_CRC_LEN			4
39 #define LIBGRG_DATA_DIM_LEN		4
40 #define LIBGRG_ALGO_LEN			1
41 #define LIBGRG_FILE_VERSION_LEN	1
42 
43 #define LIBGRG_ALGO_POS			8	//HEADER_LEN + LIBGRG_FILE_VERSION_LEN + LIBGRG_CRC_LEN
44 #define LIBGRG_DATA_POS			9	//LIBGRG_ALGO_POS + LIBGRG_ALGO_LEN
45 #define LIBGRG_OVERHEAD			14	//LIBGRG_DATA_POS + LIBGRG_CRC_LEN + LIBGRG_DATA_DIM_LEN
46 
47 #define LIBGRG_IV_SIZE_MIN		8	//for 3DES
48 #define LIBGRG_IV_SIZE_MAX		32	//for RIJNDAEL_256
49 
50 #define FALSE	0
51 #define TRUE	!FALSE
52 
53 unsigned char *grg2mcrypt (const grg_crypt_algo algo);
54 
55 #endif
56