* [PATCH] crypto/drbg.c:remove unnecessary (void*) conversions
@ 2022-08-09 9:14 Dong Chuanjian
2022-08-09 18:07 ` Eric Biggers
0 siblings, 1 reply; 5+ messages in thread
From: Dong Chuanjian @ 2022-08-09 9:14 UTC (permalink / raw)
To: herbert, davem; +Cc: linux-crypto, linux-kernel, kernel, Dong Chuanjian
remove unnecessary void* type casting
Signed-off-by: Dong Chuanjian <chuanjian@nfschina.com>
diff --git a/crypto/drbg.c b/crypto/drbg.c
index 177983b6ae38..f41ec3088ecc 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1703,7 +1703,7 @@ static int drbg_init_hash_kernel(struct drbg_state *drbg)
static int drbg_fini_hash_kernel(struct drbg_state *drbg)
{
- struct sdesc *sdesc = (struct sdesc *)drbg->priv_data;
+ struct sdesc *sdesc = drbg->priv_data;
if (sdesc) {
crypto_free_shash(sdesc->shash.tfm);
kfree_sensitive(sdesc);
@@ -1715,7 +1715,7 @@ static int drbg_fini_hash_kernel(struct drbg_state *drbg)
static void drbg_kcapi_hmacsetkey(struct drbg_state *drbg,
const unsigned char *key)
{
- struct sdesc *sdesc = (struct sdesc *)drbg->priv_data;
+ struct sdesc *sdesc = drbg->priv_data;
crypto_shash_setkey(sdesc->shash.tfm, key, drbg_statelen(drbg));
}
@@ -1723,7 +1723,7 @@ static void drbg_kcapi_hmacsetkey(struct drbg_state *drbg,
static int drbg_kcapi_hash(struct drbg_state *drbg, unsigned char *outval,
const struct list_head *in)
{
- struct sdesc *sdesc = (struct sdesc *)drbg->priv_data;
+ struct sdesc *sdesc = drbg->priv_data;
struct drbg_string *input = NULL;
crypto_shash_init(&sdesc->shash);
@@ -1819,7 +1819,7 @@ static void drbg_kcapi_symsetkey(struct drbg_state *drbg,
const unsigned char *key)
{
struct crypto_cipher *tfm =
- (struct crypto_cipher *)drbg->priv_data;
+ drbg->priv_data;
crypto_cipher_setkey(tfm, key, (drbg_keylen(drbg)));
}
@@ -1828,7 +1828,7 @@ static int drbg_kcapi_sym(struct drbg_state *drbg, unsigned char *outval,
const struct drbg_string *in)
{
struct crypto_cipher *tfm =
- (struct crypto_cipher *)drbg->priv_data;
+ drbg->priv_data;
/* there is only component in *in */
BUG_ON(in->len < drbg_blocklen(drbg));
--
2.18.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] crypto/drbg.c:remove unnecessary (void*) conversions
2022-08-09 9:14 [PATCH] crypto/drbg.c:remove unnecessary (void*) conversions Dong Chuanjian
@ 2022-08-09 18:07 ` Eric Biggers
2022-08-11 7:17 ` Dong Chuanjian
0 siblings, 1 reply; 5+ messages in thread
From: Eric Biggers @ 2022-08-09 18:07 UTC (permalink / raw)
To: Dong Chuanjian; +Cc: herbert, davem, linux-crypto, linux-kernel, kernel
On Tue, Aug 09, 2022 at 05:14:52PM +0800, Dong Chuanjian wrote:
> struct crypto_cipher *tfm =
> - (struct crypto_cipher *)drbg->priv_data;
> + drbg->priv_data;
Might as well join this into one line.
>
> crypto_cipher_setkey(tfm, key, (drbg_keylen(drbg)));
> }
> @@ -1828,7 +1828,7 @@ static int drbg_kcapi_sym(struct drbg_state *drbg, unsigned char *outval,
> const struct drbg_string *in)
> {
> struct crypto_cipher *tfm =
> - (struct crypto_cipher *)drbg->priv_data;
> + drbg->priv_data;
Likewise.
- Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] crypto/drbg.c:remove unnecessary (void*) conversions
2022-08-09 18:07 ` Eric Biggers
@ 2022-08-11 7:17 ` Dong Chuanjian
2022-08-11 7:17 ` [PATCH] crypto/drbg: remove " Dong Chuanjian
0 siblings, 1 reply; 5+ messages in thread
From: Dong Chuanjian @ 2022-08-11 7:17 UTC (permalink / raw)
To: ebiggers; +Cc: chuanjian, davem, herbert, kernel, linux-crypto, linux-kernel
v2:
Turn assignments less than 75 characters into one line
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] crypto/drbg: remove unnecessary (void*) conversions
2022-08-11 7:17 ` Dong Chuanjian
@ 2022-08-11 7:17 ` Dong Chuanjian
2022-08-19 11:03 ` Herbert Xu
0 siblings, 1 reply; 5+ messages in thread
From: Dong Chuanjian @ 2022-08-11 7:17 UTC (permalink / raw)
To: ebiggers; +Cc: chuanjian, davem, herbert, kernel, linux-crypto, linux-kernel
remove unnecessary void* type casting
v2:
Turn assignments less than 75 characters into one line.
Signed-off-by: Dong Chuanjian <chuanjian@nfschina.com>
diff --git a/crypto/drbg.c b/crypto/drbg.c
index 177983b6ae38..982d4ca4526d 100644
--- a/crypto/drbg.c
+++ b/crypto/drbg.c
@@ -1703,7 +1703,7 @@ static int drbg_init_hash_kernel(struct drbg_state *drbg)
static int drbg_fini_hash_kernel(struct drbg_state *drbg)
{
- struct sdesc *sdesc = (struct sdesc *)drbg->priv_data;
+ struct sdesc *sdesc = drbg->priv_data;
if (sdesc) {
crypto_free_shash(sdesc->shash.tfm);
kfree_sensitive(sdesc);
@@ -1715,7 +1715,7 @@ static int drbg_fini_hash_kernel(struct drbg_state *drbg)
static void drbg_kcapi_hmacsetkey(struct drbg_state *drbg,
const unsigned char *key)
{
- struct sdesc *sdesc = (struct sdesc *)drbg->priv_data;
+ struct sdesc *sdesc = drbg->priv_data;
crypto_shash_setkey(sdesc->shash.tfm, key, drbg_statelen(drbg));
}
@@ -1723,7 +1723,7 @@ static void drbg_kcapi_hmacsetkey(struct drbg_state *drbg,
static int drbg_kcapi_hash(struct drbg_state *drbg, unsigned char *outval,
const struct list_head *in)
{
- struct sdesc *sdesc = (struct sdesc *)drbg->priv_data;
+ struct sdesc *sdesc = drbg->priv_data;
struct drbg_string *input = NULL;
crypto_shash_init(&sdesc->shash);
@@ -1818,8 +1818,7 @@ static int drbg_init_sym_kernel(struct drbg_state *drbg)
static void drbg_kcapi_symsetkey(struct drbg_state *drbg,
const unsigned char *key)
{
- struct crypto_cipher *tfm =
- (struct crypto_cipher *)drbg->priv_data;
+ struct crypto_cipher *tfm = drbg->priv_data;
crypto_cipher_setkey(tfm, key, (drbg_keylen(drbg)));
}
@@ -1827,8 +1826,7 @@ static void drbg_kcapi_symsetkey(struct drbg_state *drbg,
static int drbg_kcapi_sym(struct drbg_state *drbg, unsigned char *outval,
const struct drbg_string *in)
{
- struct crypto_cipher *tfm =
- (struct crypto_cipher *)drbg->priv_data;
+ struct crypto_cipher *tfm = drbg->priv_data;
/* there is only component in *in */
BUG_ON(in->len < drbg_blocklen(drbg));
--
2.18.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] crypto/drbg: remove unnecessary (void*) conversions
2022-08-11 7:17 ` [PATCH] crypto/drbg: remove " Dong Chuanjian
@ 2022-08-19 11:03 ` Herbert Xu
0 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2022-08-19 11:03 UTC (permalink / raw)
To: Dong Chuanjian; +Cc: ebiggers, davem, kernel, linux-crypto, linux-kernel
On Thu, Aug 11, 2022 at 03:17:33PM +0800, Dong Chuanjian wrote:
> remove unnecessary void* type casting
>
> v2:
> Turn assignments less than 75 characters into one line.
>
> Signed-off-by: Dong Chuanjian <chuanjian@nfschina.com>
Patch applied. Thanks.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-08-19 11:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-09 9:14 [PATCH] crypto/drbg.c:remove unnecessary (void*) conversions Dong Chuanjian
2022-08-09 18:07 ` Eric Biggers
2022-08-11 7:17 ` Dong Chuanjian
2022-08-11 7:17 ` [PATCH] crypto/drbg: remove " Dong Chuanjian
2022-08-19 11:03 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox