diff --git a/CHANGELOG.md b/CHANGELOG.md index 47ad826..2c1b791 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +## [6.2.5] + +### Fixed + - Windows: TeeGetKind is not supported with handle + - samples: fix spelling + - tests: metepp: add connect retry + - CMake: install meteepp.h + +### Changed + - tests: bump CMake requred version to 3.15 + ## [6.2.4] ### Fixed diff --git a/VERSION b/VERSION index 42cc526..a6534bb 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.2.4 +6.2.5 diff --git a/samples/metee_connect.c b/samples/metee_connect.c index 6a1c72f..b2ccf27 100644 --- a/samples/metee_connect.c +++ b/samples/metee_connect.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* - * Copyright (C) 2014-2024 Intel Corporation + * Copyright (C) 2014-2026 Intel Corporation */ #include #include @@ -44,7 +44,7 @@ static int work(struct params *p) rsz = TeeGetMaxMsgLen(&cl); if (rsz == 0) { - fprintf(stderr, "client reproted zero MTU.\n"); + fprintf(stderr, "client reported zero MTU.\n"); goto out; } buf = (unsigned char *)malloc(rsz); diff --git a/samples/metee_gsc.c b/samples/metee_gsc.c index 942f342..07fefc5 100644 --- a/samples/metee_gsc.c +++ b/samples/metee_gsc.c @@ -270,7 +270,7 @@ static uint32_t mk_host_if_call(struct mk_host_if *acmd, if (in_buf_sz == 0) { if (acmd->verbose) - metee_gsc_err("mkhif: client reproted zero MTU.\n"); + metee_gsc_err("mkhif: client reported zero MTU.\n"); return GSC_FWU_STATUS_FAILURE; } *read_buf = (uint8_t *)metee_gsc_malloc(in_buf_sz); diff --git a/samples/metee_mkhi.c b/samples/metee_mkhi.c index dd15a16..67e46e5 100644 --- a/samples/metee_mkhi.c +++ b/samples/metee_mkhi.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* - * Copyright (C) 2012-2024 Intel Corporation + * Copyright (C) 2012-2026 Intel Corporation */ #include #include @@ -239,7 +239,7 @@ static uint32_t mk_host_if_call(struct mk_host_if *acmd, if (in_buf_sz == 0) { if (acmd->verbose) - fprintf(stderr, "mkhif: client reproted zero MTU.\n"); + fprintf(stderr, "mkhif: client reported zero MTU.\n"); return MKHI_STATUS_INTERNAL_ERROR; } *read_buf = (uint8_t *)malloc(in_buf_sz); diff --git a/src/Windows/metee_winhelpers.c b/src/Windows/metee_winhelpers.c index 628e0b3..3d3977e 100644 --- a/src/Windows/metee_winhelpers.c +++ b/src/Windows/metee_winhelpers.c @@ -279,6 +279,12 @@ TEESTATUS GetDeviceKind(IN PTEEHANDLE handle, IN OUT OPTIONAL char *kind, IN OUT FUNC_ENTRY(handle); + if (NULL == impl_handle->device_path) { + status = TEE_NOTSUPPORTED; + ERRPRINT(handle, "Device path is empty.\n"); + goto Cleanup; + } + size_t device_path_len = strlen(impl_handle->device_path) + 1; size_t device_path_size = device_path_len * sizeof(WCHAR); device_path_w = (WCHAR*)malloc(device_path_size); diff --git a/tests/gtest.cmake.in b/tests/gtest.cmake.in index c8de824..22609b1 100644 --- a/tests/gtest.cmake.in +++ b/tests/gtest.cmake.in @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 -# Copyright (C) 2014-2022 Intel Corporation -cmake_minimum_required(VERSION 3.1) +# Copyright (C) 2014-2026 Intel Corporation +cmake_minimum_required(VERSION 3.15) project(googletest-download NONE) diff --git a/tests/meteepp_test.cpp b/tests/meteepp_test.cpp index 8e72ed7..15012bb 100644 --- a/tests/meteepp_test.cpp +++ b/tests/meteepp_test.cpp @@ -1,12 +1,38 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* - * Copyright (C) 2021-2025 Intel Corporation + * Copyright (C) 2021-2026 Intel Corporation */ +#include +#include #include "metee_test.h" DEFINE_GUID(GUID_NON_EXISTS_CLIENT, 0x85eb8fa6, 0xbdd, 0x4d01, 0xbe, 0xc4, 0xa5, 0x97, 0x43, 0x4e, 0xd7, 0x62); +static constexpr int CONNECT_RETRIES = 3; + +namespace { + void meteepp_connect_retry(intel::security::metee& metee) + { + int retry = CONNECT_RETRIES; + + while (true) { + try { + metee.connect(); + return; + } + catch(const intel::security::metee_exception& ex) { + const auto code = ex.code().value(); + if ((--retry <= 0) || + (code != TEE_BUSY && + code != TEE_UNABLE_TO_COMPLETE_OPERATION)) + throw; + std::this_thread::sleep_for(std::chrono::seconds(2)); + } + } + } +} + TEST_P(MeTeePPTEST, PROD_MKHI_SimpleGetVersion) { struct MeTeeTESTParams intf = GetParam(); @@ -18,7 +44,7 @@ TEST_P(MeTeePPTEST, PROD_MKHI_SimpleGetVersion) intel::security::metee metee(*intf.client); ASSERT_NE(TEE_INVALID_DEVICE_HANDLE, metee.device_handle()); - metee.connect(); + meteepp_connect_retry(metee); ASSERT_EQ(MkhiRequest.size(), metee.write(MkhiRequest, 0)); @@ -69,7 +95,7 @@ TEST_P(MeTeePPTEST, PROD_MKHI_InitFull) intel::security::metee metee(*intf.client, device, TEE_LOG_LEVEL_VERBOSE); ASSERT_NE(TEE_INVALID_DEVICE_HANDLE, metee.device_handle()); - metee.connect(); + meteepp_connect_retry(metee); } catch (const intel::security::metee_exception& ex) { if (ex.code().value() == TEE_DEVICE_NOT_FOUND) @@ -85,7 +111,7 @@ TEST_P(MeTeePPTEST, PROD_N_TestConnectToNonExistsUuid) try { intel::security::metee metee(GUID_NON_EXISTS_CLIENT); ASSERT_NE(TEE_INVALID_DEVICE_HANDLE, metee.device_handle()); - metee.connect(); + meteepp_connect_retry(metee); } catch (const intel::security::metee_exception& ex) { if (ex.code().value() == TEE_DEVICE_NOT_FOUND) @@ -108,7 +134,7 @@ TEST_P(MeTeePPTEST, PROD_MKHI_MoveSemantics) try { intel::security::metee metee(*intf.client); ASSERT_NE(TEE_INVALID_DEVICE_HANDLE, metee.device_handle()); - metee.connect(); + meteepp_connect_retry(metee); metee2 = std::move(metee); } @@ -136,4 +162,4 @@ INSTANTIATE_TEST_SUITE_P(MeTeePPTESTInstance, MeTeePPTEST, testing::ValuesIn(interfaces), [](const testing::TestParamInfo& info) { return info.param.name; - }); \ No newline at end of file + });