1 From e673e6ec09770b624d524bcd82f911e4fe2e2075 Mon Sep 17 00:00:00 2001
2 From: Cristian Stoica <cristian.stoica@freescale.com>
3 Date: Thu, 31 Oct 2013 13:27:28 +0200
4 Subject: [[Patch][fsl 05/16] add dst_len parameter to be provided by the user
6 Upstream-status: Pending
8 This allows the user to set the result length and relieves cryptodev
9 from making assumptions about it.
11 Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
12 Tested-by: Horia Ioan Geanta Neag <horia.geanta@freescale.com>
14 authenc.c | 13 +++----------
15 crypto/cryptodev.h | 1 +
16 2 files changed, 4 insertions(+), 10 deletions(-)
18 diff --git a/authenc.c b/authenc.c
19 index a183820..5235973 100644
22 @@ -199,7 +199,7 @@ static int fill_kcaop_from_caop(struct kernel_crypt_auth_op *kcaop, struct fcryp
23 kcaop->ivlen = caop->iv ? ses_ptr->cdata.ivsize : 0;
25 if (caop->flags & COP_FLAG_AEAD_TLS_TYPE)
26 - kcaop->dst_len = caop->len + ses_ptr->cdata.blocksize /* pad */ + caop->tag_len;
27 + kcaop->dst_len = caop->dst_len;
29 kcaop->dst_len = caop->len;
31 @@ -645,8 +645,6 @@ __crypto_auth_run_zc(struct csession *ses_ptr, struct kernel_crypt_auth_op *kcao
32 ret = tls_auth_n_crypt(ses_ptr, kcaop, auth_sg, caop->auth_len,
37 if (unlikely(ses_ptr->cdata.init == 0 ||
38 (ses_ptr->cdata.stream == 0 &&
39 ses_ptr->cdata.aead == 0))) {
40 @@ -655,13 +653,8 @@ __crypto_auth_run_zc(struct csession *ses_ptr, struct kernel_crypt_auth_op *kcao
44 - if (caop->op == COP_ENCRYPT)
45 - dst_len = caop->len + cryptodev_cipher_get_tag_size(&ses_ptr->cdata);
47 - dst_len = caop->len;
49 - ret = get_userbuf(ses_ptr, caop->src, caop->len, caop->dst, dst_len,
50 - kcaop->task, kcaop->mm, &src_sg, &dst_sg);
51 + ret = get_userbuf(ses_ptr, caop->src, caop->len, caop->dst,
52 + caop->dst_len, kcaop->task, kcaop->mm, &src_sg, &dst_sg);
54 derr(1, "get_userbuf(): Error getting user pages.");
56 diff --git a/crypto/cryptodev.h b/crypto/cryptodev.h
57 index c0e8cd4..3ea3d35 100644
58 --- a/crypto/cryptodev.h
59 +++ b/crypto/cryptodev.h
60 @@ -137,6 +137,7 @@ struct crypt_auth_op {
61 __u16 op; /* COP_ENCRYPT or COP_DECRYPT */
62 __u16 flags; /* see COP_FLAG_AEAD_* */
63 __u32 len; /* length of source data */
64 + __u32 dst_len; /* length of result data */
65 __u32 auth_len; /* length of auth data */
66 __u8 __user *auth_src; /* authenticated-only data */