summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Nie <jun.nie@linaro.org>2023-06-15 17:12:07 +0800
committerJun Nie <jun.nie@linaro.org>2023-06-16 17:10:26 +0800
commit706b2512d2213aed9e162b77d929db845dd0a297 (patch)
tree0a3adbe325d65a0ae43cbb084f91443b5b6ca308
parentbdb5e3d1d201d12146d6ec7c6c2b46744cc4a913 (diff)
fix parameter issue of TEE_CipherUpdate
Signed-off-by: Jun Nie <jun.nie@linaro.org>
-rw-r--r--ta/key_demo/key_demo.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/ta/key_demo/key_demo.c b/ta/key_demo/key_demo.c
index bab27c8..53e72cf 100644
--- a/ta/key_demo/key_demo.c
+++ b/ta/key_demo/key_demo.c
@@ -558,7 +558,8 @@ static TEE_Result ta2tee_key_size(uint32_t param, uint32_t *key_size)
#define TEST_CRYPT_SIZE 512
static char in_buf[TEST_CRYPT_SIZE];
-static char out_buf[TEST_CRYPT_SIZE];
+static char out_buf[TEST_CRYPT_SIZE * 2];
+size_t out_size;
TEE_Result ta_key_demo_create_key(uint32_t param_types,
TEE_Param params[4])
@@ -679,15 +680,19 @@ EMSG("-----------Open persistent object, res=0x%08x", result);
TEE_CipherInit(encrypt_op, IV, IVlen);
- TEE_MemFill(in_buf, 0xc5, TEST_CRYPT_SIZE);
-#if 0
+ //TEE_MemFill(in_buf, 0xc5, TEST_CRYPT_SIZE);
+ for (out_size = 0; out_size < TEST_CRYPT_SIZE; out_size++)
+ in_buf[out_size] = out_size;
+
+#if 1
/* we see panic in TEE_CipherUpdate() */
TEE_CipherUpdate(encrypt_op,
in_buf, TEST_CRYPT_SIZE,
- out_buf, TEST_CRYPT_SIZE);
+ out_buf, &out_size);
#endif
- EMSG("========Out buf [0] 0x%x [28] 0x%x.", out_buf[0], out_buf[28]);
+ EMSG("========Out size %d, buf [0] 0x%x [28] 0x%x [108] 0x%x.",
+ out_size, out_buf[0], out_buf[28], out_buf[108]);
TEE_Free(IV);
cleanup4: