From 432299fce63c65a753c883318246d44b197813e7 Mon Sep 17 00:00:00 2001 From: Alexander Usyskin Date: Thu, 15 Jan 2026 08:34:18 +0200 Subject: [PATCH 1/5] MeTee: samples: add fw status print to cpp sample Print FW Status too in basic CPP sample. Signed-off-by: Alexander Usyskin --- samples/meteepp_basic.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/meteepp_basic.cpp b/samples/meteepp_basic.cpp index 8fb128b..e0d0002 100644 --- a/samples/meteepp_basic.cpp +++ b/samples/meteepp_basic.cpp @@ -122,6 +122,9 @@ int main(int argc, char* argv[]) std::cout << "Version: " << rsp->version.code.major << "." << rsp->version.code.minor << "." << rsp->version.code.hotFix << "." << rsp->version.code.buildNo << std::endl; + for (size_t i = 0; i < 6; i++) + std::cout << "FW Status " << i + 1 << " : " << metee.fw_status(i) << std::endl; + return 0; } catch (const intel::security::metee_exception& ex) { From ae83ae97730f8e3cc8df2798b7939946a42aafb5 Mon Sep 17 00:00:00 2001 From: Alexander Usyskin Date: Wed, 28 Jan 2026 13:52:57 +0200 Subject: [PATCH 2/5] MeTee: Linux: import libmei 1.8.2 Fix Android logging. Signed-off-by: Alexander Usyskin --- src/linux/mei.c | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/src/linux/mei.c b/src/linux/mei.c index 21cdee0..6b52191 100644 --- a/src/linux/mei.c +++ b/src/linux/mei.c @@ -1,7 +1,7 @@ /* * SPDX-License-Identifier: BSD-3-Clause * - * Copyright(c) 2013 - 2025 Intel Corporation. All rights reserved. + * Copyright(c) 2013 - 2026 Intel Corporation. All rights reserved. * * Intel Management Engine Interface (Intel MEI) Library */ @@ -23,27 +23,17 @@ /***************************************************************************** * Intel Management Engine Interface *****************************************************************************/ -#ifdef ANDROID -#define LOG_TAG "libmei" -#include -#define mei_msg(_me, fmt, ARGS...) \ -((_me->log_level >= MEI_LOG_LEVEL_VERBOSE) \ -? (void)ALOGV(fmt, ##ARGS) \ -: (void)0) - -#define mei_err(_me, fmt, ARGS...) ALOGE(fmt, ##ARGS) -#ifdef DEBUG -static inline void __dump_buffer(const char *buf) -{ - ALOGV("%s\n", buf); -} -#endif /* DEBUG */ - -#else /* ! ANDROID */ #ifdef SYSLOG - #include - #define __mei_msg(fmt, ...) syslog(LOG_DEBUG, fmt, ##__VA_ARGS__) - #define __mei_err(fmt, ...) syslog(LOG_ERR, fmt, ##__VA_ARGS__) + #ifdef ANDROID + #define LOG_TAG "libmei" + #include + #define __mei_msg(fmt, ...) ALOGV(fmt, ##__VA_ARGS__) + #define __mei_err(fmt, ...) ALOGE(fmt, ##__VA_ARGS__) + #else /* ANDROID */ + #include + #define __mei_msg(fmt, ...) syslog(LOG_DEBUG, fmt, ##__VA_ARGS__) + #define __mei_err(fmt, ...) syslog(LOG_ERR, fmt, ##__VA_ARGS__) + #endif /* ANDROID */ #else #include #define __mei_msg(fmt, ...) fprintf(stdout, fmt, ##__VA_ARGS__) @@ -80,10 +70,7 @@ static inline void __dump_buffer(const char *buf) { __mei_msg("%s\n", buf); } -#endif /* DEBUG */ -#endif /* ANDROID */ -#ifdef DEBUG static void dump_hex_buffer(const unsigned char *buf, size_t len) { #define LINE_LEN 16 From c6a603f3fb5c2063066a32c30e3990c969dda6a2 Mon Sep 17 00:00:00 2001 From: Alexander Usyskin Date: Wed, 28 Jan 2026 13:58:14 +0200 Subject: [PATCH 3/5] MeTee: reshuffle log macros Reshuffle log macros to have same SYSLOG parameter behavior for all OSes. With SYSLOG parameter enabled the os-specific log is used, otherwise the logs are printed to stdout/stderr. Signed-off-by: Alexander Usyskin --- include/helpers.h | 91 +++++++++++++++------------------- src/Windows/metee_winhelpers.c | 6 +-- 2 files changed, 42 insertions(+), 55 deletions(-) diff --git a/include/helpers.h b/include/helpers.h index 7be7a8f..65cb541 100644 --- a/include/helpers.h +++ b/include/helpers.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* - * Copyright (C) 2014-2025 Intel Corporation + * Copyright (C) 2014-2026 Intel Corporation */ #ifndef __HELPERS_H #define __HELPERS_H @@ -9,6 +9,18 @@ extern "C" { #endif #define DEBUG_MSG_LEN 1024 +#if DEBUG + #define TEE_DEFAULT_LOG_LEVEL TEE_LOG_LEVEL_VERBOSE +#else + #define TEE_DEFAULT_LOG_LEVEL TEE_LOG_LEVEL_QUIET +#endif + +#ifdef EFI + #define DEBUG_PRINT_ME_PREFIX_INTERNAL "TEELIB: (%a:%a():%d) " +#else /* EFI */ + #define DEBUG_PRINT_ME_PREFIX_INTERNAL "TEELIB: (%s:%s():%d) " +#endif /* EFI */ +#define DEBUG_PRINT_ME_PREFIX_EXTERNAL "TEELIB: (%s:%s():%d) " #ifdef _WIN32 #include @@ -16,61 +28,12 @@ extern "C" { #include #include "metee.h" - #if _DEBUG - #define TEE_DEFAULT_LOG_LEVEL TEE_LOG_LEVEL_VERBOSE - #else - #define TEE_DEFAULT_LOG_LEVEL TEE_LOG_LEVEL_QUIET - #endif - #define DEBUG_PRINT_ME_PREFIX_EXTERNAL "TEELIB: (%s:%s():%d) " - #define DEBUG_PRINT_ME_PREFIX_INTERNAL "TEELIB: (%s:%s():%d) " - #define MALLOC(X) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, X) #define FREE(X) {if(X) { HeapFree(GetProcessHeap(), 0, X); X = NULL ; } } - void DebugPrintMe(const char* args, ...); - - #define ErrorPrintMe(fmt, ...) DebugPrintMe(fmt, __VA_ARGS__) #define IS_HANDLE_INVALID(h) (NULL == h || 0 == h->handle || INVALID_HANDLE_VALUE == h->handle) #define INIT_STATUS TEE_INTERNAL_ERROR -#elif defined(EFI) - #define DEBUG_PRINT_ME_PREFIX_INTERNAL "TEELIB: (%a:%a():%d) " - #define DEBUG_PRINT_ME_PREFIX_EXTERNAL "TEELIB: (%s:%s():%d) " - #define DebugPrintMe(fmt, ...) AsciiPrint(fmt, ##__VA_ARGS__) - #define ErrorPrintMe(fmt, ...) AsciiPrint(fmt, ##__VA_ARGS__) #else - #define DEBUG_PRINT_ME_PREFIX_INTERNAL "TEELIB: (%s:%s():%d) " - #define DEBUG_PRINT_ME_PREFIX_EXTERNAL "TEELIB: (%s:%s():%d) " - #ifdef ANDROID - // For debugging - //#define LOG_NDEBUG 0 - #define LOG_TAG "metee" - #include - #define DebugPrintMe(fmt, ...) ALOGV(fmt, ##__VA_ARGS__) - #define ErrorPrintMe(fmt, ...) ALOGE(fmt, ##__VA_ARGS__) - #ifdef LOG_NDEBUG - #define TEE_DEFAULT_LOG_LEVEL TEE_LOG_LEVEL_VERBOSE - #else - #define TEE_DEFAULT_LOG_LEVEL TEE_LOG_LEVEL_QUIET - #endif - #else /* LINUX */ - #ifdef SYSLOG - #include - #define DebugPrintMe(fmt, ...) syslog(LOG_DEBUG, fmt, ##__VA_ARGS__) - #define ErrorPrintMe(fmt, ...) syslog(LOG_ERR, fmt, ##__VA_ARGS__) - #else - #include - #define DebugPrintMe(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__) - #define ErrorPrintMe(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__) - #endif /* SYSLOG */ - - #ifdef DEBUG - #define TEE_DEFAULT_LOG_LEVEL TEE_LOG_LEVEL_VERBOSE - #else - #define TEE_DEFAULT_LOG_LEVEL TEE_LOG_LEVEL_QUIET - #endif - - #endif /* ANDROID */ - #define MALLOC(X) malloc(X) #define FREE(X) { if(X) { free(X); X = NULL ; } } @@ -78,6 +41,34 @@ extern "C" { #define INIT_STATUS -EPERM #endif /* _WIN32 */ +#if SYSLOG + #ifdef _WIN32 + void DebugPrintMe(const char* args, ...); + #define ErrorPrintMe(fmt, ...) DebugPrintMe(fmt, __VA_ARGS__) + #elif defined(ANDROID) + #define LOG_TAG "metee" + #include + #define DebugPrintMe(fmt, ...) ALOGV(fmt, ##__VA_ARGS__) + #define ErrorPrintMe(fmt, ...) ALOGE(fmt, ##__VA_ARGS__) + #elif defined(EFI) + #define DebugPrintMe(fmt, ...) AsciiPrint(fmt, ##__VA_ARGS__) + #define ErrorPrintMe(fmt, ...) AsciiPrint(fmt, ##__VA_ARGS__) + #else + #include + #define DebugPrintMe(fmt, ...) syslog(LOG_DEBUG, fmt, ##__VA_ARGS__) + #define ErrorPrintMe(fmt, ...) syslog(LOG_ERR, fmt, ##__VA_ARGS__) + #endif +#else /* SYSLOG */ + #ifdef EFI + #define DebugPrintMe(fmt, ...) AsciiPrint(fmt, ##__VA_ARGS__) + #define ErrorPrintMe(fmt, ...) AsciiPrint(fmt, ##__VA_ARGS__) + #else + #include + #define DebugPrintMe(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__) + #define ErrorPrintMe(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__) + #endif +#endif /* SYSLOG */ + #define LEGACY_CALLBACK_SET(h) ((h)->log_callback ? 1 : 0) #define STANDARD_CALLBACK_SET(h) ((h)->log_callback2 ? 1 : 0) diff --git a/src/Windows/metee_winhelpers.c b/src/Windows/metee_winhelpers.c index 439fef7..503a256 100644 --- a/src/Windows/metee_winhelpers.c +++ b/src/Windows/metee_winhelpers.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* - * Copyright (C) 2014-2025 Intel Corporation + * Copyright (C) 2014-2026 Intel Corporation */ #include #include @@ -23,11 +23,7 @@ void DebugPrintMe(const char* args, ...) vsprintf_s(msg, DEBUG_MSG_LEN, args, varl); va_end(varl); -#ifdef SYSLOG OutputDebugStringA(msg); -#else - fprintf(stderr, "%s", msg); -#endif /* SYSLOG */ } void CallbackPrintHelper(IN PTEEHANDLE handle, bool is_error, const char* args, ...) From 0f82578a10fc79e7c1cc1d3e97bb175f21b9ed72 Mon Sep 17 00:00:00 2001 From: "Briskman, Yitzhak" Date: Thu, 15 Jan 2026 10:53:03 +0200 Subject: [PATCH 4/5] MeTee: EFI: introduce new define to enable stdlib support add stdlib support to print callback Signed-off-by: Briskman, Yitzhak --- README.md | 4 ++++ src/uefi/metee_efi.c | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/README.md b/README.md index bbe8122..8081359 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,10 @@ By default, CMake links with dynamic runtime (/MD), set BUILD_MSVC_RUNTIME_STATI 2. Run `cmake ` from the `build` directory 3. Run `make -j$(nproc) package` from the `build` directory to build .deb and .rpm packages and .tgz archive +### EFI + +When building application with C Standard support, add following preprocessor variable to build options + `METEE_EFI_STDLIB_SUPPORT` ## Meson Build diff --git a/src/uefi/metee_efi.c b/src/uefi/metee_efi.c index d6659d3..0b9b783 100644 --- a/src/uefi/metee_efi.c +++ b/src/uefi/metee_efi.c @@ -2,6 +2,10 @@ /* * Copyright (C) 2024-2025 Intel Corporation */ + +#ifdef METEE_EFI_STDLIB_SUPPORT + #include +#endif #include #include #include @@ -97,7 +101,11 @@ void CallbackPrintHelper(IN PTEEHANDLE handle, bool is_error, const char* args, char msg[DEBUG_MSG_LEN + 1]; VA_LIST varl; VA_START(varl, args); +#ifdef METEE_EFI_STDLIB_SUPPORT + vsnprintf(msg, DEBUG_MSG_LEN, args, varl); +#else AsciiVSPrint(msg, DEBUG_MSG_LEN, args, varl); +#endif VA_END(varl); handle->log_callback2(is_error, msg); } From 9bb9c76b7cc974cabb9e341cc6324ba37ec8548e Mon Sep 17 00:00:00 2001 From: Alexander Usyskin Date: Sun, 1 Feb 2026 14:57:08 +0200 Subject: [PATCH 5/5] MeTee: bump version to 6.2.2 Update CHANGELOG.md Signed-off-by: Alexander Usyskin --- CHANGELOG.md | 10 ++++++++++ VERSION | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 105ab2b..5fedc8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [6.2.2] + +### Changed + - reshuffle log macros + - Linux: import libmei 1.8.2 + +### Added + - samples: add fw status print to cpp sample + - EFI: introduce new define to enable stdlib support + ## [6.2.1] ### Fixed diff --git a/VERSION b/VERSION index 024b066..ca06394 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.2.1 +6.2.2