xtest: pkcs11: C_SignUpdate()/C_VerifyUpdate() with null sized data
Add test case for checking that a call to C_SignUpdate()/
C_VerifyUpdate() with valid input buffer and size as 0 returns
no error and has no effect on output result.
Signed-off-by: Ruchika Gupta <ruchika.gupta@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
diff --git a/host/xtest/pkcs11_1000.c b/host/xtest/pkcs11_1000.c
index 82a620e..231939f 100644
--- a/host/xtest/pkcs11_1000.c
+++ b/host/xtest/pkcs11_1000.c
@@ -1597,6 +1597,12 @@
if (!ADBG_EXPECT_CK_OK(c, rv))
goto err_destr_obj;
+ /* Pass input buffer of size 0 */
+ rv = C_SignUpdate(session,
+ (void *)test->in, 0);
+ if (!ADBG_EXPECT_CK_OK(c, rv))
+ goto err_destr_obj;
+
rv = C_SignUpdate(session,
(void *)test->in, test->in_len);
if (!ADBG_EXPECT_CK_OK(c, rv))
@@ -1746,6 +1752,11 @@
if (!ADBG_EXPECT_CK_OK(c, rv))
goto err_destr_obj;
+ /* Pass input buffer with size 0 - No affect */
+ rv = C_VerifyUpdate(session, (void *)test->in, 0);
+ if (!ADBG_EXPECT_CK_OK(c, rv))
+ goto err_destr_obj;
+
rv = C_VerifyUpdate(session, (void *)test->in,
test->in_len);
if (!ADBG_EXPECT_CK_OK(c, rv))