mech.h 451 B

123456789101112131415161718192021222324252627282930
  1. #ifndef _MECH_H_
  2. #define _MECH_H_
  3. #include "c_types.h"
  4. typedef struct
  5. {
  6. const char *key;
  7. size_t keylen;
  8. const char *iv;
  9. size_t ivlen;
  10. const char *data;
  11. size_t datalen;
  12. char *out;
  13. size_t outlen;
  14. enum { OP_ENCRYPT, OP_DECRYPT } op;
  15. } crypto_op_t;
  16. typedef struct
  17. {
  18. const char *name;
  19. bool (*run) (crypto_op_t *op);
  20. uint16_t block_size;
  21. } crypto_mech_t;
  22. const crypto_mech_t *crypto_encryption_mech (const char *name);
  23. #endif