crypto.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #ifndef _FS_CEPH_CRYPTO_H
  2. #define _FS_CEPH_CRYPTO_H
  3. #include "types.h"
  4. #include "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. };
  14. static inline void ceph_crypto_key_destroy(struct ceph_crypto_key *key)
  15. {
  16. kfree(key->key);
  17. }
  18. extern int ceph_crypto_key_encode(struct ceph_crypto_key *key,
  19. void **p, void *end);
  20. extern int ceph_crypto_key_decode(struct ceph_crypto_key *key,
  21. void **p, void *end);
  22. extern int ceph_crypto_key_unarmor(struct ceph_crypto_key *key, const char *in);
  23. /* crypto.c */
  24. extern int ceph_decrypt(struct ceph_crypto_key *secret,
  25. void *dst, size_t *dst_len,
  26. const void *src, size_t src_len);
  27. extern int ceph_encrypt(struct ceph_crypto_key *secret,
  28. void *dst, size_t *dst_len,
  29. const void *src, size_t src_len);
  30. extern int ceph_decrypt2(struct ceph_crypto_key *secret,
  31. void *dst1, size_t *dst1_len,
  32. void *dst2, size_t *dst2_len,
  33. const void *src, size_t src_len);
  34. extern int ceph_encrypt2(struct ceph_crypto_key *secret,
  35. void *dst, size_t *dst_len,
  36. const void *src1, size_t src1_len,
  37. const void *src2, size_t src2_len);
  38. /* armor.c */
  39. extern int ceph_armor(char *dst, const char *src, const char *end);
  40. extern int ceph_unarmor(char *dst, const char *src, const char *end);
  41. #endif