summaryrefslogtreecommitdiff
path: root/drivers/crypto
diff options
context:
space:
mode:
authorMallikarjun Kasoju <mkasoju@nvidia.com>2012-08-14 13:51:52 +0530
committerDan Willemsen <dwillemsen@nvidia.com>2013-09-14 00:48:22 -0700
commitc0532461fd42754e68f0836cab0f144e781d8fc2 (patch)
tree2ff4ec8ad04fb02f996fb731e7cad4eb95f7db8e /drivers/crypto
parent591d4195cd891b36e54f7cb111da125c9e866629 (diff)
crypto: tegra-se: Limit max bytes to process
Security Engine can process maximum of 0xFFFFF 16 byte blocks. Add check condition for the same. Bug 961700 Change-Id: Iade1abfd27a9b784de8e0a59f319d403a4beb187 Signed-off-by: Mallikarjun Kasoju <mkasoju@nvidia.com> Reviewed-on: http://git-master/r/123291 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Venkata Jagadish <vjagadish@nvidia.com> Reviewed-by: Venkat Moganty <vmoganty@nvidia.com> Rebase-Id: R5f63f4f627e2b5f73f45c0bf565e933a9484d374
Diffstat (limited to 'drivers/crypto')
-rw-r--r--drivers/crypto/tegra-se.c3
-rw-r--r--drivers/crypto/tegra-se.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/drivers/crypto/tegra-se.c b/drivers/crypto/tegra-se.c
index 96619154630c..e4df734914cb 100644
--- a/drivers/crypto/tegra-se.c
+++ b/drivers/crypto/tegra-se.c
@@ -597,6 +597,9 @@ static int tegra_se_start_operation(struct tegra_se_dev *se_dev, u32 nbytes,
int ret = 0;
u32 val = 0;
+ if (nblocks > SE_MAX_LAST_BLOCK_SIZE)
+ return -EINVAL;
+
/* clear any pending interrupts */
val = se_readl(se_dev, SE_INT_STATUS_REG_OFFSET);
se_writel(se_dev, val, SE_INT_STATUS_REG_OFFSET);
diff --git a/drivers/crypto/tegra-se.h b/drivers/crypto/tegra-se.h
index cd3e9ab2c590..98cb82544454 100644
--- a/drivers/crypto/tegra-se.h
+++ b/drivers/crypto/tegra-se.h
@@ -33,6 +33,7 @@
#define SE_MAX_DST_SG_COUNT 50
#define TEGRA_SE_KEYSLOT_COUNT 16
+#define SE_MAX_LAST_BLOCK_SIZE 0xFFFFF
/* SE register definitions */
#define SE_CONFIG_REG_OFFSET 0x014