mycrypt_cfg.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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. /* type of argument checking, 0=default, 1=fatal and 2=none */
  19. #define ARGTYPE 0
  20. /* Controls endianess and size of registers. Leave uncommented to get platform neutral [slower] code
  21. *
  22. * Note: in order to use the optimized macros your platform must support unaligned 32 and 64 bit read/writes.
  23. * The x86 platforms allow this but some others [ARM for instance] do not. On those platforms you **MUST**
  24. * use the portable [slower] macros.
  25. */
  26. /* detect x86-32 machines somewhat */
  27. #if defined(INTEL_CC) || (defined(_MSC_VER) && defined(WIN32)) || (defined(__GNUC__) && (defined(__DJGPP__) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__i386__)))
  28. #define ENDIAN_LITTLE
  29. #define ENDIAN_32BITWORD
  30. #endif
  31. /* detects MIPS R5900 processors (PS2) */
  32. #if (defined(__R5900) || defined(R5900) || defined(__R5900__)) && (defined(_mips) || defined(__mips__) || defined(mips))
  33. #define ENDIAN_LITTLE
  34. #define ENDIAN_64BITWORD
  35. #endif
  36. /* detect amd64 */
  37. #if defined(__x86_64__)
  38. #define ENDIAN_LITTLE
  39. #define ENDIAN_64BITWORD
  40. #endif
  41. /* #define ENDIAN_LITTLE */
  42. /* #define ENDIAN_BIG */
  43. /* #define ENDIAN_32BITWORD */
  44. /* #define ENDIAN_64BITWORD */
  45. #if (defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE)) && !(defined(ENDIAN_32BITWORD) || defined(ENDIAN_64BITWORD))
  46. #error You must specify a word size as well as endianess in mycrypt_cfg.h
  47. #endif
  48. #if !(defined(ENDIAN_BIG) || defined(ENDIAN_LITTLE))
  49. #define ENDIAN_NEUTRAL
  50. #endif
  51. /* packet code */
  52. #if defined(MRSA) || defined(MDH) || defined(MECC)
  53. #define PACKET
  54. /* size of a packet header in bytes */
  55. #define PACKET_SIZE 4
  56. /* Section tags */
  57. #define PACKET_SECT_RSA 0
  58. #define PACKET_SECT_DH 1
  59. #define PACKET_SECT_ECC 2
  60. #define PACKET_SECT_DSA 3
  61. /* Subsection Tags for the first three sections */
  62. #define PACKET_SUB_KEY 0
  63. #define PACKET_SUB_ENCRYPTED 1
  64. #define PACKET_SUB_SIGNED 2
  65. #define PACKET_SUB_ENC_KEY 3
  66. #endif
  67. #endif /* MYCRYPT_CFG_H */