Fix stm32h5 test-app pkcs11 command

InitToken needs to be run before OpenSession.
pull/681/head
Mattia Moffa 2026-02-05 21:35:39 +01:00
parent 7258081216
commit 28f4de6a9c
1 changed files with 8 additions and 8 deletions

View File

@ -626,14 +626,6 @@ static int cmd_login_pkcs11(const char *args)
ret = wc_Pkcs11Token_Init(&token, &PKCS11_d, 1, "EccKey",
(const byte*)TokenPin, strlen(TokenPin));
if (ret == 0) {
printf("Done.\r\n");
printf("Retrieving crypto engine function list...");
fflush(stdout);
ret = wolfpkcs11nsFunctionList.C_OpenSession(1,
CKF_SERIAL_SESSION | CKF_RW_SESSION,
NULL, NULL, &session);
}
if (ret == 0) {
printf("Done.\r\n");
printf("Initializing token...");
@ -641,6 +633,14 @@ static int cmd_login_pkcs11(const char *args)
ret = wolfpkcs11nsFunctionList.C_InitToken(1,
(byte *)TokenPin, strlen(TokenPin), (byte *)SoPinName);
}
if (ret == 0) {
printf("Done.\r\n");
printf("Opening session...");
fflush(stdout);
ret = wolfpkcs11nsFunctionList.C_OpenSession(1,
CKF_SERIAL_SESSION | CKF_RW_SESSION,
NULL, NULL, &session);
}
if (ret == 0) {
printf("Done.\r\n");