Staging: skein: skein_api: Remove useless type conversion
Some type conversions like casting a pointer to a pointer of same type, casting to the original type using addressof(&) operator etc. are not needed. Therefore, remove them. Done using coccinelle: @@ type t; t *p; t a; @@ ( - (t)(a) + a | - (t *)(p) + p | - (t *)(&a) + &a ) Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
321c799cd9
commit
1af172fa41
@ -98,19 +98,16 @@ int skein_mac_init(struct skein_ctx *ctx, const u8 *key, size_t key_len,
|
|||||||
switch (ctx->skein_size) {
|
switch (ctx->skein_size) {
|
||||||
case SKEIN_256:
|
case SKEIN_256:
|
||||||
ret = skein_256_init_ext(&ctx->m.s256, hash_bit_len,
|
ret = skein_256_init_ext(&ctx->m.s256, hash_bit_len,
|
||||||
tree_info,
|
tree_info, key, key_len);
|
||||||
(const u8 *)key, key_len);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SKEIN_512:
|
case SKEIN_512:
|
||||||
ret = skein_512_init_ext(&ctx->m.s512, hash_bit_len,
|
ret = skein_512_init_ext(&ctx->m.s512, hash_bit_len,
|
||||||
tree_info,
|
tree_info, key, key_len);
|
||||||
(const u8 *)key, key_len);
|
|
||||||
break;
|
break;
|
||||||
case SKEIN_1024:
|
case SKEIN_1024:
|
||||||
ret = skein_1024_init_ext(&ctx->m.s1024, hash_bit_len,
|
ret = skein_1024_init_ext(&ctx->m.s1024, hash_bit_len,
|
||||||
tree_info,
|
tree_info, key, key_len);
|
||||||
(const u8 *)key, key_len);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -152,16 +149,13 @@ int skein_update(struct skein_ctx *ctx, const u8 *msg,
|
|||||||
|
|
||||||
switch (ctx->skein_size) {
|
switch (ctx->skein_size) {
|
||||||
case SKEIN_256:
|
case SKEIN_256:
|
||||||
ret = skein_256_update(&ctx->m.s256, (const u8 *)msg,
|
ret = skein_256_update(&ctx->m.s256, msg, msg_byte_cnt);
|
||||||
msg_byte_cnt);
|
|
||||||
break;
|
break;
|
||||||
case SKEIN_512:
|
case SKEIN_512:
|
||||||
ret = skein_512_update(&ctx->m.s512, (const u8 *)msg,
|
ret = skein_512_update(&ctx->m.s512, msg, msg_byte_cnt);
|
||||||
msg_byte_cnt);
|
|
||||||
break;
|
break;
|
||||||
case SKEIN_1024:
|
case SKEIN_1024:
|
||||||
ret = skein_1024_update(&ctx->m.s1024, (const u8 *)msg,
|
ret = skein_1024_update(&ctx->m.s1024, msg, msg_byte_cnt);
|
||||||
msg_byte_cnt);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
@ -211,7 +205,7 @@ int skein_update_bits(struct skein_ctx *ctx, const u8 *msg,
|
|||||||
/* partial byte bit mask */
|
/* partial byte bit mask */
|
||||||
mask = (u8)(1u << (7 - (msg_bit_cnt & 7)));
|
mask = (u8)(1u << (7 - (msg_bit_cnt & 7)));
|
||||||
/* apply bit padding on final byte (in the buffer) */
|
/* apply bit padding on final byte (in the buffer) */
|
||||||
up[length - 1] = (u8)((up[length - 1] & (0 - mask)) | mask);
|
up[length - 1] = (up[length - 1] & (0 - mask)) | mask;
|
||||||
|
|
||||||
return SKEIN_SUCCESS;
|
return SKEIN_SUCCESS;
|
||||||
}
|
}
|
||||||
@ -224,13 +218,13 @@ int skein_final(struct skein_ctx *ctx, u8 *hash)
|
|||||||
|
|
||||||
switch (ctx->skein_size) {
|
switch (ctx->skein_size) {
|
||||||
case SKEIN_256:
|
case SKEIN_256:
|
||||||
ret = skein_256_final(&ctx->m.s256, (u8 *)hash);
|
ret = skein_256_final(&ctx->m.s256, hash);
|
||||||
break;
|
break;
|
||||||
case SKEIN_512:
|
case SKEIN_512:
|
||||||
ret = skein_512_final(&ctx->m.s512, (u8 *)hash);
|
ret = skein_512_final(&ctx->m.s512, hash);
|
||||||
break;
|
break;
|
||||||
case SKEIN_1024:
|
case SKEIN_1024:
|
||||||
ret = skein_1024_final(&ctx->m.s1024, (u8 *)hash);
|
ret = skein_1024_final(&ctx->m.s1024, hash);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user