2003-03-03 01:03:50 +00:00
|
|
|
/* This header is meant to be included before mycrypt.h in projects where
|
2003-06-11 21:10:22 +00:00
|
|
|
* you don't want to throw all the defines in a makefile.
|
2003-03-03 01:03:50 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MYCRYPT_CUSTOM_H_
|
|
|
|
#define MYCRYPT_CUSTOM_H_
|
|
|
|
|
2004-06-20 02:41:49 +00:00
|
|
|
/* macros for various libc functions you can change for embedded targets */
|
|
|
|
#define XMALLOC malloc
|
2003-03-03 01:03:50 +00:00
|
|
|
#define XREALLOC realloc
|
2004-06-20 02:41:49 +00:00
|
|
|
#define XCALLOC calloc
|
|
|
|
#define XFREE free
|
|
|
|
|
|
|
|
#define XMEMSET memset
|
|
|
|
#define XMEMCPY memcpy
|
|
|
|
|
|
|
|
#define XCLOCK clock
|
2003-03-03 01:03:50 +00:00
|
|
|
#define XCLOCKS_PER_SEC CLOCKS_PER_SEC
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
/* Use small code where possible */
|
2004-10-30 03:00:26 +00:00
|
|
|
// #define SMALL_CODE
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
/* Enable self-test test vector checking */
|
2003-09-08 01:06:11 +00:00
|
|
|
#define LTC_TEST
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
/* clean the stack of functions which put private information on stack */
|
2004-07-23 15:40:22 +00:00
|
|
|
// #define CLEAN_STACK
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
/* disable all file related functions */
|
2004-10-30 03:00:26 +00:00
|
|
|
// #define NO_FILE
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
/* various ciphers */
|
2003-03-03 01:03:50 +00:00
|
|
|
#define BLOWFISH
|
|
|
|
#define RC2
|
|
|
|
#define RC5
|
|
|
|
#define RC6
|
|
|
|
#define SAFERP
|
|
|
|
#define RIJNDAEL
|
|
|
|
#define XTEA
|
2004-10-30 03:00:26 +00:00
|
|
|
/* _TABLES tells it to use tables during setup, _SMALL means to use the smaller scheduled key format
|
|
|
|
* (saves 4KB of ram), _ALL_TABLES enables all tables during setup */
|
2003-03-03 01:03:50 +00:00
|
|
|
#define TWOFISH
|
2003-09-08 01:06:11 +00:00
|
|
|
#define TWOFISH_TABLES
|
2004-07-23 15:40:22 +00:00
|
|
|
// #define TWOFISH_ALL_TABLES
|
|
|
|
// #define TWOFISH_SMALL
|
2004-10-30 03:00:26 +00:00
|
|
|
/* DES includes EDE triple-DES */
|
2003-03-03 01:03:50 +00:00
|
|
|
#define DES
|
|
|
|
#define CAST5
|
|
|
|
#define NOEKEON
|
2003-12-24 18:59:57 +00:00
|
|
|
#define SKIPJACK
|
2004-06-20 02:41:49 +00:00
|
|
|
/* SAFER code isn't public domain. It appears to be free to use
|
|
|
|
* but has been disabled by default to avoid any such problems
|
|
|
|
*/
|
|
|
|
//#define SAFER
|
2004-05-31 02:36:47 +00:00
|
|
|
|
2004-10-30 03:00:26 +00:00
|
|
|
/* block cipher modes of operation */
|
2003-03-03 01:03:50 +00:00
|
|
|
#define CFB
|
|
|
|
#define OFB
|
|
|
|
#define ECB
|
|
|
|
#define CBC
|
|
|
|
#define CTR
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
/* hash functions */
|
2004-10-30 03:00:26 +00:00
|
|
|
#define CHC_HASH
|
2004-02-20 20:03:32 +00:00
|
|
|
#define WHIRLPOOL
|
2003-03-03 01:03:50 +00:00
|
|
|
#define SHA512
|
|
|
|
#define SHA384
|
|
|
|
#define SHA256
|
2003-12-24 18:59:57 +00:00
|
|
|
#define SHA224
|
2003-03-03 01:03:50 +00:00
|
|
|
#define TIGER
|
|
|
|
#define SHA1
|
|
|
|
#define MD5
|
|
|
|
#define MD4
|
|
|
|
#define MD2
|
2003-09-08 01:06:11 +00:00
|
|
|
#define RIPEMD128
|
|
|
|
#define RIPEMD160
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
/* MAC functions */
|
2003-03-03 01:03:50 +00:00
|
|
|
#define HMAC
|
2003-12-24 18:59:57 +00:00
|
|
|
#define OMAC
|
2004-02-20 20:03:32 +00:00
|
|
|
#define PMAC
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
/* Encrypt + Authenticate Modes */
|
2004-01-25 17:40:34 +00:00
|
|
|
#define EAX_MODE
|
|
|
|
#define OCB_MODE
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
/* Various tidbits of modern neatoness */
|
2003-03-03 01:03:50 +00:00
|
|
|
#define BASE64
|
2004-08-06 16:42:41 +00:00
|
|
|
|
|
|
|
/* Yarrow */
|
2003-03-03 01:03:50 +00:00
|
|
|
#define YARROW
|
2004-05-31 02:36:47 +00:00
|
|
|
// which descriptor of AES to use?
|
|
|
|
// 0 = rijndael_enc 1 = aes_enc, 2 = rijndael [full], 3 = aes [full]
|
|
|
|
#define YARROW_AES 0
|
2004-08-06 16:42:41 +00:00
|
|
|
|
|
|
|
#if defined(YARROW) && !defined(CTR)
|
|
|
|
#error YARROW requires CTR chaining mode to be defined!
|
|
|
|
#endif
|
|
|
|
|
2003-03-03 01:03:50 +00:00
|
|
|
#define SPRNG
|
|
|
|
#define RC4
|
2004-07-23 15:40:22 +00:00
|
|
|
|
2004-08-06 16:42:41 +00:00
|
|
|
/* Fortuna PRNG */
|
2004-07-23 15:40:22 +00:00
|
|
|
#define FORTUNA
|
|
|
|
/* reseed every N calls to the read function */
|
2004-08-06 16:42:41 +00:00
|
|
|
#define FORTUNA_WD 10
|
|
|
|
/* number of pools (4..32) can save a bit of ram by lowering the count */
|
|
|
|
#define FORTUNA_POOLS 32
|
2004-07-23 15:40:22 +00:00
|
|
|
|
2004-08-06 16:42:41 +00:00
|
|
|
/* Greg's SOBER128 PRNG ;-0 */
|
|
|
|
#define SOBER128
|
2004-07-23 15:40:22 +00:00
|
|
|
|
2003-03-03 01:03:50 +00:00
|
|
|
#define DEVRANDOM
|
2004-05-12 20:42:16 +00:00
|
|
|
#define TRY_URANDOM_FIRST
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
/* Public Key Neatoness */
|
2003-03-03 01:03:50 +00:00
|
|
|
#define MRSA
|
2004-06-20 02:41:49 +00:00
|
|
|
/* enable RSA side channel timing prevention */
|
|
|
|
#define RSA_TIMING
|
|
|
|
|
|
|
|
/* Digital Signature Algorithm */
|
2003-12-24 18:59:57 +00:00
|
|
|
#define MDSA
|
2004-06-20 02:41:49 +00:00
|
|
|
/* Max diff between group and modulus size in bytes */
|
|
|
|
#define MDSA_DELTA 512
|
|
|
|
/* Max DSA group size in bytes (default allows 4k-bit groups) */
|
|
|
|
#define MDSA_MAX_GROUP 512
|
|
|
|
|
|
|
|
/* Diffie-Hellman */
|
2003-03-03 01:03:50 +00:00
|
|
|
#define MDH
|
2004-06-20 02:41:49 +00:00
|
|
|
/* Supported Key Sizes */
|
2003-03-03 01:03:50 +00:00
|
|
|
#define DH768
|
|
|
|
#define DH1024
|
|
|
|
#define DH1280
|
|
|
|
#define DH1536
|
|
|
|
#define DH1792
|
|
|
|
#define DH2048
|
|
|
|
#define DH2560
|
|
|
|
#define DH3072
|
|
|
|
#define DH4096
|
2004-06-20 02:41:49 +00:00
|
|
|
|
|
|
|
/* ECC */
|
|
|
|
#define MECC
|
|
|
|
/* Supported Key Sizes */
|
2003-03-03 01:03:50 +00:00
|
|
|
#define ECC160
|
|
|
|
#define ECC192
|
|
|
|
#define ECC224
|
|
|
|
#define ECC256
|
|
|
|
#define ECC384
|
|
|
|
#define ECC521
|
2004-06-20 02:41:49 +00:00
|
|
|
|
|
|
|
/* Include the MPI functionality? (required by the PK algorithms) */
|
2003-03-03 01:03:50 +00:00
|
|
|
#define MPI
|
|
|
|
|
2004-10-30 03:00:26 +00:00
|
|
|
/* PKCS #1 (RSA) and #5 (Password Handling) stuff */
|
2004-05-12 20:42:16 +00:00
|
|
|
#define PKCS_1
|
|
|
|
#define PKCS_5
|
|
|
|
|
2003-03-03 01:03:50 +00:00
|
|
|
#endif
|
|
|
|
|