Commit e9f6452e authored by Ilya Dryomov's avatar Ilya Dryomov Committed by Herbert Xu

libceph: Remove unnecessary ivsize variables

This patch removes the unnecessary ivsize variabls as they always
have the value of AES_BLOCK_SIZE.
Signed-off-by: default avatarIlya Dryomov <idryomov@gmail.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 11049218
...@@ -166,8 +166,7 @@ static int ceph_aes_encrypt(const void *key, int key_len, ...@@ -166,8 +166,7 @@ static int ceph_aes_encrypt(const void *key, int key_len,
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher(); struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
SKCIPHER_REQUEST_ON_STACK(req, tfm); SKCIPHER_REQUEST_ON_STACK(req, tfm);
int ret; int ret;
int ivsize = AES_BLOCK_SIZE; char iv[AES_BLOCK_SIZE];
char iv[ivsize];
size_t zero_padding = (0x10 - (src_len & 0x0f)); size_t zero_padding = (0x10 - (src_len & 0x0f));
char pad[16]; char pad[16];
...@@ -186,7 +185,7 @@ static int ceph_aes_encrypt(const void *key, int key_len, ...@@ -186,7 +185,7 @@ static int ceph_aes_encrypt(const void *key, int key_len,
goto out_tfm; goto out_tfm;
crypto_skcipher_setkey((void *)tfm, key, key_len); crypto_skcipher_setkey((void *)tfm, key, key_len);
memcpy(iv, aes_iv, ivsize); memcpy(iv, aes_iv, AES_BLOCK_SIZE);
skcipher_request_set_tfm(req, tfm); skcipher_request_set_tfm(req, tfm);
skcipher_request_set_callback(req, 0, NULL, NULL); skcipher_request_set_callback(req, 0, NULL, NULL);
...@@ -229,8 +228,7 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, ...@@ -229,8 +228,7 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst,
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher(); struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
SKCIPHER_REQUEST_ON_STACK(req, tfm); SKCIPHER_REQUEST_ON_STACK(req, tfm);
int ret; int ret;
int ivsize = AES_BLOCK_SIZE; char iv[AES_BLOCK_SIZE];
char iv[ivsize];
size_t zero_padding = (0x10 - ((src1_len + src2_len) & 0x0f)); size_t zero_padding = (0x10 - ((src1_len + src2_len) & 0x0f));
char pad[16]; char pad[16];
...@@ -250,7 +248,7 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst, ...@@ -250,7 +248,7 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst,
goto out_tfm; goto out_tfm;
crypto_skcipher_setkey((void *)tfm, key, key_len); crypto_skcipher_setkey((void *)tfm, key, key_len);
memcpy(iv, aes_iv, ivsize); memcpy(iv, aes_iv, AES_BLOCK_SIZE);
skcipher_request_set_tfm(req, tfm); skcipher_request_set_tfm(req, tfm);
skcipher_request_set_callback(req, 0, NULL, NULL); skcipher_request_set_callback(req, 0, NULL, NULL);
...@@ -294,8 +292,7 @@ static int ceph_aes_decrypt(const void *key, int key_len, ...@@ -294,8 +292,7 @@ static int ceph_aes_decrypt(const void *key, int key_len,
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher(); struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
SKCIPHER_REQUEST_ON_STACK(req, tfm); SKCIPHER_REQUEST_ON_STACK(req, tfm);
char pad[16]; char pad[16];
int ivsize = AES_BLOCK_SIZE; char iv[AES_BLOCK_SIZE];
char iv[16];
int ret; int ret;
int last_byte; int last_byte;
...@@ -310,7 +307,7 @@ static int ceph_aes_decrypt(const void *key, int key_len, ...@@ -310,7 +307,7 @@ static int ceph_aes_decrypt(const void *key, int key_len,
goto out_tfm; goto out_tfm;
crypto_skcipher_setkey((void *)tfm, key, key_len); crypto_skcipher_setkey((void *)tfm, key, key_len);
memcpy(iv, aes_iv, ivsize); memcpy(iv, aes_iv, AES_BLOCK_SIZE);
skcipher_request_set_tfm(req, tfm); skcipher_request_set_tfm(req, tfm);
skcipher_request_set_callback(req, 0, NULL, NULL); skcipher_request_set_callback(req, 0, NULL, NULL);
...@@ -363,8 +360,7 @@ static int ceph_aes_decrypt2(const void *key, int key_len, ...@@ -363,8 +360,7 @@ static int ceph_aes_decrypt2(const void *key, int key_len,
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher(); struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
SKCIPHER_REQUEST_ON_STACK(req, tfm); SKCIPHER_REQUEST_ON_STACK(req, tfm);
char pad[16]; char pad[16];
int ivsize = AES_BLOCK_SIZE; char iv[AES_BLOCK_SIZE];
char iv[ivsize];
int ret; int ret;
int last_byte; int last_byte;
...@@ -380,7 +376,7 @@ static int ceph_aes_decrypt2(const void *key, int key_len, ...@@ -380,7 +376,7 @@ static int ceph_aes_decrypt2(const void *key, int key_len,
goto out_tfm; goto out_tfm;
crypto_skcipher_setkey((void *)tfm, key, key_len); crypto_skcipher_setkey((void *)tfm, key, key_len);
memcpy(iv, aes_iv, ivsize); memcpy(iv, aes_iv, AES_BLOCK_SIZE);
skcipher_request_set_tfm(req, tfm); skcipher_request_set_tfm(req, tfm);
skcipher_request_set_callback(req, 0, NULL, NULL); skcipher_request_set_callback(req, 0, NULL, NULL);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment