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