diff options
Diffstat (limited to 'fs/ceph/crypto.c')
| -rw-r--r-- | fs/ceph/crypto.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/fs/ceph/crypto.c b/fs/ceph/crypto.c index f704b3b62424..a3e627f63293 100644 --- a/fs/ceph/crypto.c +++ b/fs/ceph/crypto.c | |||
| @@ -75,10 +75,11 @@ static struct crypto_blkcipher *ceph_crypto_alloc_cipher(void) | |||
| 75 | return crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); | 75 | return crypto_alloc_blkcipher("cbc(aes)", 0, CRYPTO_ALG_ASYNC); |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | const u8 *aes_iv = "cephsageyudagreg"; | 78 | static const u8 *aes_iv = (u8 *)CEPH_AES_IV; |
| 79 | 79 | ||
| 80 | int ceph_aes_encrypt(const void *key, int key_len, void *dst, size_t *dst_len, | 80 | static int ceph_aes_encrypt(const void *key, int key_len, |
| 81 | const void *src, size_t src_len) | 81 | void *dst, size_t *dst_len, |
| 82 | const void *src, size_t src_len) | ||
| 82 | { | 83 | { |
| 83 | struct scatterlist sg_in[2], sg_out[1]; | 84 | struct scatterlist sg_in[2], sg_out[1]; |
| 84 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); | 85 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); |
| @@ -126,9 +127,10 @@ int ceph_aes_encrypt(const void *key, int key_len, void *dst, size_t *dst_len, | |||
| 126 | return 0; | 127 | return 0; |
| 127 | } | 128 | } |
| 128 | 129 | ||
| 129 | int ceph_aes_encrypt2(const void *key, int key_len, void *dst, size_t *dst_len, | 130 | static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, |
| 130 | const void *src1, size_t src1_len, | 131 | size_t *dst_len, |
| 131 | const void *src2, size_t src2_len) | 132 | const void *src1, size_t src1_len, |
| 133 | const void *src2, size_t src2_len) | ||
| 132 | { | 134 | { |
| 133 | struct scatterlist sg_in[3], sg_out[1]; | 135 | struct scatterlist sg_in[3], sg_out[1]; |
| 134 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); | 136 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); |
| @@ -179,8 +181,9 @@ int ceph_aes_encrypt2(const void *key, int key_len, void *dst, size_t *dst_len, | |||
| 179 | return 0; | 181 | return 0; |
| 180 | } | 182 | } |
| 181 | 183 | ||
| 182 | int ceph_aes_decrypt(const void *key, int key_len, void *dst, size_t *dst_len, | 184 | static int ceph_aes_decrypt(const void *key, int key_len, |
| 183 | const void *src, size_t src_len) | 185 | void *dst, size_t *dst_len, |
| 186 | const void *src, size_t src_len) | ||
| 184 | { | 187 | { |
| 185 | struct scatterlist sg_in[1], sg_out[2]; | 188 | struct scatterlist sg_in[1], sg_out[2]; |
| 186 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); | 189 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); |
| @@ -238,10 +241,10 @@ int ceph_aes_decrypt(const void *key, int key_len, void *dst, size_t *dst_len, | |||
| 238 | return 0; | 241 | return 0; |
| 239 | } | 242 | } |
| 240 | 243 | ||
| 241 | int ceph_aes_decrypt2(const void *key, int key_len, | 244 | static int ceph_aes_decrypt2(const void *key, int key_len, |
| 242 | void *dst1, size_t *dst1_len, | 245 | void *dst1, size_t *dst1_len, |
| 243 | void *dst2, size_t *dst2_len, | 246 | void *dst2, size_t *dst2_len, |
| 244 | const void *src, size_t src_len) | 247 | const void *src, size_t src_len) |
| 245 | { | 248 | { |
| 246 | struct scatterlist sg_in[1], sg_out[3]; | 249 | struct scatterlist sg_in[1], sg_out[3]; |
| 247 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); | 250 | struct crypto_blkcipher *tfm = ceph_crypto_alloc_cipher(); |
