crypto.h 1.0 KB

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