Skip to content

Commit

Permalink
xtest: pkcs11: Add check that CK_TOKEN_INFO outputs correct CK_ULONG's
Browse files Browse the repository at this point in the history
OP-TEE's PKCS#11 TA TEE<->REE interface treats CK_ULONG's as 32 bit.

In 64 bit machines this creates a problem for CK_ULONG values that are
architecture dependent.

One of those defines is CK_UNAVAILABLE_INFORMATION.

This adds test case to make sure that when OP-TEE's PKCS#11 TA should give
CK_UNAVAILABLE_INFORMATION it actually does that.

Signed-off-by: Vesa Jääskeläinen <[email protected]>
  • Loading branch information
vesajaaskelainen committed Dec 6, 2023
1 parent 1033462 commit 8d225a5
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions host/xtest/pkcs11_1000.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,36 @@ static void xtest_pkcs11_test_1001(ADBG_Case_t *c)
if (!ADBG_EXPECT_CK_OK(c, rv))
goto out;

/**
* Verify that fields with CK_UNAVAILABLE_INFORMATION gets
* correct value
*/

if (!ADBG_EXPECT_COMPARE_UNSIGNED(c,
token_info.ulMaxSessionCount, ==,
CK_UNAVAILABLE_INFORMATION))
goto out;
if (!ADBG_EXPECT_COMPARE_UNSIGNED(c,
token_info.ulMaxRwSessionCount, ==,
CK_UNAVAILABLE_INFORMATION))
goto out;
if (!ADBG_EXPECT_COMPARE_UNSIGNED(c,
token_info.ulTotalPublicMemory, ==,
CK_UNAVAILABLE_INFORMATION))
goto out;
if (!ADBG_EXPECT_COMPARE_UNSIGNED(c,
token_info.ulFreePublicMemory, ==,
CK_UNAVAILABLE_INFORMATION))
goto out;
if (!ADBG_EXPECT_COMPARE_UNSIGNED(c,
token_info.ulTotalPrivateMemory, ==,
CK_UNAVAILABLE_INFORMATION))
goto out;
if (!ADBG_EXPECT_COMPARE_UNSIGNED(c,
token_info.ulFreePrivateMemory, ==,
CK_UNAVAILABLE_INFORMATION))
goto out;

if (max_slot_id < slot)
max_slot_id = slot;
}
Expand Down

0 comments on commit 8d225a5

Please sign in to comment.