crypto: caam - change key gen functions to return signed int
PATCH v2 1/2 crypto: caam - change key gen functions to return signed int
commit 2af8f4a "crypto: caam - coccicheck fixes" added error return values yet neglected to change the type from unsigned.
---
v1 posted here:
http://article.gmane.org/gmane.linux.kernel.cryptoapi/7664
v2: updated commit text with 'coccicheck fixes' commit id.
drivers/crypto/caam/caamhash.c | 4 ++-- drivers/crypto/caam/key_gen.c | 2 +- drivers/crypto/caam/key_gen.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/crypto/caam/caamhash.c +2 -2
@@ -411,7 +411,7 @@ static int ahash_set_sh_desc(struct crypto_ahash *ahash)return 0 ; } -static u32 gen_split_hash_key (struct caam_hash_ctx *ctx,const u8 *key_in, +static int gen_split_hash_key (struct caam_hash_ctx *ctx,const u8 *key_in,u32 keylen) { return gen_split_key(ctx->jrdev, ctx->key, ctx->split_key_len,
@@ -420,7 +420,7 @@ static u32 gen_split_hash_key(struct caam_hash_ctx *ctx, const u8 *key_in, }/* Digest hash size if it is too large */ -static u32 hash_digest_key (struct caam_hash_ctx *ctx,const u8 *key_in, +static int hash_digest_key (struct caam_hash_ctx *ctx,const u8 *key_in,u32 *keylen,u8 *key_out,u32 digestsize) {struct device *jrdev = ctx->jrdev;
drivers/crypto/caam/key_gen.c +1 -1
@@ -44,7 +44,7 @@ Split key generation-----------------------------------------------[06] 0x64260028 fifostr: class2 mdsplit-jdk len=40 @0xffe04000 */ -u32 gen_split_key (struct device *jrdev,u8 *key_out,int split_key_len, +int gen_split_key (struct device *jrdev,u8 *key_out,int split_key_len,int split_key_pad_len,const u8 *key_in,u32 keylen,u32 alg_op) {
drivers/crypto/caam/key_gen.h +1 -1
@@ -12,6 +12,6 @@ struct split_key_result {void split_key_done (struct device *dev,u32 *desc,u32 err,void *context); -u32 gen_split_key (struct device *jrdev,u8 *key_out,int split_key_len, +int gen_split_key (struct device *jrdev,u8 *key_out,int split_key_len,int split_key_pad_len,const u8 *key_in,u32 keylen,u32 alg_op);
Signature · 1 line
1.8.1.5
PATCH v2 2/2 v2 crypto: caam - static constify error data
checkstack reports report_deco_status(), report_ccb_status() as particularly excessive stack users. Move their lookup tables off the stack and put them in .rodata.
---
v1 posted here:
http://article.gmane.org/gmane.linux.kernel.cryptoapi/7571
v2: made cha_id_list, err_id_list, and rng_err_id_list
static const char * const, instead of just static const.
drivers/crypto/caam/error.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/crypto/caam/error.c +5 -5
@@ -36,7 +36,7 @@ static void report_jump_idx(u32 status, char *outstr)static void report_ccb_status (u32 status,char *outstr) { -char *cha_id_list[] = { +static const char *const cha_id_list[] = {"" ,"AES" ,"DES" ,
@@ -51,7 +51,7 @@ static void report_ccb_status(u32 status, char *outstr)"ZUCE" , "ZUCA", }; -char *err_id_list[] = { +static const char *const err_id_list[] = {"No error." ,"Mode error." , "Data size error.",
@@ -69,7 +69,7 @@ static void report_ccb_status(u32 status, char *outstr)"Invalid CHA combination was selected" , "Invalid CHA selected.", }; -char *rng_err_id_list[] = { +static const char *const rng_err_id_list[] = {"" ,"" , "",
@@ -117,7 +117,7 @@ static void report_jump_status(u32 status, char *outstr)static void report_deco_status (u32 status,char *outstr) { -const struct { +static const struct {u8 value;char *error_text; } desc_error_list[] = {
@@ -245,7 +245,7 @@ static void report_cond_code_status(u32 status, char *outstr)char *caam_jr_strstatus (char *outstr,u32 status) { -struct stat_src { +static const struct stat_src {void (*report_ssed)(u32 status,char *outstr);char *error; } status_src[] = {
Signature · 1 line
1.8.1.5
Quoted 4 lines · Kim Phillips
commit 2af8f4a "crypto: caam - coccicheck fixes" added error return values yet neglected to change the type from unsigned.
Signed-off-by Kim Phillips <[email protected]>
Both patches applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt