2010-02-02 17:07:07 -07:00
|
|
|
#ifndef _FS_CEPH_CRYPTO_H
|
|
|
|
#define _FS_CEPH_CRYPTO_H
|
|
|
|
|
2010-04-06 15:14:15 -07:00
|
|
|
#include <linux/ceph/types.h>
|
|
|
|
#include <linux/ceph/buffer.h>
|
2010-02-02 17:07:07 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* cryptographic secret
|
|
|
|
*/
|
|
|
|
struct ceph_crypto_key {
|
|
|
|
int type;
|
|
|
|
struct ceph_timespec created;
|
|
|
|
int len;
|
|
|
|
void *key;
|
2016-12-02 08:35:08 -07:00
|
|
|
struct crypto_skcipher *tfm;
|
2010-02-02 17:07:07 -07:00
|
|
|
};
|
|
|
|
|
2013-10-18 13:48:22 -07:00
|
|
|
int ceph_crypto_key_clone(struct ceph_crypto_key *dst,
|
|
|
|
const struct ceph_crypto_key *src);
|
|
|
|
int ceph_crypto_key_encode(struct ceph_crypto_key *key, void **p, void *end);
|
|
|
|
int ceph_crypto_key_decode(struct ceph_crypto_key *key, void **p, void *end);
|
|
|
|
int ceph_crypto_key_unarmor(struct ceph_crypto_key *key, const char *in);
|
2016-12-02 08:35:08 -07:00
|
|
|
void ceph_crypto_key_destroy(struct ceph_crypto_key *key);
|
2010-02-02 17:07:07 -07:00
|
|
|
|
|
|
|
/* crypto.c */
|
2016-12-02 08:35:07 -07:00
|
|
|
int ceph_crypt(const struct ceph_crypto_key *key, bool encrypt,
|
|
|
|
void *buf, int buf_len, int in_len, int *pout_len);
|
2013-10-18 13:48:22 -07:00
|
|
|
int ceph_crypto_init(void);
|
|
|
|
void ceph_crypto_shutdown(void);
|
2010-02-02 17:07:07 -07:00
|
|
|
|
|
|
|
/* armor.c */
|
2013-10-18 13:48:22 -07:00
|
|
|
int ceph_armor(char *dst, const char *src, const char *end);
|
|
|
|
int ceph_unarmor(char *dst, const char *src, const char *end);
|
2010-02-02 17:07:07 -07:00
|
|
|
|
|
|
|
#endif
|