* [PATCH 1/4] crypto: bcm: Remove unused variable (char *tag_to_hash_idx[]) @ 2018-02-27 22:01 Hernán Gonzalez 2018-02-27 22:01 ` [PATCH 2/4] crypto: bcm: Move *aead_alg_name[] from spu.c to util.c. Constify too Hernán Gonzalez ` (2 more replies) 0 siblings, 3 replies; 8+ messages in thread From: Hernán Gonzalez @ 2018-02-27 22:01 UTC (permalink / raw) To: herbert, davem, hernan, steven.lin1, arvind.yadav.cs, colin.king, raveendra.padasalagi, ray.jui, scott.branden, linux-crypto, linux-kernel Note: this is compile only tested. Variable was not used anywhere in the code, remove it and save 20 bytes. add/remove: 0/1 grow/shrink: 0/0 up/down: 0/-20 (-20) Function old new delta tag_to_hash_idx 20 - -20 Total: Before=9185256, After=9185236, chg -0.00% Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar> --- drivers/crypto/bcm/spu.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/crypto/bcm/spu.c b/drivers/crypto/bcm/spu.c index dbb5c03..c3d177d 100644 --- a/drivers/crypto/bcm/spu.c +++ b/drivers/crypto/bcm/spu.c @@ -23,8 +23,6 @@ #include "cipher.h" /* This array is based on the hash algo type supported in spu.h */ -char *tag_to_hash_idx[] = { "none", "md5", "sha1", "sha224", "sha256" }; - char *hash_alg_name[] = { "None", "md5", "sha1", "sha224", "sha256", "aes", "sha384", "sha512", "sha3_224", "sha3_256", "sha3_384", "sha3_512" }; -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] crypto: bcm: Move *aead_alg_name[] from spu.c to util.c. Constify too. 2018-02-27 22:01 [PATCH 1/4] crypto: bcm: Remove unused variable (char *tag_to_hash_idx[]) Hernán Gonzalez @ 2018-02-27 22:01 ` Hernán Gonzalez 2018-02-27 22:01 ` [PATCH 3/4] crypto: bcm: Constify *hash_alg_name[] Hernán Gonzalez 2018-02-27 22:01 ` [PATCH 4/4] crypto: bcm: Constify variables in spu2.c Hernán Gonzalez 2 siblings, 0 replies; 8+ messages in thread From: Hernán Gonzalez @ 2018-02-27 22:01 UTC (permalink / raw) To: herbert, davem, hernan, steven.lin1, arvind.yadav.cs, colin.king, raveendra.padasalagi, ray.jui, scott.branden, linux-crypto, linux-kernel Note: This is compile only tested. Move variable to where it is actually used. No gain from this except for some self-documenting. Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar> --- drivers/crypto/bcm/spu.c | 2 -- drivers/crypto/bcm/spu.h | 1 - drivers/crypto/bcm/util.c | 2 ++ 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/bcm/spu.c b/drivers/crypto/bcm/spu.c index c3d177d..efaf3cf 100644 --- a/drivers/crypto/bcm/spu.c +++ b/drivers/crypto/bcm/spu.c @@ -26,8 +26,6 @@ char *hash_alg_name[] = { "None", "md5", "sha1", "sha224", "sha256", "aes", "sha384", "sha512", "sha3_224", "sha3_256", "sha3_384", "sha3_512" }; -char *aead_alg_name[] = { "ccm(aes)", "gcm(aes)", "authenc" }; - /* Assumes SPU-M messages are in big endian */ void spum_dump_msg_hdr(u8 *buf, unsigned int buf_len) { diff --git a/drivers/crypto/bcm/spu.h b/drivers/crypto/bcm/spu.h index aa6fc38..f252367 100644 --- a/drivers/crypto/bcm/spu.h +++ b/drivers/crypto/bcm/spu.h @@ -112,7 +112,6 @@ enum aead_type { }; extern char *hash_alg_name[HASH_ALG_LAST]; -extern char *aead_alg_name[AEAD_TYPE_LAST]; struct spu_request_opts { bool is_inbound; diff --git a/drivers/crypto/bcm/util.c b/drivers/crypto/bcm/util.c index d543c01..fa6161a 100644 --- a/drivers/crypto/bcm/util.c +++ b/drivers/crypto/bcm/util.c @@ -23,6 +23,8 @@ #define SPU_OFIFO_CTRL 0x40 #define SPU_FIFO_WATERMARK 0x1FF +static char const * const aead_alg_name[] = { "ccm(aes)", "gcm(aes)", "authenc" }; + /** * spu_sg_at_offset() - Find the scatterlist entry at a given distance from the * start of a scatterlist. -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] crypto: bcm: Constify *hash_alg_name[] 2018-02-27 22:01 [PATCH 1/4] crypto: bcm: Remove unused variable (char *tag_to_hash_idx[]) Hernán Gonzalez 2018-02-27 22:01 ` [PATCH 2/4] crypto: bcm: Move *aead_alg_name[] from spu.c to util.c. Constify too Hernán Gonzalez @ 2018-02-27 22:01 ` Hernán Gonzalez 2018-03-09 14:29 ` Herbert Xu 2018-03-09 15:04 ` Kamil Konieczny 2018-02-27 22:01 ` [PATCH 4/4] crypto: bcm: Constify variables in spu2.c Hernán Gonzalez 2 siblings, 2 replies; 8+ messages in thread From: Hernán Gonzalez @ 2018-02-27 22:01 UTC (permalink / raw) To: herbert, davem, hernan, steven.lin1, arvind.yadav.cs, colin.king, raveendra.padasalagi, ray.jui, scott.branden, linux-crypto, linux-kernel Note: This is compile only tested. No gain from this except some self-documenting. Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar> --- drivers/crypto/bcm/spu.c | 5 +++-- drivers/crypto/bcm/spu.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/crypto/bcm/spu.c b/drivers/crypto/bcm/spu.c index efaf3cf..c7bb79e 100644 --- a/drivers/crypto/bcm/spu.c +++ b/drivers/crypto/bcm/spu.c @@ -23,8 +23,9 @@ #include "cipher.h" /* This array is based on the hash algo type supported in spu.h */ -char *hash_alg_name[] = { "None", "md5", "sha1", "sha224", "sha256", "aes", - "sha384", "sha512", "sha3_224", "sha3_256", "sha3_384", "sha3_512" }; +char const * const hash_alg_name[] = { "None", "md5", "sha1", "sha224", + "sha256", "aes", "sha384", "sha512", "sha3_224", "sha3_256", "sha3_384", + "sha3_512" }; /* Assumes SPU-M messages are in big endian */ void spum_dump_msg_hdr(u8 *buf, unsigned int buf_len) diff --git a/drivers/crypto/bcm/spu.h b/drivers/crypto/bcm/spu.h index f252367..71cf6b5 100644 --- a/drivers/crypto/bcm/spu.h +++ b/drivers/crypto/bcm/spu.h @@ -111,7 +111,7 @@ enum aead_type { AEAD_TYPE_LAST }; -extern char *hash_alg_name[HASH_ALG_LAST]; +extern const char * const hash_alg_name[HASH_ALG_LAST]; struct spu_request_opts { bool is_inbound; -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/4] crypto: bcm: Constify *hash_alg_name[] 2018-02-27 22:01 ` [PATCH 3/4] crypto: bcm: Constify *hash_alg_name[] Hernán Gonzalez @ 2018-03-09 14:29 ` Herbert Xu 2018-03-09 14:35 ` Joe Perches 2018-03-09 15:04 ` Kamil Konieczny 1 sibling, 1 reply; 8+ messages in thread From: Herbert Xu @ 2018-03-09 14:29 UTC (permalink / raw) To: Hernán Gonzalez Cc: davem, steven.lin1, arvind.yadav.cs, colin.king, raveendra.padasalagi, ray.jui, scott.branden, linux-crypto, linux-kernel On Tue, Feb 27, 2018 at 07:01:27PM -0300, Hernán Gonzalez wrote: > Note: This is compile only tested. > No gain from this except some self-documenting. > > Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar> > --- > drivers/crypto/bcm/spu.c | 5 +++-- > drivers/crypto/bcm/spu.h | 2 +- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/crypto/bcm/spu.c b/drivers/crypto/bcm/spu.c > index efaf3cf..c7bb79e 100644 > --- a/drivers/crypto/bcm/spu.c > +++ b/drivers/crypto/bcm/spu.c > @@ -23,8 +23,9 @@ > #include "cipher.h" > > /* This array is based on the hash algo type supported in spu.h */ > -char *hash_alg_name[] = { "None", "md5", "sha1", "sha224", "sha256", "aes", > - "sha384", "sha512", "sha3_224", "sha3_256", "sha3_384", "sha3_512" }; > +char const * const hash_alg_name[] = { "None", "md5", "sha1", "sha224", Please make that const char *const Ditto with patch 4. 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] 8+ messages in thread
* Re: [PATCH 3/4] crypto: bcm: Constify *hash_alg_name[] 2018-03-09 14:29 ` Herbert Xu @ 2018-03-09 14:35 ` Joe Perches 2018-03-09 15:04 ` Herbert Xu 0 siblings, 1 reply; 8+ messages in thread From: Joe Perches @ 2018-03-09 14:35 UTC (permalink / raw) To: Herbert Xu, Hernán Gonzalez Cc: davem, steven.lin1, arvind.yadav.cs, colin.king, raveendra.padasalagi, ray.jui, scott.branden, linux-crypto, linux-kernel On Fri, 2018-03-09 at 22:29 +0800, Herbert Xu wrote: > On Tue, Feb 27, 2018 at 07:01:27PM -0300, Hernán Gonzalez wrote: > > Note: This is compile only tested. > > No gain from this except some self-documenting. [] > > diff --git a/drivers/crypto/bcm/spu.c b/drivers/crypto/bcm/spu.c [] > > @@ -23,8 +23,9 @@ > > #include "cipher.h" > > > > /* This array is based on the hash algo type supported in spu.h */ > > -char *hash_alg_name[] = { "None", "md5", "sha1", "sha224", "sha256", "aes", > > - "sha384", "sha512", "sha3_224", "sha3_256", "sha3_384", "sha3_512" }; > > +char const * const hash_alg_name[] = { "None", "md5", "sha1", "sha224", > > Please make that > > const char *const > > Ditto with patch 4. > > Thanks, and likely, as this is a global name, it should be something like crypto_hash_alg_name ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/4] crypto: bcm: Constify *hash_alg_name[] 2018-03-09 14:35 ` Joe Perches @ 2018-03-09 15:04 ` Herbert Xu 0 siblings, 0 replies; 8+ messages in thread From: Herbert Xu @ 2018-03-09 15:04 UTC (permalink / raw) To: Joe Perches Cc: Hernán Gonzalez, davem, steven.lin1, arvind.yadav.cs, colin.king, raveendra.padasalagi, ray.jui, scott.branden, linux-crypto, linux-kernel On Fri, Mar 09, 2018 at 06:35:35AM -0800, Joe Perches wrote: > > and likely, as this is a global name, it should > be something like crypto_hash_alg_name crypto_ is not a good prefix here. Perhaps crypto_bcm_. 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] 8+ messages in thread
* Re: [PATCH 3/4] crypto: bcm: Constify *hash_alg_name[] 2018-02-27 22:01 ` [PATCH 3/4] crypto: bcm: Constify *hash_alg_name[] Hernán Gonzalez 2018-03-09 14:29 ` Herbert Xu @ 2018-03-09 15:04 ` Kamil Konieczny 1 sibling, 0 replies; 8+ messages in thread From: Kamil Konieczny @ 2018-03-09 15:04 UTC (permalink / raw) To: Hernán Gonzalez, herbert, davem, steven.lin1, arvind.yadav.cs, colin.king, raveendra.padasalagi, ray.jui, scott.branden, linux-crypto, linux-kernel On 27.02.2018 23:01, Hernán Gonzalez wrote: > Note: This is compile only tested. > No gain from this except some self-documenting. > > Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar> > --- > drivers/crypto/bcm/spu.c | 5 +++-- > drivers/crypto/bcm/spu.h | 2 +- > 2 files changed, 4 insertions(+), 3 deletions(-) > > diff --git a/drivers/crypto/bcm/spu.c b/drivers/crypto/bcm/spu.c > index efaf3cf..c7bb79e 100644 > --- a/drivers/crypto/bcm/spu.c > +++ b/drivers/crypto/bcm/spu.c > @@ -23,8 +23,9 @@ > #include "cipher.h" > > /* This array is based on the hash algo type supported in spu.h */ > -char *hash_alg_name[] = { "None", "md5", "sha1", "sha224", "sha256", "aes", ------------------------------------------------------------------------ ^^^ 'aes' is not hash, so either remove 'aes' or change array name to crypto_alg_name Or maybe I am missing something, or is it hardcoded in silicon ? > - "sha384", "sha512", "sha3_224", "sha3_256", "sha3_384", "sha3_512" }; > +char const * const hash_alg_name[] = { "None", "md5", "sha1", "sha224", > + "sha256", "aes", "sha384", "sha512", "sha3_224", "sha3_256", "sha3_384", > + "sha3_512" }; > > /* Assumes SPU-M messages are in big endian */ > void spum_dump_msg_hdr(u8 *buf, unsigned int buf_len) > diff --git a/drivers/crypto/bcm/spu.h b/drivers/crypto/bcm/spu.h > index f252367..71cf6b5 100644 > --- a/drivers/crypto/bcm/spu.h > +++ b/drivers/crypto/bcm/spu.h > @@ -111,7 +111,7 @@ enum aead_type { > AEAD_TYPE_LAST > }; > > -extern char *hash_alg_name[HASH_ALG_LAST]; > +extern const char * const hash_alg_name[HASH_ALG_LAST]; > > struct spu_request_opts { > bool is_inbound; > -- Best regards, Kamil Konieczny Samsung R&D Institute Poland ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/4] crypto: bcm: Constify variables in spu2.c 2018-02-27 22:01 [PATCH 1/4] crypto: bcm: Remove unused variable (char *tag_to_hash_idx[]) Hernán Gonzalez 2018-02-27 22:01 ` [PATCH 2/4] crypto: bcm: Move *aead_alg_name[] from spu.c to util.c. Constify too Hernán Gonzalez 2018-02-27 22:01 ` [PATCH 3/4] crypto: bcm: Constify *hash_alg_name[] Hernán Gonzalez @ 2018-02-27 22:01 ` Hernán Gonzalez 2 siblings, 0 replies; 8+ messages in thread From: Hernán Gonzalez @ 2018-02-27 22:01 UTC (permalink / raw) To: herbert, davem, hernan, steven.lin1, arvind.yadav.cs, colin.king, raveendra.padasalagi, ray.jui, scott.branden, linux-crypto, linux-kernel Note: This is compile only tested. Variables constified: *spu2_cipher_type_names *spu2_hash_mode_names *spu2_cipher_mode_names *spu2_hash_type_names Constifying and declaring as static saves 160 bytes. add/remove: 0/4 grow/shrink: 0/0 up/down: 0/-160 (-160) Function old new delta spu2_cipher_type_names 24 - -24 spu2_hash_mode_names 32 - -32 spu2_cipher_mode_names 32 - -32 spu2_hash_type_names 72 - -72 Total: Before=9185236, After=9185076, chg -0.00% Signed-off-by: Hernán Gonzalez <hernan@vanguardiasur.com.ar> --- drivers/crypto/bcm/spu2.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/crypto/bcm/spu2.c b/drivers/crypto/bcm/spu2.c index bf7ac62..fcf3885 100644 --- a/drivers/crypto/bcm/spu2.c +++ b/drivers/crypto/bcm/spu2.c @@ -49,22 +49,22 @@ enum spu2_proto_sel { SPU2_DTLS_AEAD = 10 }; -char *spu2_cipher_type_names[] = { "None", "AES128", "AES192", "AES256", - "DES", "3DES" +static char * const spu2_cipher_type_names[] = { "None", "AES128", "AES192", + "AES256", "DES", "3DES" }; -char *spu2_cipher_mode_names[] = { "ECB", "CBC", "CTR", "CFB", "OFB", "XTS", - "CCM", "GCM" +static char * const spu2_cipher_mode_names[] = { "ECB", "CBC", "CTR", "CFB", + "OFB", "XTS", "CCM", "GCM" }; -char *spu2_hash_type_names[] = { "None", "AES128", "AES192", "AES256", - "Reserved", "Reserved", "MD5", "SHA1", "SHA224", "SHA256", "SHA384", - "SHA512", "SHA512/224", "SHA512/256", "SHA3-224", "SHA3-256", +static char * const spu2_hash_type_names[] = { "None", "AES128", "AES192", + "AES256", "Reserved", "Reserved", "MD5", "SHA1", "SHA224", "SHA256", + "SHA384", "SHA512", "SHA512/224", "SHA512/256", "SHA3-224", "SHA3-256", "SHA3-384", "SHA3-512" }; -char *spu2_hash_mode_names[] = { "CMAC", "CBC-MAC", "XCBC-MAC", "HMAC", - "Rabin", "CCM", "GCM", "Reserved" +static char * const spu2_hash_mode_names[] = { "CMAC", "CBC-MAC", "XCBC-MAC", + "HMAC", "Rabin", "CCM", "GCM", "Reserved" }; static char *spu2_ciph_type_name(enum spu2_cipher_type cipher_type) -- 2.7.4 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-03-09 15:04 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2018-02-27 22:01 [PATCH 1/4] crypto: bcm: Remove unused variable (char *tag_to_hash_idx[]) Hernán Gonzalez 2018-02-27 22:01 ` [PATCH 2/4] crypto: bcm: Move *aead_alg_name[] from spu.c to util.c. Constify too Hernán Gonzalez 2018-02-27 22:01 ` [PATCH 3/4] crypto: bcm: Constify *hash_alg_name[] Hernán Gonzalez 2018-03-09 14:29 ` Herbert Xu 2018-03-09 14:35 ` Joe Perches 2018-03-09 15:04 ` Herbert Xu 2018-03-09 15:04 ` Kamil Konieczny 2018-02-27 22:01 ` [PATCH 4/4] crypto: bcm: Constify variables in spu2.c Hernán Gonzalez
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).