2004-12-30 23:55:53 +00:00
|
|
|
#ifndef TOMCRYPT_CUSTOM_H_
|
|
|
|
#define TOMCRYPT_CUSTOM_H_
|
2003-03-03 01:03:50 +00:00
|
|
|
|
2004-06-20 02:41:49 +00:00
|
|
|
/* macros for various libc functions you can change for embedded targets */
|
2005-11-24 11:57:58 +00:00
|
|
|
#ifndef XMALLOC
|
2012-07-26 14:43:15 +02:00
|
|
|
#ifdef malloc
|
2006-12-16 18:10:04 +00:00
|
|
|
#define LTC_NO_PROTOTYPES
|
|
|
|
#endif
|
2004-06-20 02:41:49 +00:00
|
|
|
#define XMALLOC malloc
|
2005-11-24 11:57:58 +00:00
|
|
|
#endif
|
|
|
|
#ifndef XREALLOC
|
2012-07-26 14:43:15 +02:00
|
|
|
#ifdef realloc
|
2006-12-16 18:10:04 +00:00
|
|
|
#define LTC_NO_PROTOTYPES
|
|
|
|
#endif
|
2003-03-03 01:03:50 +00:00
|
|
|
#define XREALLOC realloc
|
2005-11-24 11:57:58 +00:00
|
|
|
#endif
|
|
|
|
#ifndef XCALLOC
|
2012-07-26 14:43:15 +02:00
|
|
|
#ifdef calloc
|
2006-12-16 18:10:04 +00:00
|
|
|
#define LTC_NO_PROTOTYPES
|
|
|
|
#endif
|
2004-06-20 02:41:49 +00:00
|
|
|
#define XCALLOC calloc
|
2005-11-24 11:57:58 +00:00
|
|
|
#endif
|
|
|
|
#ifndef XFREE
|
2006-12-16 18:10:04 +00:00
|
|
|
#ifdef free
|
|
|
|
#define LTC_NO_PROTOTYPES
|
|
|
|
#endif
|
2004-06-20 02:41:49 +00:00
|
|
|
#define XFREE free
|
2005-11-24 11:57:58 +00:00
|
|
|
#endif
|
2004-06-20 02:41:49 +00:00
|
|
|
|
2005-11-24 11:57:58 +00:00
|
|
|
#ifndef XMEMSET
|
2006-12-16 18:10:04 +00:00
|
|
|
#ifdef memset
|
|
|
|
#define LTC_NO_PROTOTYPES
|
|
|
|
#endif
|
2004-06-20 02:41:49 +00:00
|
|
|
#define XMEMSET memset
|
2005-11-24 11:57:58 +00:00
|
|
|
#endif
|
|
|
|
#ifndef XMEMCPY
|
2006-12-16 18:10:04 +00:00
|
|
|
#ifdef memcpy
|
|
|
|
#define LTC_NO_PROTOTYPES
|
|
|
|
#endif
|
2004-06-20 02:41:49 +00:00
|
|
|
#define XMEMCPY memcpy
|
2005-11-24 11:57:58 +00:00
|
|
|
#endif
|
|
|
|
#ifndef XMEMCMP
|
2012-07-26 14:43:15 +02:00
|
|
|
#ifdef memcmp
|
2006-12-16 18:10:04 +00:00
|
|
|
#define LTC_NO_PROTOTYPES
|
|
|
|
#endif
|
2005-11-24 11:57:58 +00:00
|
|
|
#define XMEMCMP memcmp
|
|
|
|
#endif
|
2006-12-16 18:10:04 +00:00
|
|
|
#ifndef XSTRCMP
|
|
|
|
#ifdef strcmp
|
|
|
|
#define LTC_NO_PROTOTYPES
|
|
|
|
#endif
|
|
|
|
#define XSTRCMP strcmp
|
|
|
|
#endif
|
2004-06-20 02:41:49 +00:00
|
|
|
|
2005-11-24 11:57:58 +00:00
|
|
|
#ifndef XCLOCK
|
2004-06-20 02:41:49 +00:00
|
|
|
#define XCLOCK clock
|
2005-11-24 11:57:58 +00:00
|
|
|
#endif
|
|
|
|
#ifndef XCLOCKS_PER_SEC
|
2003-03-03 01:03:50 +00:00
|
|
|
#define XCLOCKS_PER_SEC CLOCKS_PER_SEC
|
2005-11-24 11:57:58 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef XQSORT
|
2006-12-16 18:10:04 +00:00
|
|
|
#ifdef qsort
|
|
|
|
#define LTC_NO_PROTOTYPES
|
|
|
|
#endif
|
2005-11-24 11:57:58 +00:00
|
|
|
#define XQSORT qsort
|
|
|
|
#endif
|
2004-05-31 02:36:47 +00:00
|
|
|
|
2013-08-14 16:12:56 +02:00
|
|
|
/* shortcut to disable automatic inclusion */
|
|
|
|
#if defined LTC_NOTHING && !defined LTC_EASY
|
2013-11-17 09:53:14 +07:00
|
|
|
#define LTC_NO_MATH
|
2013-08-14 16:12:56 +02:00
|
|
|
#define LTC_NO_CIPHERS
|
|
|
|
#define LTC_NO_MODES
|
|
|
|
#define LTC_NO_HASHES
|
|
|
|
#define LTC_NO_MACS
|
|
|
|
#define LTC_NO_PRNGS
|
|
|
|
#define LTC_NO_PK
|
|
|
|
#define LTC_NO_PKCS
|
|
|
|
#define LTC_NO_MISC
|
|
|
|
#endif /* LTC_NOTHING */
|
|
|
|
|
2006-01-26 18:11:56 +00:00
|
|
|
/* Easy button? */
|
|
|
|
#ifdef LTC_EASY
|
|
|
|
#define LTC_NO_CIPHERS
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_RIJNDAEL
|
|
|
|
#define LTC_BLOWFISH
|
|
|
|
#define LTC_DES
|
|
|
|
#define LTC_CAST5
|
2012-07-26 14:43:15 +02:00
|
|
|
|
2006-01-26 18:11:56 +00:00
|
|
|
#define LTC_NO_MODES
|
2006-08-30 23:30:00 +00:00
|
|
|
#define LTC_ECB_MODE
|
|
|
|
#define LTC_CBC_MODE
|
|
|
|
#define LTC_CTR_MODE
|
2012-07-26 14:43:15 +02:00
|
|
|
|
2006-01-26 18:11:56 +00:00
|
|
|
#define LTC_NO_HASHES
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_SHA1
|
|
|
|
#define LTC_SHA512
|
|
|
|
#define LTC_SHA384
|
|
|
|
#define LTC_SHA256
|
|
|
|
#define LTC_SHA224
|
2012-07-26 14:43:15 +02:00
|
|
|
|
2006-01-26 18:11:56 +00:00
|
|
|
#define LTC_NO_MACS
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_HMAC
|
|
|
|
#define LTC_OMAC
|
|
|
|
#define LTC_CCM_MODE
|
2006-01-26 18:11:56 +00:00
|
|
|
|
|
|
|
#define LTC_NO_PRNGS
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_SPRNG
|
|
|
|
#define LTC_YARROW
|
|
|
|
#define LTC_DEVRANDOM
|
2014-07-17 10:49:05 +02:00
|
|
|
#define LTC_TRY_URANDOM_FIRST
|
2012-07-26 14:43:15 +02:00
|
|
|
|
2006-01-26 18:11:56 +00:00
|
|
|
#define LTC_NO_PK
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_MRSA
|
|
|
|
#define LTC_MECC
|
2006-01-26 18:11:56 +00:00
|
|
|
|
2013-08-14 16:12:56 +02:00
|
|
|
#define LTC_NO_MISC
|
|
|
|
#define LTC_BASE64
|
|
|
|
#endif
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
/* Enable self-test test vector checking */
|
2005-06-09 00:08:13 +00:00
|
|
|
#ifndef LTC_NO_TEST
|
|
|
|
#define LTC_TEST
|
|
|
|
#endif
|
2014-04-30 01:10:22 +02:00
|
|
|
/* Enable extended self-tests */
|
|
|
|
/* #define LTC_TEST_EXT */
|
2004-05-31 02:36:47 +00:00
|
|
|
|
2013-08-14 16:12:56 +02:00
|
|
|
/* Use small code where possible */
|
|
|
|
/* #define LTC_SMALL_CODE */
|
|
|
|
|
2004-05-31 02:36:47 +00:00
|
|
|
/* clean the stack of functions which put private information on stack */
|
2005-04-17 11:37:13 +00:00
|
|
|
/* #define LTC_CLEAN_STACK */
|
2004-05-31 02:36:47 +00:00
|
|
|
|
|
|
|
/* disable all file related functions */
|
2005-04-17 11:37:13 +00:00
|
|
|
/* #define LTC_NO_FILE */
|
2004-12-30 23:55:53 +00:00
|
|
|
|
|
|
|
/* disable all forms of ASM */
|
2005-04-17 11:37:13 +00:00
|
|
|
/* #define LTC_NO_ASM */
|
|
|
|
|
|
|
|
/* disable FAST mode */
|
|
|
|
/* #define LTC_NO_FAST */
|
|
|
|
|
|
|
|
/* disable BSWAP on x86 */
|
|
|
|
/* #define LTC_NO_BSWAP */
|
2004-05-31 02:36:47 +00:00
|
|
|
|
2013-08-14 16:12:56 +02:00
|
|
|
/* ---> math provider? <--- */
|
2013-11-17 09:53:14 +07:00
|
|
|
#ifndef LTC_NO_MATH
|
|
|
|
|
2013-08-14 16:12:56 +02:00
|
|
|
/* LibTomMath */
|
|
|
|
/* #define LTM_DESC */
|
|
|
|
|
|
|
|
/* TomsFastMath */
|
|
|
|
/* #define TFM_DESC */
|
|
|
|
|
2013-11-17 09:53:14 +07:00
|
|
|
#endif /* LTC_NO_MATH */
|
|
|
|
|
2013-08-14 16:12:56 +02:00
|
|
|
/* GNU Multiple Precision Arithmetic Library */
|
|
|
|
/* #define GMP_DESC */
|
|
|
|
|
2004-12-30 23:55:53 +00:00
|
|
|
/* ---> Symmetric Block Ciphers <--- */
|
2005-06-09 00:08:13 +00:00
|
|
|
#ifndef LTC_NO_CIPHERS
|
|
|
|
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_BLOWFISH
|
|
|
|
#define LTC_RC2
|
|
|
|
#define LTC_RC5
|
|
|
|
#define LTC_RC6
|
|
|
|
#define LTC_SAFERP
|
|
|
|
#define LTC_RIJNDAEL
|
|
|
|
#define LTC_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 */
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_TWOFISH
|
2005-06-09 00:08:13 +00:00
|
|
|
#ifndef LTC_NO_TABLES
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_TWOFISH_TABLES
|
|
|
|
/* #define LTC_TWOFISH_ALL_TABLES */
|
2005-06-09 00:08:13 +00:00
|
|
|
#else
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_TWOFISH_SMALL
|
2005-06-09 00:08:13 +00:00
|
|
|
#endif
|
2007-07-20 17:48:02 +00:00
|
|
|
/* #define LTC_TWOFISH_SMALL */
|
2014-04-30 01:10:22 +02:00
|
|
|
/* LTC_DES includes EDE triple-DES */
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_DES
|
|
|
|
#define LTC_CAST5
|
|
|
|
#define LTC_NOEKEON
|
|
|
|
#define LTC_SKIPJACK
|
|
|
|
#define LTC_SAFER
|
|
|
|
#define LTC_KHAZAD
|
|
|
|
#define LTC_ANUBIS
|
|
|
|
#define LTC_ANUBIS_TWEAK
|
|
|
|
#define LTC_KSEED
|
2006-11-17 14:21:24 +00:00
|
|
|
#define LTC_KASUMI
|
2009-10-01 11:42:27 +02:00
|
|
|
#define LTC_MULTI2
|
|
|
|
#define LTC_CAMELLIA
|
2004-12-30 23:55:53 +00:00
|
|
|
|
2005-06-09 00:08:13 +00:00
|
|
|
#endif /* LTC_NO_CIPHERS */
|
|
|
|
|
2004-05-31 02:36:47 +00:00
|
|
|
|
2004-12-30 23:55:53 +00:00
|
|
|
/* ---> Block Cipher Modes of Operation <--- */
|
2005-06-09 00:08:13 +00:00
|
|
|
#ifndef LTC_NO_MODES
|
|
|
|
|
2006-08-30 23:30:00 +00:00
|
|
|
#define LTC_CFB_MODE
|
|
|
|
#define LTC_OFB_MODE
|
|
|
|
#define LTC_ECB_MODE
|
|
|
|
#define LTC_CBC_MODE
|
|
|
|
#define LTC_CTR_MODE
|
2004-05-31 02:36:47 +00:00
|
|
|
|
2006-06-18 01:37:50 +00:00
|
|
|
/* F8 chaining mode */
|
|
|
|
#define LTC_F8_MODE
|
|
|
|
|
2006-01-26 18:11:56 +00:00
|
|
|
/* LRW mode */
|
2006-08-30 23:30:00 +00:00
|
|
|
#define LTC_LRW_MODE
|
2006-01-26 18:11:56 +00:00
|
|
|
#ifndef LTC_NO_TABLES
|
|
|
|
/* like GCM mode this will enable 16 8x128 tables [64KB] that make
|
2012-07-26 14:43:15 +02:00
|
|
|
* seeking very fast.
|
2006-01-26 18:11:56 +00:00
|
|
|
*/
|
2014-07-17 10:49:05 +02:00
|
|
|
#define LTC_LRW_TABLES
|
2006-01-26 18:11:56 +00:00
|
|
|
#endif
|
|
|
|
|
2007-07-20 17:48:02 +00:00
|
|
|
/* XTS mode */
|
|
|
|
#define LTC_XTS_MODE
|
|
|
|
|
2005-06-09 00:08:13 +00:00
|
|
|
#endif /* LTC_NO_MODES */
|
|
|
|
|
2004-12-30 23:55:53 +00:00
|
|
|
/* ---> One-Way Hash Functions <--- */
|
2012-07-26 14:43:15 +02:00
|
|
|
#ifndef LTC_NO_HASHES
|
2005-06-09 00:08:13 +00:00
|
|
|
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_CHC_HASH
|
|
|
|
#define LTC_WHIRLPOOL
|
|
|
|
#define LTC_SHA512
|
2014-08-26 18:17:51 +02:00
|
|
|
#define LTC_SHA512_256
|
|
|
|
#define LTC_SHA512_224
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_SHA384
|
|
|
|
#define LTC_SHA256
|
|
|
|
#define LTC_SHA224
|
|
|
|
#define LTC_TIGER
|
|
|
|
#define LTC_SHA1
|
|
|
|
#define LTC_MD5
|
|
|
|
#define LTC_MD4
|
|
|
|
#define LTC_MD2
|
|
|
|
#define LTC_RIPEMD128
|
|
|
|
#define LTC_RIPEMD160
|
|
|
|
#define LTC_RIPEMD256
|
|
|
|
#define LTC_RIPEMD320
|
2004-05-31 02:36:47 +00:00
|
|
|
|
2005-06-09 00:08:13 +00:00
|
|
|
#endif /* LTC_NO_HASHES */
|
|
|
|
|
2004-12-30 23:55:53 +00:00
|
|
|
/* ---> MAC functions <--- */
|
2005-06-09 00:08:13 +00:00
|
|
|
#ifndef LTC_NO_MACS
|
|
|
|
|
2006-11-17 14:21:24 +00:00
|
|
|
#define LTC_HMAC
|
|
|
|
#define LTC_OMAC
|
|
|
|
#define LTC_PMAC
|
|
|
|
#define LTC_XCBC
|
|
|
|
#define LTC_F9_MODE
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_PELICAN
|
2005-04-17 11:37:13 +00:00
|
|
|
|
2004-12-30 23:55:53 +00:00
|
|
|
/* ---> Encrypt + Authenticate Modes <--- */
|
2005-06-09 00:08:13 +00:00
|
|
|
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_EAX_MODE
|
2004-12-30 23:55:53 +00:00
|
|
|
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_OCB_MODE
|
2012-08-05 01:21:13 +02:00
|
|
|
#define LTC_OCB3_MODE
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_CCM_MODE
|
|
|
|
#define LTC_GCM_MODE
|
2005-06-09 00:08:13 +00:00
|
|
|
|
2005-04-17 11:37:13 +00:00
|
|
|
/* Use 64KiB tables */
|
2005-06-09 00:08:13 +00:00
|
|
|
#ifndef LTC_NO_TABLES
|
2012-07-26 14:43:15 +02:00
|
|
|
#define LTC_GCM_TABLES
|
2005-06-09 00:08:13 +00:00
|
|
|
#endif
|
|
|
|
|
2006-08-30 23:30:00 +00:00
|
|
|
/* USE SSE2? requires GCC works on x86_32 and x86_64*/
|
2007-07-20 17:48:02 +00:00
|
|
|
#ifdef LTC_GCM_TABLES
|
|
|
|
/* #define LTC_GCM_TABLES_SSE2 */
|
2006-08-30 23:30:00 +00:00
|
|
|
#endif
|
|
|
|
|
2005-06-09 00:08:13 +00:00
|
|
|
#endif /* LTC_NO_MACS */
|
2004-05-31 02:36:47 +00:00
|
|
|
|
2004-12-30 23:55:53 +00:00
|
|
|
/* --> Pseudo Random Number Generators <--- */
|
2005-06-09 00:08:13 +00:00
|
|
|
#ifndef LTC_NO_PRNGS
|
|
|
|
|
2004-08-06 16:42:41 +00:00
|
|
|
/* Yarrow */
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_YARROW
|
2005-04-17 11:37:13 +00:00
|
|
|
/* which descriptor of AES to use? */
|
|
|
|
/* 0 = rijndael_enc 1 = aes_enc, 2 = rijndael [full], 3 = aes [full] */
|
2013-03-06 19:52:22 +01:00
|
|
|
#ifdef ENCRYPT_ONLY
|
|
|
|
#define LTC_YARROW_AES 0
|
|
|
|
#else
|
|
|
|
#define LTC_YARROW_AES 2
|
|
|
|
#endif
|
2004-08-06 16:42:41 +00:00
|
|
|
|
2004-12-30 23:55:53 +00:00
|
|
|
/* a PRNG that simply reads from an available system source */
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_SPRNG
|
2004-12-30 23:55:53 +00:00
|
|
|
|
2007-07-20 17:48:02 +00:00
|
|
|
/* The LTC_RC4 stream cipher */
|
|
|
|
#define LTC_RC4
|
2004-07-23 15:40:22 +00:00
|
|
|
|
2004-08-06 16:42:41 +00:00
|
|
|
/* Fortuna PRNG */
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_FORTUNA
|
2004-07-23 15:40:22 +00:00
|
|
|
/* reseed every N calls to the read function */
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_FORTUNA_WD 10
|
2004-08-06 16:42:41 +00:00
|
|
|
/* number of pools (4..32) can save a bit of ram by lowering the count */
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_FORTUNA_POOLS 32
|
2004-07-23 15:40:22 +00:00
|
|
|
|
2007-07-20 17:48:02 +00:00
|
|
|
/* Greg's LTC_SOBER128 PRNG ;-0 */
|
|
|
|
#define LTC_SOBER128
|
2004-07-23 15:40:22 +00:00
|
|
|
|
2004-12-30 23:55:53 +00:00
|
|
|
/* the *nix style /dev/random device */
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_DEVRANDOM
|
2004-12-30 23:55:53 +00:00
|
|
|
/* try /dev/urandom before trying /dev/random */
|
2014-07-17 10:49:05 +02:00
|
|
|
#define LTC_TRY_URANDOM_FIRST
|
2004-05-31 02:36:47 +00:00
|
|
|
|
2005-06-09 00:08:13 +00:00
|
|
|
#endif /* LTC_NO_PRNGS */
|
|
|
|
|
2004-12-30 23:55:53 +00:00
|
|
|
/* ---> Public Key Crypto <--- */
|
2005-06-09 00:08:13 +00:00
|
|
|
#ifndef LTC_NO_PK
|
|
|
|
|
2005-08-01 16:36:47 +00:00
|
|
|
/* Include RSA support */
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_MRSA
|
2004-06-20 02:41:49 +00:00
|
|
|
|
2013-08-14 16:12:56 +02:00
|
|
|
#ifndef LTC_NO_RSA_BLINDING
|
|
|
|
/* Enable RSA blinding when doing private key operations by default */
|
|
|
|
#define LTC_RSA_BLINDING
|
|
|
|
#endif /* LTC_NO_RSA_BLINDING */
|
2011-03-21 22:50:49 +01:00
|
|
|
|
2011-01-18 20:06:03 +01:00
|
|
|
/* Include Diffie-Hellman support */
|
2011-09-25 17:24:52 -07:00
|
|
|
#ifndef GMP_DESC
|
|
|
|
/* is_prime fails for GMP */
|
2014-01-03 15:16:59 +01:00
|
|
|
#define LTC_MDH
|
2011-01-18 20:06:03 +01:00
|
|
|
/* Supported Key Sizes */
|
2014-07-17 10:49:05 +02:00
|
|
|
#define LTC_DH768
|
|
|
|
#define LTC_DH1024
|
|
|
|
#define LTC_DH1280
|
|
|
|
#define LTC_DH1536
|
|
|
|
#define LTC_DH1792
|
|
|
|
#define LTC_DH2048
|
2011-01-18 20:06:03 +01:00
|
|
|
|
|
|
|
#ifndef TFM_DESC
|
|
|
|
/* tfm has a problem in fp_isprime for larger key sizes */
|
2014-07-17 10:49:05 +02:00
|
|
|
#define LTC_DH2560
|
|
|
|
#define LTC_DH3072
|
|
|
|
#define LTC_DH4096
|
2011-01-18 20:06:03 +01:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2005-11-24 11:57:58 +00:00
|
|
|
/* Include Katja (a Rabin variant like RSA) */
|
2014-07-17 10:49:05 +02:00
|
|
|
/* #define LTC_MKAT */
|
2005-11-18 05:15:37 +00:00
|
|
|
|
2004-06-20 02:41:49 +00:00
|
|
|
/* Digital Signature Algorithm */
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_MDSA
|
2004-06-20 02:41:49 +00:00
|
|
|
|
|
|
|
/* ECC */
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_MECC
|
2005-08-01 16:36:47 +00:00
|
|
|
|
2006-12-16 18:10:04 +00:00
|
|
|
/* use Shamir's trick for point mul (speeds up signature verification) */
|
|
|
|
#define LTC_ECC_SHAMIR
|
|
|
|
|
2014-03-04 21:29:40 +01:00
|
|
|
#if defined(TFM_DESC) && defined(LTC_MECC)
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_MECC_ACCEL
|
2012-07-26 14:43:15 +02:00
|
|
|
#endif
|
2006-04-06 19:48:32 +00:00
|
|
|
|
2006-05-29 23:12:56 +00:00
|
|
|
/* do we want fixed point ECC */
|
2007-07-20 17:48:02 +00:00
|
|
|
/* #define LTC_MECC_FP */
|
2006-05-29 23:12:56 +00:00
|
|
|
|
2014-05-08 15:06:42 +02:00
|
|
|
#ifndef LTC_NO_ECC_TIMING_RESISTANT
|
|
|
|
/* Enable ECC timing resistant version by default */
|
|
|
|
#define LTC_ECC_TIMING_RESISTANT
|
|
|
|
#endif
|
2005-08-01 16:36:47 +00:00
|
|
|
|
2005-06-09 00:08:13 +00:00
|
|
|
#endif /* LTC_NO_PK */
|
|
|
|
|
2015-02-15 16:32:12 +01:00
|
|
|
/* define these PK sizes out of LTC_NO_PK
|
|
|
|
* to have them always defined
|
|
|
|
*/
|
|
|
|
#if defined(LTC_MRSA)
|
|
|
|
/* Min and Max RSA key sizes (in bits) */
|
|
|
|
#ifndef MIN_RSA_SIZE
|
|
|
|
#define MIN_RSA_SIZE 1024
|
|
|
|
#endif
|
|
|
|
#ifndef MAX_RSA_SIZE
|
|
|
|
#define MAX_RSA_SIZE 4096
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* in cases where you want ASN.1/DER functionality, but no
|
|
|
|
* RSA, you can define this externally if 1024 is not enough
|
|
|
|
*/
|
|
|
|
#if defined(LTC_MRSA)
|
|
|
|
#define LTC_DER_MAX_PUBKEY_SIZE MAX_RSA_SIZE
|
|
|
|
#elif !defined(LTC_DER_MAX_PUBKEY_SIZE)
|
|
|
|
/* this includes DSA */
|
|
|
|
#define LTC_DER_MAX_PUBKEY_SIZE 1024
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2014-01-03 15:16:59 +01:00
|
|
|
/* PKCS #1 (RSA) and #5 (Password Handling) stuff */
|
2005-06-09 00:08:13 +00:00
|
|
|
#ifndef LTC_NO_PKCS
|
|
|
|
|
2007-07-20 17:48:02 +00:00
|
|
|
#define LTC_PKCS_1
|
|
|
|
#define LTC_PKCS_5
|
2004-05-12 20:42:16 +00:00
|
|
|
|
2004-12-30 23:55:53 +00:00
|
|
|
/* Include ASN.1 DER (required by DSA/RSA) */
|
|
|
|
#define LTC_DER
|
2005-11-24 11:57:58 +00:00
|
|
|
|
|
|
|
#endif /* LTC_NO_PKCS */
|
|
|
|
|
2013-08-14 15:47:07 +02:00
|
|
|
/* misc stuff */
|
|
|
|
#ifndef LTC_NO_MISC
|
2012-11-11 15:00:19 -08:00
|
|
|
|
2013-08-14 16:12:56 +02:00
|
|
|
/* Various tidbits of modern neatoness */
|
|
|
|
#define LTC_BASE64
|
2013-11-24 22:11:44 +01:00
|
|
|
/* ... and it's URL safe version */
|
|
|
|
#define LTC_BASE64_URL
|
2012-11-11 15:00:19 -08:00
|
|
|
|
2013-08-14 15:47:07 +02:00
|
|
|
/* Keep LTC_NO_HKDF for compatibility reasons
|
|
|
|
* superseeded by LTC_NO_MISC*/
|
|
|
|
#ifndef LTC_NO_HKDF
|
2014-04-30 01:10:22 +02:00
|
|
|
/* HKDF Key Derivation/Expansion stuff */
|
2013-08-14 15:47:07 +02:00
|
|
|
#define LTC_HKDF
|
2012-11-11 15:00:19 -08:00
|
|
|
#endif /* LTC_NO_HKDF */
|
|
|
|
|
2013-08-14 15:47:07 +02:00
|
|
|
#endif /* LTC_NO_MISC */
|
|
|
|
|
2005-11-24 11:57:58 +00:00
|
|
|
/* cleanup */
|
|
|
|
|
2007-07-20 17:48:02 +00:00
|
|
|
#ifdef LTC_MECC
|
2005-11-24 11:57:58 +00:00
|
|
|
/* Supported ECC Key Sizes */
|
|
|
|
#ifndef LTC_NO_CURVES
|
2014-07-17 10:49:05 +02:00
|
|
|
#define LTC_ECC112
|
|
|
|
#define LTC_ECC128
|
|
|
|
#define LTC_ECC160
|
|
|
|
#define LTC_ECC192
|
|
|
|
#define LTC_ECC224
|
|
|
|
#define LTC_ECC256
|
|
|
|
#define LTC_ECC384
|
|
|
|
#define LTC_ECC521
|
2005-11-24 11:57:58 +00:00
|
|
|
#endif
|
2004-12-30 23:55:53 +00:00
|
|
|
#endif
|
|
|
|
|
2014-07-17 10:49:05 +02:00
|
|
|
#if defined(LTC_MECC) || defined(LTC_MRSA) || defined(LTC_MDSA) || defined(LTC_MKAT)
|
2005-11-24 11:57:58 +00:00
|
|
|
/* Include the MPI functionality? (required by the PK algorithms) */
|
2014-07-17 10:49:05 +02:00
|
|
|
#define LTC_MPI
|
2004-12-30 23:55:53 +00:00
|
|
|
#endif
|
|
|
|
|
2007-07-20 17:48:02 +00:00
|
|
|
#ifdef LTC_MRSA
|
|
|
|
#define LTC_PKCS_1
|
2012-07-26 14:43:15 +02:00
|
|
|
#endif
|
2005-06-09 00:08:13 +00:00
|
|
|
|
2011-03-21 22:50:49 +01:00
|
|
|
#if defined(TFM_DESC) && defined(LTC_RSA_BLINDING)
|
|
|
|
#warning RSA blinding currently not supported in combination with TFM
|
|
|
|
#undef LTC_RSA_BLINDING
|
|
|
|
#endif
|
|
|
|
|
2014-03-04 18:03:14 +01:00
|
|
|
#if defined(LTC_PELICAN) && !defined(LTC_RIJNDAEL)
|
|
|
|
#error Pelican-MAC requires LTC_RIJNDAEL
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(LTC_EAX_MODE) && !(defined(LTC_CTR_MODE) && defined(LTC_OMAC))
|
|
|
|
#error LTC_EAX_MODE requires CTR and LTC_OMAC mode
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(LTC_YARROW) && !defined(LTC_CTR_MODE)
|
|
|
|
#error LTC_YARROW requires LTC_CTR_MODE chaining mode to be defined!
|
|
|
|
#endif
|
|
|
|
|
2014-07-17 10:49:05 +02:00
|
|
|
#if defined(LTC_DER) && !defined(LTC_MPI)
|
2005-11-24 11:57:58 +00:00
|
|
|
#error ASN.1 DER requires MPI functionality
|
2003-03-03 01:03:50 +00:00
|
|
|
#endif
|
|
|
|
|
2014-07-17 10:49:05 +02:00
|
|
|
#if (defined(LTC_MDSA) || defined(LTC_MRSA) || defined(LTC_MECC) || defined(LTC_MKAT)) && !defined(LTC_DER)
|
2005-11-24 11:57:58 +00:00
|
|
|
#error PK requires ASN.1 DER functionality, make sure LTC_DER is enabled
|
|
|
|
#endif
|
2005-06-09 00:08:13 +00:00
|
|
|
|
2005-06-27 11:47:35 +00:00
|
|
|
/* THREAD management */
|
|
|
|
#ifdef LTC_PTHREAD
|
|
|
|
|
|
|
|
#include <pthread.h>
|
|
|
|
|
|
|
|
#define LTC_MUTEX_GLOBAL(x) pthread_mutex_t x = PTHREAD_MUTEX_INITIALIZER;
|
|
|
|
#define LTC_MUTEX_PROTO(x) extern pthread_mutex_t x;
|
2005-11-18 05:15:37 +00:00
|
|
|
#define LTC_MUTEX_TYPE(x) pthread_mutex_t x;
|
|
|
|
#define LTC_MUTEX_INIT(x) pthread_mutex_init(x, NULL);
|
2005-06-27 11:47:35 +00:00
|
|
|
#define LTC_MUTEX_LOCK(x) pthread_mutex_lock(x);
|
|
|
|
#define LTC_MUTEX_UNLOCK(x) pthread_mutex_unlock(x);
|
|
|
|
|
2005-11-18 05:15:37 +00:00
|
|
|
#else
|
2005-06-27 11:47:35 +00:00
|
|
|
|
|
|
|
/* default no functions */
|
|
|
|
#define LTC_MUTEX_GLOBAL(x)
|
|
|
|
#define LTC_MUTEX_PROTO(x)
|
2005-11-18 05:15:37 +00:00
|
|
|
#define LTC_MUTEX_TYPE(x)
|
|
|
|
#define LTC_MUTEX_INIT(x)
|
2005-06-27 11:47:35 +00:00
|
|
|
#define LTC_MUTEX_LOCK(x)
|
|
|
|
#define LTC_MUTEX_UNLOCK(x)
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2006-11-17 14:21:24 +00:00
|
|
|
/* Debuggers */
|
|
|
|
|
2007-07-20 17:48:02 +00:00
|
|
|
/* define this if you use Valgrind, note: it CHANGES the way SOBER-128 and LTC_RC4 work (see the code) */
|
2006-11-17 14:21:24 +00:00
|
|
|
/* #define LTC_VALGRIND */
|
|
|
|
|
2005-11-24 11:57:58 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2005-06-27 11:47:35 +00:00
|
|
|
|
2005-06-09 00:08:13 +00:00
|
|
|
/* $Source$ */
|
|
|
|
/* $Revision$ */
|
|
|
|
/* $Date$ */
|