base
This commit is contained in:
+89
@@ -0,0 +1,89 @@
|
||||
#ifndef LIBDEFS_H
|
||||
#define LIBDEFS_H
|
||||
#include <libdefs.h>
|
||||
#endif
|
||||
|
||||
/* Local Defines */
|
||||
|
||||
#ifndef lt_ptr
|
||||
/* older version of libltdl */
|
||||
# define lt_ptr lt_ptr_t
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
char* name;
|
||||
lt_ptr address;
|
||||
} mcrypt_preloaded;
|
||||
|
||||
typedef struct {
|
||||
lt_dlhandle handle;
|
||||
char name[64];
|
||||
} mcrypt_dlhandle;
|
||||
|
||||
#define MCRYPT_INTERNAL_HANDLER (void*)-1
|
||||
|
||||
typedef struct {
|
||||
mcrypt_dlhandle algorithm_handle;
|
||||
mcrypt_dlhandle mode_handle;
|
||||
|
||||
/* Holds the algorithm's internal key */
|
||||
byte *akey;
|
||||
|
||||
byte *abuf; /* holds the mode's internal buffers */
|
||||
|
||||
/* holds the key */
|
||||
byte *keyword_given;
|
||||
|
||||
/* These were included to speed up encryption/decryption proccess, so
|
||||
* there is not need for resolving symbols every time.
|
||||
*/
|
||||
lt_ptr m_encrypt;
|
||||
lt_ptr m_decrypt;
|
||||
lt_ptr a_encrypt;
|
||||
lt_ptr a_decrypt;
|
||||
lt_ptr a_block_size;
|
||||
} CRYPT_STREAM;
|
||||
|
||||
typedef CRYPT_STREAM* MCRYPT;
|
||||
|
||||
#define MCRYPT_FAILED 0x0
|
||||
|
||||
int mcrypt_module_close(MCRYPT td);
|
||||
|
||||
/* frontends */
|
||||
|
||||
int end_mcrypt( MCRYPT td, void *buf);
|
||||
int mcrypt_enc_get_size(MCRYPT td);
|
||||
int mcrypt_mode_get_size(MCRYPT td);
|
||||
int mcrypt_set_key(MCRYPT td, void *a, const void *, int c, const void *, int e);
|
||||
int mcrypt_enc_get_block_size(MCRYPT td);
|
||||
int __mcrypt_get_block_size(MCRYPT td);
|
||||
int mcrypt_enc_get_algo_iv_size(MCRYPT td);
|
||||
int mcrypt_enc_get_iv_size(MCRYPT td);
|
||||
int mcrypt_enc_get_key_size(MCRYPT td);
|
||||
int* mcrypt_enc_get_supported_key_sizes(MCRYPT td, int* out_size);
|
||||
int mcrypt_enc_is_block_algorithm(MCRYPT td);
|
||||
char *mcrypt_enc_get_algorithms_name(MCRYPT td);
|
||||
int init_mcrypt(MCRYPT td, void*buf, const void *, int, const void *);
|
||||
int mcrypt(MCRYPT td, void* buf, void *a, int b);
|
||||
int mdecrypt(MCRYPT td, void* buf, void *a, int b);
|
||||
char *mcrypt_enc_get_modes_name(MCRYPT td);
|
||||
int mcrypt_enc_is_block_mode(MCRYPT td);
|
||||
int mcrypt_enc_mode_has_iv(MCRYPT td);
|
||||
int mcrypt_enc_is_block_algorithm_mode(MCRYPT td);
|
||||
int mcrypt_module_algorithm_version(const char *algorithm, const char *a_directory);
|
||||
int mcrypt_module_mode_version(const char *mode, const char *m_directory);
|
||||
int mcrypt_get_size(MCRYPT td);
|
||||
|
||||
|
||||
#define MCRYPT_UNKNOWN_ERROR -1
|
||||
#define MCRYPT_ALGORITHM_MODE_INCOMPATIBILITY -2
|
||||
#define MCRYPT_KEY_LEN_ERROR -3
|
||||
#define MCRYPT_MEMORY_ALLOCATION_ERROR -4
|
||||
#define MCRYPT_UNKNOWN_MODE -5
|
||||
#define MCRYPT_UNKNOWN_ALGORITHM -6
|
||||
|
||||
lt_ptr mcrypt_dlsym( mcrypt_dlhandle, char* str);
|
||||
void mcrypt_dlclose( mcrypt_dlhandle mod);
|
||||
lt_ptr _mcrypt_search_symlist_lib(const char* name);
|
||||
lt_ptr _mcrypt_search_symlist_sym(mcrypt_dlhandle handle, const char* _name);
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* $Id: cast-128.h,v 1.1 2007/07/19 06:11:48 pizon Exp $
|
||||
*
|
||||
* CAST-128 in C
|
||||
* Written by Steve Reid <sreid@sea-to-sky.net>
|
||||
* 100% Public Domain - no warranty
|
||||
* Released 1997.10.11
|
||||
*/
|
||||
|
||||
#ifndef _CAST_H_INCLUDED
|
||||
#define _CAST_H_INCLUDED
|
||||
|
||||
#define CAST_MIN_KEYSIZE 5
|
||||
#define CAST_MAX_KEYSIZE 16
|
||||
#define CAST_BLOCKSIZE 8
|
||||
|
||||
#define CAST_SMALL_KEY 10
|
||||
#define CAST_SMALL_ROUNDS 12
|
||||
#define CAST_FULL_ROUNDS 16
|
||||
|
||||
typedef struct cast_key {
|
||||
word32 xkey[32]; /* Key, after expansion */
|
||||
unsigned rounds; /* Number of rounds to use, 12 or 16 */
|
||||
} CAST_KEY;
|
||||
|
||||
#endif /* ifndef _CAST_H_INCLUDED */
|
||||
|
||||
Reference in New Issue
Block a user