aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKim Phillips <kim.phillips@freescale.com>2012-06-22 20:42:38 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2012-06-27 02:42:03 -0400
commit991c569c5df68609b24a0aba5e5fd4879225c4cf (patch)
treea1d6177be775cd45fc8e7dc682892d262c8b97a1 /drivers
parentc4b664063ea5c007f05d2d23aa6edc9cfd385aa3 (diff)
crypto: caam - fix descriptor length adjustments for protocol descriptors
init_desc, by always ORing with 1 for the descriptor header inclusion into the descriptor length, and init_sh_desc_pdb, by always specifying the descriptor length modification for the PDB via options, would not allow for odd length PDBs to be embedded in the constructed descriptor length. Fix this by simply changing the OR to an addition. also round-up pdb_bytes to the next SEC command unit size, to allow for, e.g., optional packet header bytes that aren't a multiple of CAAM_CMD_SZ. Reported-by: Radu-Andrei BULIE <radu.bulie@freescale.com> Signed-off-by: Kim Phillips <kim.phillips@freescale.com> Cc: Yashpal Dutta <yashpal.dutta@freescale.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/crypto/caam/desc_constr.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/crypto/caam/desc_constr.h b/drivers/crypto/caam/desc_constr.h
index 0d31e27b18ea..8e1056fac681 100644
--- a/drivers/crypto/caam/desc_constr.h
+++ b/drivers/crypto/caam/desc_constr.h
@@ -51,7 +51,7 @@ static inline void *sh_desc_pdb(u32 *desc)
51 51
52static inline void init_desc(u32 *desc, u32 options) 52static inline void init_desc(u32 *desc, u32 options)
53{ 53{
54 *desc = options | HDR_ONE | 1; 54 *desc = (options | HDR_ONE) + 1;
55} 55}
56 56
57static inline void init_sh_desc(u32 *desc, u32 options) 57static inline void init_sh_desc(u32 *desc, u32 options)
@@ -62,7 +62,7 @@ static inline void init_sh_desc(u32 *desc, u32 options)
62 62
63static inline void init_sh_desc_pdb(u32 *desc, u32 options, size_t pdb_bytes) 63static inline void init_sh_desc_pdb(u32 *desc, u32 options, size_t pdb_bytes)
64{ 64{
65 u32 pdb_len = pdb_bytes / CAAM_CMD_SZ + 1; 65 u32 pdb_len = (pdb_bytes + CAAM_CMD_SZ - 1) / CAAM_CMD_SZ;
66 66
67 init_sh_desc(desc, (((pdb_len + 1) << HDR_START_IDX_SHIFT) + pdb_len) | 67 init_sh_desc(desc, (((pdb_len + 1) << HDR_START_IDX_SHIFT) + pdb_len) |
68 options); 68 options);