crypto.h 1002 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef _FS_CEPH_CRYPTO_H
  2. #define _FS_CEPH_CRYPTO_H
  3. #include <linux/ceph/types.h>
  4. #include <linux/ceph/buffer.h>
  5. /*
  6. * cryptographic secret
  7. */
  8. struct ceph_crypto_key {
  9. int type;
  10. struct ceph_timespec created;
  11. int len;
  12. void *key;
  13. struct crypto_skcipher *tfm;
  14. };
  15. int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
  16. const struct ceph_crypto_key *src);
  17. int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end);
  18. int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end);
  19. int ceph_crypto_key_unarmor(struct ceph_crypto_key *key, const char *in);
  20. void ceph_crypto_key_destroy(struct ceph_crypto_key *key);
  21. /* crypto.c */
  22. int ceph_crypt(const struct ceph_crypto_key *key, bool encrypt,
  23. void *buf, int buf_len, int in_len, int *pout_len);
  24. int ceph_crypto_init(void);
  25. void ceph_crypto_shutdown(void);
  26. /* armor.c */
  27. int ceph_armor(char *dst, const char *src, const char *end);
  28. int ceph_unarmor(char *dst, const char *src, const char *end);
  29. #endif