mycrypt_cfg.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /* This is the build config file.
  2. *
  3. * With this you can setup what to inlcude/exclude automatically during any build. Just comment
  4. * out the line that #define's the word for the thing you want to remove. phew!
  5. */
  6. #ifndef MYCRYPT_CFG_H
  7. #define MYCRYPT_CFG_H
  8. /* you can change how memory allocation works ... */
  9. void *XMALLOC(size_t n);
  10. void *REALLOC(void *p, size_t n);
  11. void *XCALLOC(size_t n, size_t s);
  12. void XFREE(void *p);
  13. /* change the clock function too */
  14. clock_t XCLOCK(void);
  15. /* various other functions */
  16. void *XMEMCPY(void *dest, const void *src, size_t n);
  17. int XMEMCMP(const void *s1, const void *s2, size_t n);
  18. /* ch1-01-1 */
  19. /* type of argument checking, 0=default, 1=fatal and 2=none */
  20. #define ARGTYPE 0
  21. /* ch1-01-1 */
  22. /* Controls endianess and size of registers. Leave uncommented to get platform neutral [slower] code */
  23. /* detect x86-32 machines somewhat */
  24. #if defined(INTEL_CC) || (defined(_MSC_VER) && defined(WIN32)) || (defined(__GNUC__) && (defined(__DJGPP__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__i386__)))
  25. #define ENDIAN_LITTLE
  26. #define ENDIAN_32BITWORD
  27. #endif
  28. /* detects MIPS R5900 processors (PS2) */
  29. #if (defined(__R5900) || defined(R5900) || defined(__R5900__)) && (defined(_mips) || defined(__mips__) || defined(mips))
  30. #define ENDIAN_LITTLE
  31. #define ENDIAN_64BITWORD
  32. #endif
  33. /* #define ENDIAN_LITTLE */
  34. /* #define ENDIAN_BIG */
  35. /* #define ENDIAN_32BITWORD */
  36. /* #define ENDIAN_64BITWORD */
  37. #if (defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) && !(defined(ENDIAN_32BITWORD) || defined(ENDIAN_64BITWORD))
  38. #error You must specify a word size as well as endianess in mycrypt_cfg.h
  39. #endif
  40. #if !(defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE))
  41. #define ENDIAN_NEUTRAL
  42. #endif
  43. #ifdef YARROW
  44. #ifndef CTR
  45. #error YARROW requires CTR chaining mode to be defined!
  46. #endif
  47. #endif
  48. /* packet code */
  49. #if defined(MRSA) || defined(MDH) || defined(MECC)
  50. #define PACKET
  51. /* size of a packet header in bytes */
  52. #define PACKET_SIZE 4
  53. /* Section tags */
  54. #define PACKET_SECT_RSA 0
  55. #define PACKET_SECT_DH 1
  56. #define PACKET_SECT_ECC 2
  57. #define PACKET_SECT_DSA 3
  58. /* Subsection Tags for the first three sections */
  59. #define PACKET_SUB_KEY 0
  60. #define PACKET_SUB_ENCRYPTED 1
  61. #define PACKET_SUB_SIGNED 2
  62. #define PACKET_SUB_ENC_KEY 3
  63. #endif
  64. #endif /* MYCRYPT_CFG_H */