2
0

mycrypt.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #ifndef CRYPT_H_
  2. #define CRYPT_H_
  3. #include <assert.h>
  4. #include <stdio.h>
  5. #include <string.h>
  6. #include <stdlib.h>
  7. #include <time.h>
  8. #include <ctype.h>
  9. #include <limits.h>
  10. /* if there is a custom definition header file use it */
  11. #include <mycrypt_custom.h>
  12. #ifdef __cplusplus
  13. extern "C" {
  14. #endif
  15. /* version */
  16. #define CRYPT 0x0099
  17. #define SCRYPT "0.99"
  18. /* max size of either a cipher/hash block or symmetric key [largest of the two] */
  19. #define MAXBLOCKSIZE 64
  20. /* descriptor table size */
  21. #define TAB_SIZE 32
  22. /* error codes [will be expanded in future releases] */
  23. enum {
  24. CRYPT_OK=0, /* Result OK */
  25. CRYPT_ERROR, /* Generic Error */
  26. CRYPT_NOP, /* Not a failure but no operation was performed */
  27. CRYPT_INVALID_KEYSIZE, /* Invalid key size given */
  28. CRYPT_INVALID_ROUNDS, /* Invalid number of rounds */
  29. CRYPT_FAIL_TESTVECTOR, /* Algorithm failed test vectors */
  30. CRYPT_BUFFER_OVERFLOW, /* Not enough space for output */
  31. CRYPT_INVALID_PACKET, /* Invalid input packet given */
  32. CRYPT_INVALID_PRNGSIZE, /* Invalid number of bits for a PRNG */
  33. CRYPT_ERROR_READPRNG, /* Could not read enough from PRNG */
  34. CRYPT_INVALID_CIPHER, /* Invalid cipher specified */
  35. CRYPT_INVALID_HASH, /* Invalid hash specified */
  36. CRYPT_INVALID_PRNG, /* Invalid PRNG specified */
  37. CRYPT_MEM, /* Out of memory */
  38. CRYPT_PK_TYPE_MISMATCH, /* Not equivalent types of PK keys */
  39. CRYPT_PK_NOT_PRIVATE, /* Requires a private PK key */
  40. CRYPT_INVALID_ARG, /* Generic invalid argument */
  41. CRYPT_FILE_NOTFOUND, /* File Not Found */
  42. CRYPT_PK_INVALID_TYPE, /* Invalid type of PK key */
  43. CRYPT_PK_INVALID_SYSTEM,/* Invalid PK system specified */
  44. CRYPT_PK_DUP, /* Duplicate key already in key ring */
  45. CRYPT_PK_NOT_FOUND, /* Key not found in keyring */
  46. CRYPT_PK_INVALID_SIZE, /* Invalid size input for PK parameters */
  47. CRYPT_INVALID_PRIME_SIZE/* Invalid size of prime requested */
  48. };
  49. #include <mycrypt_cfg.h>
  50. #include <mycrypt_macros.h>
  51. #include <mycrypt_cipher.h>
  52. #include <mycrypt_hash.h>
  53. #include <mycrypt_prng.h>
  54. #include <mycrypt_pk.h>
  55. #include <mycrypt_misc.h>
  56. #include <mycrypt_argchk.h>
  57. #include <mycrypt_pkcs.h>
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif /* CRYPT_H_ */