Skip to content

Commit 6b32384

Browse files
add auth login as admin during SHE tests
1 parent faa19e7 commit 6b32384

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

test/wh_test_she.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ enum {
8181
#define FLASH_SECTOR_SIZE (128 * 1024) /* 128KB */
8282
#define FLASH_PAGE_SIZE (8) /* 8B */
8383

84+
#ifndef TEST_ADMIN_USERNAME
85+
#define TEST_ADMIN_USERNAME "admin"
86+
#endif
87+
#ifndef TEST_ADMIN_PIN
88+
#define TEST_ADMIN_PIN "1234"
89+
#endif
90+
8491
#ifdef WOLFHSM_CFG_ENABLE_CLIENT
8592
/* Helper function to destroy a SHE key so the unit tests don't
8693
* leak NVM objects across invocations. Necessary, as SHE doesn't expose a
@@ -164,6 +171,11 @@ int whTest_SheClientConfig(whClientConfig* config)
164171
WH_TEST_RETURN_ON_FAIL(wh_Client_Init(client, config));
165172
WH_TEST_RETURN_ON_FAIL(wh_Client_CommInit(client, &outClientId, &outServerId));
166173

174+
/* Attempt log in as an admin user for the rest of the tests */
175+
WH_TEST_RETURN_ON_FAIL(wh_Client_AuthLogin(client, WH_AUTH_METHOD_PIN,
176+
TEST_ADMIN_USERNAME, TEST_ADMIN_PIN, strlen(TEST_ADMIN_PIN),
177+
NULL, NULL));
178+
167179
#ifdef WOLFHSM_CFG_DEBUG_VERBOSE
168180
{
169181
int32_t server_rc = 0;

0 commit comments

Comments
 (0)