Skip to content

Commit e9f6452

Browse files
idryomovherbertx
authored andcommitted
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: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 1104921 commit e9f6452

1 file changed

Lines changed: 8 additions & 12 deletions

File tree

‎net/ceph/crypto.c‎

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ static int ceph_aes_encrypt(const void *key, int key_len,
166166
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
167167
SKCIPHER_REQUEST_ON_STACK(req, tfm);
168168
int ret;
169-
int ivsize = AES_BLOCK_SIZE;
170-
char iv[ivsize];
169+
char iv[AES_BLOCK_SIZE];
171170
size_t zero_padding = (0x10 - (src_len & 0x0f));
172171
char pad[16];
173172

@@ -186,7 +185,7 @@ static int ceph_aes_encrypt(const void *key, int key_len,
186185
goto out_tfm;
187186

188187
crypto_skcipher_setkey((void *)tfm, key, key_len);
189-
memcpy(iv, aes_iv, ivsize);
188+
memcpy(iv, aes_iv, AES_BLOCK_SIZE);
190189

191190
skcipher_request_set_tfm(req, tfm);
192191
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,
229228
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
230229
SKCIPHER_REQUEST_ON_STACK(req, tfm);
231230
int ret;
232-
int ivsize = AES_BLOCK_SIZE;
233-
char iv[ivsize];
231+
char iv[AES_BLOCK_SIZE];
234232
size_t zero_padding = (0x10 - ((src1_len + src2_len) & 0x0f));
235233
char pad[16];
236234

@@ -250,7 +248,7 @@ static int ceph_aes_encrypt2(const void *key, int key_len, void *dst,
250248
goto out_tfm;
251249

252250
crypto_skcipher_setkey((void *)tfm, key, key_len);
253-
memcpy(iv, aes_iv, ivsize);
251+
memcpy(iv, aes_iv, AES_BLOCK_SIZE);
254252

255253
skcipher_request_set_tfm(req, tfm);
256254
skcipher_request_set_callback(req, 0, NULL, NULL);
@@ -294,8 +292,7 @@ static int ceph_aes_decrypt(const void *key, int key_len,
294292
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
295293
SKCIPHER_REQUEST_ON_STACK(req, tfm);
296294
char pad[16];
297-
int ivsize = AES_BLOCK_SIZE;
298-
char iv[16];
295+
char iv[AES_BLOCK_SIZE];
299296
int ret;
300297
int last_byte;
301298

@@ -310,7 +307,7 @@ static int ceph_aes_decrypt(const void *key, int key_len,
310307
goto out_tfm;
311308

312309
crypto_skcipher_setkey((void *)tfm, key, key_len);
313-
memcpy(iv, aes_iv, ivsize);
310+
memcpy(iv, aes_iv, AES_BLOCK_SIZE);
314311

315312
skcipher_request_set_tfm(req, tfm);
316313
skcipher_request_set_callback(req, 0, NULL, NULL);
@@ -363,8 +360,7 @@ static int ceph_aes_decrypt2(const void *key, int key_len,
363360
struct crypto_skcipher *tfm = ceph_crypto_alloc_cipher();
364361
SKCIPHER_REQUEST_ON_STACK(req, tfm);
365362
char pad[16];
366-
int ivsize = AES_BLOCK_SIZE;
367-
char iv[ivsize];
363+
char iv[AES_BLOCK_SIZE];
368364
int ret;
369365
int last_byte;
370366

@@ -380,7 +376,7 @@ static int ceph_aes_decrypt2(const void *key, int key_len,
380376
goto out_tfm;
381377

382378
crypto_skcipher_setkey((void *)tfm, key, key_len);
383-
memcpy(iv, aes_iv, ivsize);
379+
memcpy(iv, aes_iv, AES_BLOCK_SIZE);
384380

385381
skcipher_request_set_tfm(req, tfm);
386382
skcipher_request_set_callback(req, 0, NULL, NULL);

0 commit comments

Comments
 (0)