diff options
author | Stephan Mueller <smueller@chronox.de> | 2014-07-05 20:23:03 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-07-08 09:18:23 -0400 |
commit | e25e47ec3d569d45485e9a9befe7ad5cdaac47df (patch) | |
tree | 5ed18e94cc9193d872a77d38bec9aa8bd5ab95fd /crypto/drbg.c | |
parent | 44b933b9e1963a487bd97d2d94932e4cee6cbe9d (diff) |
crypto: drbg - cleanup of preprocessor macros
The structure used to construct the module description line was marked
problematic by the sparse code analysis tool. The module line
description now does not contain any ifdefs to prevent error reports
from sparse.
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Stephan Mueller <smueller@chronox.de>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/drbg.c')
-rw-r--r-- | crypto/drbg.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/crypto/drbg.c b/crypto/drbg.c index acc752373791..cce915b9d6bc 100644 --- a/crypto/drbg.c +++ b/crypto/drbg.c | |||
@@ -356,6 +356,7 @@ static inline void drbg_add_buf(unsigned char *dst, size_t dstlen, | |||
356 | ******************************************************************/ | 356 | ******************************************************************/ |
357 | 357 | ||
358 | #ifdef CONFIG_CRYPTO_DRBG_CTR | 358 | #ifdef CONFIG_CRYPTO_DRBG_CTR |
359 | #define CRYPTO_DRBG_CTR_STRING "CTR " | ||
359 | static int drbg_kcapi_sym(struct drbg_state *drbg, const unsigned char *key, | 360 | static int drbg_kcapi_sym(struct drbg_state *drbg, const unsigned char *key, |
360 | unsigned char *outval, const struct drbg_string *in); | 361 | unsigned char *outval, const struct drbg_string *in); |
361 | static int drbg_init_sym_kernel(struct drbg_state *drbg); | 362 | static int drbg_init_sym_kernel(struct drbg_state *drbg); |
@@ -717,6 +718,7 @@ static int drbg_fini_hash_kernel(struct drbg_state *drbg); | |||
717 | #endif /* (CONFIG_CRYPTO_DRBG_HASH || CONFIG_CRYPTO_DRBG_HMAC) */ | 718 | #endif /* (CONFIG_CRYPTO_DRBG_HASH || CONFIG_CRYPTO_DRBG_HMAC) */ |
718 | 719 | ||
719 | #ifdef CONFIG_CRYPTO_DRBG_HMAC | 720 | #ifdef CONFIG_CRYPTO_DRBG_HMAC |
721 | #define CRYPTO_DRBG_HMAC_STRING "HMAC " | ||
720 | /* update function of HMAC DRBG as defined in 10.1.2.2 */ | 722 | /* update function of HMAC DRBG as defined in 10.1.2.2 */ |
721 | static int drbg_hmac_update(struct drbg_state *drbg, struct list_head *seed, | 723 | static int drbg_hmac_update(struct drbg_state *drbg, struct list_head *seed, |
722 | int reseed) | 724 | int reseed) |
@@ -836,6 +838,7 @@ static struct drbg_state_ops drbg_hmac_ops = { | |||
836 | ******************************************************************/ | 838 | ******************************************************************/ |
837 | 839 | ||
838 | #ifdef CONFIG_CRYPTO_DRBG_HASH | 840 | #ifdef CONFIG_CRYPTO_DRBG_HASH |
841 | #define CRYPTO_DRBG_HASH_STRING "HASH " | ||
839 | /* | 842 | /* |
840 | * scratchpad usage: as drbg_hash_update and drbg_hash_df are used | 843 | * scratchpad usage: as drbg_hash_update and drbg_hash_df are used |
841 | * interlinked, the scratchpad is used as follows: | 844 | * interlinked, the scratchpad is used as follows: |
@@ -1867,7 +1870,7 @@ static inline int __init drbg_healthcheck_sanity(void) | |||
1867 | 1870 | ||
1868 | #ifdef CONFIG_CRYPTO_DRBG_CTR | 1871 | #ifdef CONFIG_CRYPTO_DRBG_CTR |
1869 | drbg_convert_tfm_core("drbg_nopr_ctr_aes128", &coreref, &pr); | 1872 | drbg_convert_tfm_core("drbg_nopr_ctr_aes128", &coreref, &pr); |
1870 | #elif CONFIG_CRYPTO_DRBG_HASH | 1873 | #elif defined CONFIG_CRYPTO_DRBG_HASH |
1871 | drbg_convert_tfm_core("drbg_nopr_sha256", &coreref, &pr); | 1874 | drbg_convert_tfm_core("drbg_nopr_sha256", &coreref, &pr); |
1872 | #else | 1875 | #else |
1873 | drbg_convert_tfm_core("drbg_nopr_hmac_sha256", &coreref, &pr); | 1876 | drbg_convert_tfm_core("drbg_nopr_hmac_sha256", &coreref, &pr); |
@@ -2009,16 +2012,19 @@ void __exit drbg_exit(void) | |||
2009 | 2012 | ||
2010 | module_init(drbg_init); | 2013 | module_init(drbg_init); |
2011 | module_exit(drbg_exit); | 2014 | module_exit(drbg_exit); |
2012 | MODULE_LICENSE("GPL"); | 2015 | #ifndef CRYPTO_DRBG_HASH_STRING |
2013 | MODULE_AUTHOR("Stephan Mueller <smueller@chronox.de>"); | 2016 | #define CRYPTO_DRBG_HASH_STRING "" |
2014 | MODULE_DESCRIPTION("NIST SP800-90A Deterministic Random Bit Generator (DRBG) using following cores:" | ||
2015 | #ifdef CONFIG_CRYPTO_DRBG_HMAC | ||
2016 | "HMAC " | ||
2017 | #endif | 2017 | #endif |
2018 | #ifdef CONFIG_CRYPTO_DRBG_HASH | 2018 | #ifndef CRYPTO_DRBG_HMAC_STRING |
2019 | "Hash " | 2019 | #define CRYPTO_DRBG_HMAC_STRING "" |
2020 | #endif | 2020 | #endif |
2021 | #ifdef CONFIG_CRYPTO_DRBG_CTR | 2021 | #ifndef CRYPTO_DRBG_CTR_STRING |
2022 | "CTR" | 2022 | #define CRYPTO_DRBG_CTR_STRING "" |
2023 | #endif | 2023 | #endif |
2024 | ); | 2024 | MODULE_LICENSE("GPL"); |
2025 | MODULE_AUTHOR("Stephan Mueller <smueller@chronox.de>"); | ||
2026 | MODULE_DESCRIPTION("NIST SP800-90A Deterministic Random Bit Generator (DRBG) " | ||
2027 | "using following cores: " | ||
2028 | CRYPTO_DRBG_HASH_STRING | ||
2029 | CRYPTO_DRBG_HMAC_STRING | ||
2030 | CRYPTO_DRBG_CTR_STRING); | ||