Commit 3696e851 authored by Gilad Ben-Yossef's avatar Gilad Ben-Yossef Committed by Greg Kroah-Hartman
Browse files

staging: ccree: fix hash naming convention



The hash files were using a naming convention which was inconsistent
(ssi vs. cc), included a useless prefix (ssi_hash) and often used too
long function names producing monster such as
ssi_ahash_get_initial_digest_len_sram_addr() that made the call site
hard to read.

Make the code more readable by switching to a simpler, consistent naming
convention for the file.

Signed-off-by: default avatarGilad Ben-Yossef <gilad@benyossef.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7a457d23
Loading
Loading
Loading
Loading
+3 −7
Original line number Diff line number Diff line
@@ -1023,9 +1023,7 @@ static void cc_set_hmac_desc(struct aead_request *req, struct cc_hw_desc desc[],
	/* Load init. digest len (64 bytes) */
	hw_desc_init(&desc[idx]);
	set_cipher_mode(&desc[idx], hash_mode);
	set_din_sram(&desc[idx],
		     ssi_ahash_get_initial_digest_len_sram_addr(ctx->drvdata,
								hash_mode),
	set_din_sram(&desc[idx], cc_digest_len_addr(ctx->drvdata, hash_mode),
		     HASH_LEN_SIZE);
	set_flow_mode(&desc[idx], S_DIN_to_HASH);
	set_setup_mode(&desc[idx], SETUP_LOAD_KEY0);
@@ -1152,9 +1150,7 @@ static void cc_proc_scheme_desc(struct aead_request *req,
	/* Load init. digest len (64 bytes) */
	hw_desc_init(&desc[idx]);
	set_cipher_mode(&desc[idx], hash_mode);
	set_din_sram(&desc[idx],
		     ssi_ahash_get_initial_digest_len_sram_addr(ctx->drvdata,
								hash_mode),
	set_din_sram(&desc[idx], cc_digest_len_addr(ctx->drvdata, hash_mode),
		     HASH_LEN_SIZE);
	set_cipher_config1(&desc[idx], HASH_PADDING_ENABLED);
	set_flow_mode(&desc[idx], S_DIN_to_HASH);
+4 −4
Original line number Diff line number Diff line
@@ -358,9 +358,9 @@ static int init_cc_resources(struct platform_device *plat_dev)
	}

	/* hash must be allocated before aead since hash exports APIs */
	rc = ssi_hash_alloc(new_drvdata);
	rc = cc_hash_alloc(new_drvdata);
	if (rc) {
		dev_err(dev, "ssi_hash_alloc failed\n");
		dev_err(dev, "cc_hash_alloc failed\n");
		goto post_cipher_err;
	}

@@ -379,7 +379,7 @@ static int init_cc_resources(struct platform_device *plat_dev)
	return 0;

post_hash_err:
	ssi_hash_free(new_drvdata);
	cc_hash_free(new_drvdata);
post_cipher_err:
	ssi_ablkcipher_free(new_drvdata);
post_ivgen_err:
@@ -417,7 +417,7 @@ static void cleanup_cc_resources(struct platform_device *plat_dev)
		(struct ssi_drvdata *)platform_get_drvdata(plat_dev);

	cc_aead_free(drvdata);
	ssi_hash_free(drvdata);
	cc_hash_free(drvdata);
	ssi_ablkcipher_free(drvdata);
	ssi_ivgen_fini(drvdata);
	cc_pm_fini(drvdata);
+241 −253

File changed.

Preview size limit exceeded, changes collapsed.

+8 −8
Original line number Diff line number Diff line
@@ -27,12 +27,12 @@
#define HMAC_OPAD_CONST	0x5C5C5C5C
#if (DX_DEV_SHA_MAX > 256)
#define HASH_LEN_SIZE 16
#define SSI_MAX_HASH_DIGEST_SIZE	SHA512_DIGEST_SIZE
#define SSI_MAX_HASH_BLCK_SIZE SHA512_BLOCK_SIZE
#define CC_MAX_HASH_DIGEST_SIZE	SHA512_DIGEST_SIZE
#define CC_MAX_HASH_BLCK_SIZE SHA512_BLOCK_SIZE
#else
#define HASH_LEN_SIZE 8
#define SSI_MAX_HASH_DIGEST_SIZE	SHA256_DIGEST_SIZE
#define SSI_MAX_HASH_BLCK_SIZE SHA256_BLOCK_SIZE
#define CC_MAX_HASH_DIGEST_SIZE	SHA256_DIGEST_SIZE
#define CC_MAX_HASH_BLCK_SIZE SHA256_BLOCK_SIZE
#endif

#define XCBC_MAC_K1_OFFSET 0
@@ -75,9 +75,9 @@ struct ahash_req_ctx {
	struct mlli_params mlli_params;
};

int ssi_hash_alloc(struct ssi_drvdata *drvdata);
int ssi_hash_init_sram_digest_consts(struct ssi_drvdata *drvdata);
int ssi_hash_free(struct ssi_drvdata *drvdata);
int cc_hash_alloc(struct ssi_drvdata *drvdata);
int cc_init_hash_sram(struct ssi_drvdata *drvdata);
int cc_hash_free(struct ssi_drvdata *drvdata);

/*!
 * Gets the initial digest length
@@ -89,7 +89,7 @@ int ssi_hash_free(struct ssi_drvdata *drvdata);
 * \return u32 returns the address of the initial digest length in SRAM
 */
ssi_sram_addr_t
ssi_ahash_get_initial_digest_len_sram_addr(void *drvdata, u32 mode);
cc_digest_len_addr(void *drvdata, u32 mode);

/*!
 * Gets the address of the initial digest in SRAM
+1 −1
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ int cc_pm_resume(struct device *dev)
	}

	/* must be after the queue resuming as it uses the HW queue*/
	ssi_hash_init_sram_digest_consts(drvdata);
	cc_init_hash_sram(drvdata);

	ssi_ivgen_init_sram_pool(drvdata);
	return 0;