summaryrefslogtreecommitdiffstats
path: root/xlators/encryption/crypt
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/encryption/crypt')
-rw-r--r--xlators/encryption/crypt/src/atom.c6
-rw-r--r--xlators/encryption/crypt/src/crypt.c61
-rw-r--r--xlators/encryption/crypt/src/keys.c6
-rw-r--r--xlators/encryption/crypt/src/metadata.c14
-rw-r--r--xlators/encryption/crypt/src/metadata.h2
5 files changed, 44 insertions, 45 deletions
diff --git a/xlators/encryption/crypt/src/atom.c b/xlators/encryption/crypt/src/atom.c
index 3fa12207a70..21d63e5d6d6 100644
--- a/xlators/encryption/crypt/src/atom.c
+++ b/xlators/encryption/crypt/src/atom.c
@@ -160,7 +160,7 @@ static uint32_t io_size_nopad_tail(struct avec_config *conf,
static uint32_t io_size_nopad_full(struct avec_config *conf,
struct object_cipher_info *object)
-{
+{
check_full_block(conf);
return get_atom_size(object);
}
@@ -549,7 +549,7 @@ void submit_partial(call_frame_t *frame,
/*
* To perform the "read" component of the read-modify-write
* sequence the crypt translator does stack_wind to itself.
- *
+ *
* Pass current file size to crypt_readv()
*/
dict = dict_new();
@@ -650,7 +650,7 @@ void submit_full(call_frame_t *frame, xlator_t *this)
blocks_to_write,
off_in_file + (blocks_written <<
get_atom_bits(object)));
-
+
set_local_io_params_writev(frame, object, atom,
off_in_file + (blocks_written << get_atom_bits(object)),
blocks_to_write << get_atom_bits(object));
diff --git a/xlators/encryption/crypt/src/crypt.c b/xlators/encryption/crypt/src/crypt.c
index 000a8702547..2982bb26db0 100644
--- a/xlators/encryption/crypt/src/crypt.c
+++ b/xlators/encryption/crypt/src/crypt.c
@@ -300,7 +300,7 @@ int32_t crypt_readv_cbk(call_frame_t *frame,
local->op_ret = 0;
goto put_one_call;
}
- /*
+ /*
* correct config params with real file size
* and actual amount of bytes read
*/
@@ -384,7 +384,7 @@ static int32_t do_readv(call_frame_t *frame,
crypt_local_t *local = frame->local;
if (op_ret < 0)
- goto error;
+ goto error;
/*
* extract regular file size
*/
@@ -395,7 +395,7 @@ static int32_t do_readv(call_frame_t *frame,
goto error;
}
local->cur_file_size = data_to_uint64(data);
-
+
get_one_call(frame);
STACK_WIND(frame,
crypt_readv_cbk,
@@ -484,7 +484,7 @@ static int32_t readv_trivial_completion(call_frame_t *frame,
local->loc,
FSIZE_XATTR_PREFIX,
NULL);
- return 0;
+ return 0;
error:
STACK_UNWIND_STRICT(readv, frame, op_ret, op_errno,
NULL, 0, NULL, NULL, NULL);
@@ -508,7 +508,7 @@ int32_t crypt_readv(call_frame_t *frame,
(int)size, (long long)offset);
if (parent_is_crypt_xlator(frame, this))
gf_log("crypt", GF_LOG_DEBUG, "parent is crypt");
-#endif
+#endif
local = crypt_alloc_local(frame, this, GF_FOP_READ);
if (!local) {
ret = ENOMEM;
@@ -676,8 +676,7 @@ void set_local_io_params_ftruncate(call_frame_t *frame,
* in the ->writev() stack,
* when submitting file tail
*/
- }
- else {
+ } else {
local->eof_padding_size = 0;
local->new_file_size = conf->orig_offset;
local->update_disk_file_size = 1;
@@ -782,7 +781,7 @@ static void update_local_file_params(call_frame_t *frame,
local->prebuf.ia_size = local->cur_file_size;
local->postbuf.ia_size = local->new_file_size;
- local->cur_file_size = local->new_file_size;
+ local->cur_file_size = local->new_file_size;
}
static int32_t end_writeback_writev(call_frame_t *frame,
@@ -1004,7 +1003,7 @@ static int32_t do_writev(call_frame_t *frame,
}
if (should_submit_hole(local))
submit_hole(frame, this);
- else
+ else
submit_data(frame, this);
return 0;
error:
@@ -1042,7 +1041,7 @@ static int32_t crypt_writev_finodelk_cbk(call_frame_t *frame,
error:
get_one_call_nolock(frame);
put_one_call_writev(frame, this);
- return 0;
+ return 0;
}
static int32_t writev_trivial_completion(call_frame_t *frame,
@@ -1054,7 +1053,7 @@ static int32_t writev_trivial_completion(call_frame_t *frame,
dict_t *dict)
{
crypt_local_t *local = frame->local;
-
+
local->op_ret = op_ret;
local->op_errno = op_errno;
local->prebuf = *buf;
@@ -1487,15 +1486,15 @@ int32_t read_prune_write(call_frame_t *frame, xlator_t *this)
}
gf_log("crypt", GF_LOG_DEBUG,
"prune with RMW (at offset %llu",
- (unsigned long long)conf->orig_offset);
+ (unsigned long long)conf->orig_offset);
/*
* We are about to perform the "read" component of the
* read-prune-write sequence. It means that we need to
* read encrypted data from disk and decrypt it.
* So, the crypt translator does STACK_WIND to itself.
- *
+ *
* Pass current file size to crypt_readv()
-
+
*/
dict = dict_new();
if (!dict) {
@@ -1599,7 +1598,7 @@ static int32_t do_ftruncate(call_frame_t *frame,
crypt_local_t *local = frame->local;
if (op_ret)
- goto error;
+ goto error;
/*
* extract regular file size
*/
@@ -2035,7 +2034,7 @@ static int load_mtd_open(call_frame_t *frame,
}
/*
* authenticate metadata against the path
- */
+ */
ret = open_format((unsigned char *)mtd->data,
mtd->len,
local->loc,
@@ -2053,7 +2052,7 @@ static int load_mtd_open(call_frame_t *frame,
if (ret) {
local->op_ret = -1;
local->op_errno = ret;
- goto exit;
+ goto exit;
}
ret = inode_ctx_put(local->fd->inode,
this, (uint64_t)(long)info);
@@ -2406,7 +2405,7 @@ static int32_t crypt_create_finodelk_cbk(call_frame_t *frame,
0,
NULL);
return 0;
- error:
+ error:
free_inode_info(info);
free_format(local);
fd_unref(local->fd);
@@ -2450,7 +2449,7 @@ static int32_t crypt_create_cbk(call_frame_t *frame,
if (op_ret < 0)
goto error;
if (xdata)
- local->xdata = dict_ref(xdata);
+ local->xdata = dict_ref(xdata);
local->inode = inode_ref(inode);
local->buf = *buf;
local->prebuf = *preparent;
@@ -2469,7 +2468,7 @@ static int32_t crypt_create_cbk(call_frame_t *frame,
local->fd,
F_SETLKW,
&lock,
- NULL);
+ NULL);
return 0;
error:
free_inode_info(info);
@@ -2559,12 +2558,12 @@ static int32_t crypt_create(call_frame_t *frame,
master);
if (ret) {
free_inode_info(info);
- goto error;
+ goto error;
}
local->xattr = dict_new();
if (!local->xattr) {
free_inode_info(info);
- free_format(local);
+ free_format(local);
goto error;
}
ret = dict_set_static_bin(local->xattr,
@@ -2903,13 +2902,13 @@ void rename_unwind(call_frame_t *frame)
NULL,
NULL,
NULL,
- NULL);
+ NULL);
return;
}
xdata = local->xdata;
xattr = local->xattr;
prenewparent = local->prenewparent;
- postnewparent = local->postnewparent;
+ postnewparent = local->postnewparent;
if (local->loc){
loc_wipe(local->loc);
@@ -3143,7 +3142,7 @@ static int32_t linkop_begin(call_frame_t *frame,
if (op_errno)
goto error;
/*
- * check for cached info
+ * check for cached info
*/
op_ret = inode_ctx_get(fd->inode, this, &value);
if (op_ret != -1) {
@@ -3801,7 +3800,7 @@ static int32_t load_file_size(call_frame_t *frame,
"FOP %d: Translate regular file to %llu",
local->fop,
(unsigned long long)local->buf.ia_size);
- unwind:
+ unwind:
if (local->fd)
fd_unref(local->fd);
if (local->loc) {
@@ -3831,7 +3830,7 @@ static int32_t load_file_size(call_frame_t *frame,
op_ret,
op_errno,
op_ret >= 0 ? local->inode : NULL,
- op_ret >= 0 ? &local->buf : NULL,
+ op_ret >= 0 ? &local->buf : NULL,
local->xdata,
op_ret >= 0 ? &local->postbuf : NULL);
break;
@@ -3945,7 +3944,7 @@ static int32_t crypt_fstat(call_frame_t *frame,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fstat,
fd,
- xdata);
+ xdata);
return 0;
error:
STACK_UNWIND_STRICT(fstat,
@@ -3981,7 +3980,7 @@ static int32_t crypt_stat(call_frame_t *frame,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->stat,
loc,
- xdata);
+ xdata);
return 0;
error:
STACK_UNWIND_STRICT(stat,
@@ -4344,7 +4343,7 @@ int32_t master_set_nmtd_vol_key(xlator_t *this, crypt_private_t *priv)
int32_t crypt_init_xlator(xlator_t *this)
{
int32_t ret;
- crypt_private_t *priv = this->private;
+ crypt_private_t *priv = this->private;
ret = master_set_alg(this, priv);
if (ret)
@@ -4485,7 +4484,7 @@ struct xlator_fops fops = {
.fstat = crypt_fstat,
.lookup = crypt_lookup,
.readdirp = crypt_readdirp,
- .access = crypt_access
+ .access = crypt_access
};
struct xlator_cbks cbks = {
diff --git a/xlators/encryption/crypt/src/keys.c b/xlators/encryption/crypt/src/keys.c
index 05f9e75362a..0b243d3e827 100644
--- a/xlators/encryption/crypt/src/keys.c
+++ b/xlators/encryption/crypt/src/keys.c
@@ -13,7 +13,7 @@
#include "crypt.h"
/* Key hierarchy
-
+
+----------------+
| MASTER_VOL_KEY |
+-------+--------+
@@ -63,7 +63,7 @@ static int32_t kderive_init(struct kderive_context *ctx,
crypt_key_type type /* type of child key */)
{
unsigned char *pos;
- uint32_t llen = strlen(crypt_keys[type].label);
+ uint32_t llen = strlen(crypt_keys[type].label);
/*
* Compoud the fixed input data for KDF:
* [i]_2 || Label || 0x00 || Id-Context || [L]_2),
@@ -111,7 +111,7 @@ static int32_t kderive_init(struct kderive_context *ctx,
}
static void kderive_update(struct kderive_context *ctx)
-{
+{
uint32_t i;
HMAC_CTX hctx;
unsigned char *pos = ctx->out;
diff --git a/xlators/encryption/crypt/src/metadata.c b/xlators/encryption/crypt/src/metadata.c
index f99890e13dd..1364f825a98 100644
--- a/xlators/encryption/crypt/src/metadata.c
+++ b/xlators/encryption/crypt/src/metadata.c
@@ -70,7 +70,7 @@ static int32_t check_file_metadata(struct crypt_inode_info *info)
static size_t format_size_v1(mtd_op_t op, size_t old_size)
{
-
+
switch (op) {
case MTD_CREATE:
return sizeof(struct mtd_format_v1);
@@ -121,7 +121,7 @@ static int32_t calc_link_mac_v1(struct mtd_format_v1 *fmt,
struct crypt_inode_info *info,
struct master_cipher_info *master)
{
- int32_t ret;
+ int32_t ret;
unsigned char nmtd_link_key[16];
CMAC_CTX *cctx;
size_t len;
@@ -134,7 +134,7 @@ static int32_t calc_link_mac_v1(struct mtd_format_v1 *fmt,
cctx = CMAC_CTX_new();
if (!cctx) {
gf_log("crypt", GF_LOG_ERROR, "CMAC_CTX_new failed");
- return -1;
+ return -1;
}
ret = CMAC_Init(cctx, nmtd_link_key, sizeof(nmtd_link_key),
EVP_aes_128_cbc(), 0);
@@ -209,7 +209,7 @@ static int32_t create_format_v1(unsigned char *wire,
ret = get_nmtd_link_key(loc, master, nmtd_link_key);
if (ret)
return ret;
-
+
AES_set_encrypt_key(mtd_key, sizeof(mtd_key)*8, &EMTD_KEY);
gctx = CRYPTO_gcm128_new(&EMTD_KEY, (block128_f)AES_encrypt);
@@ -240,7 +240,7 @@ static int32_t create_format_v1(unsigned char *wire,
CRYPTO_gcm128_tag(gctx, get_EMTD_V1_MAC(fmt), SIZE_OF_EMTD_V1_MAC);
CRYPTO_gcm128_release(gctx);
/*
- * set the first MAC of non-encrypted part of metadata
+ * set the first MAC of non-encrypted part of metadata
*/
return create_link_mac_v1(fmt, 0, loc, info, master);
}
@@ -289,7 +289,7 @@ int32_t appov_link_mac_v1(unsigned char *new,
* Cut per-link mac of @mac_idx index
*/
static int32_t cut_link_mac_v1(unsigned char *new,
- unsigned char *old,
+ unsigned char *old,
uint32_t old_size,
int32_t mac_idx,
loc_t *loc,
@@ -594,7 +594,7 @@ int32_t open_format(unsigned char *str,
}
struct crypt_mtd_loader mtd_loaders [LAST_MTD_LOADER] = {
- [MTD_LOADER_V1] =
+ [MTD_LOADER_V1] =
{.format_size = format_size_v1,
.create_format = create_format_v1,
.open_format = open_format_v1,
diff --git a/xlators/encryption/crypt/src/metadata.h b/xlators/encryption/crypt/src/metadata.h
index a92f149ef50..b67ae25b58c 100644
--- a/xlators/encryption/crypt/src/metadata.h
+++ b/xlators/encryption/crypt/src/metadata.h
@@ -20,7 +20,7 @@ typedef uint8_t emtd_8_mac_t[EMTD_8_MAC_SIZE] ;
/*
* Version "v1" of file's metadata.
* Metadata of this version has 4 components:
- *
+ *
* 1) EMTD (Encrypted part of MeTaData);
* 2) NMTD (Non-encrypted part of MeTaData);
* 3) EMTD_MAC; (EMTD Message Authentication Code);