/****************************************************************************/
/*	Copyright (c) 2009, Bendor Research Pty. Ltd. All rights reserved.		*/
/*	This software is released under the GNU General Public License, version	*/
/*	3, with the exemptions that 1) the header files installed by this 	 	*/
/*	package can be included in closed-source code and 2) the libraries		*/
/*	built by this package can be statically linked into a closed-source 	*/
/*	binary. See the file LICENSE for the details.							*/
/*	This software is provided "AS IS", without any warranty or guarantee.	*/
/*	By using this software you acknowledge that neither Bendor Research nor	*/
/*	any of its personnel or affiliates can be held liable for any damages,	*/
/*	including, but not limited to, loss of business, loss of money, loss of */
/*	life, loss or reputation, arising out of this software being faulty or	*/
/*	not performing as advertised, even if Bendor Research was aware of such	*/
/*	faults in the software. You use this software at your own risk, any and */
/*	all liabilities that arise out of your using this software are strictly	*/
/*	yours.																	*/
/****************************************************************************/

#ifndef _BC_CRYPTO_H_
#define	_BC_CRYPTO_H_

/*
*	Hash function descriptor.
*/

struct bc_hfun_s {

	void	(*startf)(unsigned *);				// Initialisation function
	void	(*blockf)(unsigned *, unsigned *);	// Block function
	int		length;								// Length of the final hash
	int		little;								// Store data as little-endian
};

/*
*	Block cipher descriptor
*/

struct bc_cipher {

	void	(*en)(const int *, const void *, void *);	// Encrypting function
	void	(*de)(const int *, const void *, void *);	// Decrypting function
	int		bl;											// Block length
};

/*
*	Block cipher methods
*/

typedef struct bc_bcipher *BLKCIP;

struct bc_cblock {

	void	(*en)( const BLKCIP, const void *, void * );
	void	(*de)( const BLKCIP, const void *, void * );
};

/*
*	The MD5 table
*/

extern const unsigned int _bc_md5_table[];

/*
*	AES tables
*/

extern const unsigned char _bc_rcon[ 10 ];
extern const unsigned char _bc_sbox_enc[ 256 ];
extern const unsigned char _bc_sbox_dec[ 256 ];

#endif

