Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _FS_CEPH_CRYPTO_H
0003 #define _FS_CEPH_CRYPTO_H
0004 
0005 #include <linux/ceph/types.h>
0006 #include <linux/ceph/buffer.h>
0007 
0008 #define CEPH_KEY_LEN            16
0009 #define CEPH_MAX_CON_SECRET_LEN     64
0010 
0011 /*
0012  * cryptographic secret
0013  */
0014 struct ceph_crypto_key {
0015     int type;
0016     struct ceph_timespec created;
0017     int len;
0018     void *key;
0019     struct crypto_sync_skcipher *tfm;
0020 };
0021 
0022 int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
0023               const struct ceph_crypto_key *src);
0024 int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end);
0025 int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end);
0026 int ceph_crypto_key_unarmor(struct ceph_crypto_key *key, const char *in);
0027 void ceph_crypto_key_destroy(struct ceph_crypto_key *key);
0028 
0029 /* crypto.c */
0030 int ceph_crypt(const struct ceph_crypto_key *key, bool encrypt,
0031            void *buf, int buf_len, int in_len, int *pout_len);
0032 int ceph_crypto_init(void);
0033 void ceph_crypto_shutdown(void);
0034 
0035 /* armor.c */
0036 int ceph_armor(char *dst, const char *src, const char *end);
0037 int ceph_unarmor(char *dst, const char *src, const char *end);
0038 
0039 #endif