From 9564e899e1cd737f6d024c9e73fe1a1885a0a3b6 Mon Sep 17 00:00:00 2001 From: Vincent JARDIN Date: Tue, 9 Feb 2021 17:59:53 +0000 Subject: [PATCH 1/2] OpenSC is missing C_SeedRandom Currently, OpenSC does not have any support for C_SeedRandom. So let's avoid test failures whenever the pkcs11 framework does not support this callback. --- tests/0270-oasis_Random.phpt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/0270-oasis_Random.phpt b/tests/0270-oasis_Random.phpt index 795d3a6..0a6481a 100644 --- a/tests/0270-oasis_Random.phpt +++ b/tests/0270-oasis_Random.phpt @@ -24,7 +24,8 @@ $rv = $module->C_OpenSession($s[0], Pkcs11\CKF_SERIAL_SESSION, null, null, $sess // TBC $session = new Pkcs11\Session($module, $s[0], Pkcs11\CKF_SERIAL_SESSION); # aka C_OpenSession() $rv = $module->C_SeedRandom($session, '1603soixantedix8'); -if ($rv === Pkcs11\CKR_RANDOM_SEED_NOT_SUPPORTED) +if (($rv === Pkcs11\CKR_RANDOM_SEED_NOT_SUPPORTED) || + ($rv === Pkcs11\CKR_FUNCTION_NOT_SUPPORTED)) $rv = 0; # XXX fake, ignore any smart cards that do not support SeedRandom var_dump($rv); From d852d70f96fa65931186689a41f65a278f16bec7 Mon Sep 17 00:00:00 2001 From: Vincent JARDIN Date: Tue, 9 Feb 2021 18:12:26 +0000 Subject: [PATCH 2/2] OpenSC: session handle can be any int While using PKCS11 module from OpenSC, the session handle is not always the same integer. --- tests/0280-oasis_FindObjects.phpt | 2 +- tests/0290-oasis_FindObjects.phpt | 2 +- tests/0291-oasis_FindObjects.phpt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/0280-oasis_FindObjects.phpt b/tests/0280-oasis_FindObjects.phpt index 3216728..385bee8 100644 --- a/tests/0280-oasis_FindObjects.phpt +++ b/tests/0280-oasis_FindObjects.phpt @@ -67,7 +67,7 @@ int(0) int(0) object(Pkcs11\Session)#2 (2) { ["hSession"]=> - int(1) + int(%d) ["slotID"]=> int(%d) } diff --git a/tests/0290-oasis_FindObjects.phpt b/tests/0290-oasis_FindObjects.phpt index 2ec4eaa..b93616f 100644 --- a/tests/0290-oasis_FindObjects.phpt +++ b/tests/0290-oasis_FindObjects.phpt @@ -130,7 +130,7 @@ int(0) int(0) object(Pkcs11\Session)#2 (2) { ["hSession"]=> - int(1) + int(%d) ["slotID"]=> int(%d) } diff --git a/tests/0291-oasis_FindObjects.phpt b/tests/0291-oasis_FindObjects.phpt index 39bd980..8433602 100644 --- a/tests/0291-oasis_FindObjects.phpt +++ b/tests/0291-oasis_FindObjects.phpt @@ -137,7 +137,7 @@ int(0) int(0) object(Pkcs11\Session)#2 (2) { ["hSession"]=> - int(1) + int(%d) ["slotID"]=> int(%d) }