diff --git a/CHANGELOG.md b/CHANGELOG.md index ac71298..6c13e43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [6.0.1] +- EFI: prefix internal function +- Windows: add newlines to error messages + ## [6.0.0] **Note:** Backward incompatible ABI change: diff --git a/VERSION b/VERSION index 09b254e..5fe6072 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.0.0 +6.0.1 diff --git a/src/Windows/metee_win.c b/src/Windows/metee_win.c index fd3ce97..525007d 100644 --- a/src/Windows/metee_win.c +++ b/src/Windows/metee_win.c @@ -141,7 +141,7 @@ static TEESTATUS TeeInitFullInt(IN OUT PTEEHANDLE handle, IN const GUID* guid, impl_handle = (struct METEE_WIN_IMPL*)malloc(sizeof(*impl_handle)); if (impl_handle == NULL) { status = TEE_INTERNAL_ERROR; - ERRPRINT(handle, "Can't allocate memory for internal struct"); + ERRPRINT(handle, "Can't allocate memory for internal struct\n"); goto Cleanup; } memset(impl_handle, 0, sizeof(*impl_handle)); @@ -407,7 +407,7 @@ TEESTATUS TEEAPI TeeWrite(IN PTEEHANDLE handle, IN const void* buffer, IN size_t if (NULL == impl_handle || NULL == buffer || 0 == bufferSize) { status = TEE_INVALID_PARAMETER; - ERRPRINT(handle, "One of the parameters was illegal"); + ERRPRINT(handle, "One of the parameters was illegal\n"); goto Cleanup; } @@ -419,7 +419,7 @@ TEESTATUS TEEAPI TeeWrite(IN PTEEHANDLE handle, IN const void* buffer, IN size_t if (impl_handle->state != METEE_CLIENT_STATE_CONNECTED) { status = TEE_DISCONNECTED; - ERRPRINT(handle, "The client is not connected"); + ERRPRINT(handle, "The client is not connected\n"); goto Cleanup; } @@ -468,12 +468,12 @@ TEESTATUS TEEAPI TeeFWStatus(IN PTEEHANDLE handle, if (NULL == impl_handle || NULL == fwStatus) { status = TEE_INVALID_PARAMETER; - ERRPRINT(handle, "One of the parameters was illegal"); + ERRPRINT(handle, "One of the parameters was illegal\n"); goto Cleanup; } if (fwStatusNum > 5) { status = TEE_INVALID_PARAMETER; - ERRPRINT(handle, "fwStatusNum should be 0..5"); + ERRPRINT(handle, "fwStatusNum should be 0..5\n"); goto Cleanup; } @@ -510,7 +510,7 @@ TEESTATUS TEEAPI TeeGetTRC(IN PTEEHANDLE handle, OUT uint32_t* trc_val) if (!impl_handle || !trc_val) { status = TEE_INVALID_PARAMETER; - ERRPRINT(handle, "One of the parameters was illegal"); + ERRPRINT(handle, "One of the parameters was illegal\n"); goto Cleanup; } @@ -617,7 +617,7 @@ TEESTATUS TEEAPI GetDriverVersion(IN PTEEHANDLE handle, IN OUT teeDriverVersion_ if (NULL == impl_handle || NULL == driverVersion) { status = TEE_INVALID_PARAMETER; - ERRPRINT(handle, "One of the parameters was illegal"); + ERRPRINT(handle, "One of the parameters was illegal\n"); goto Cleanup; } @@ -687,7 +687,7 @@ TEESTATUS TEEAPI TeeSetLogCallback(IN const PTEEHANDLE handle, TeeLogCallback lo if (NULL == impl_handle) { status = TEE_INVALID_PARAMETER; - ERRPRINT(handle, "One of the parameters was illegal"); + ERRPRINT(handle, "One of the parameters was illegal\n"); goto Cleanup; } if (handle->log_callback2) { @@ -717,7 +717,7 @@ TEESTATUS TEEAPI TeeSetLogCallback2(IN const PTEEHANDLE handle, TeeLogCallback2 if (NULL == impl_handle) { status = TEE_INVALID_PARAMETER; - ERRPRINT(handle, "One of the parameters was illegal"); + ERRPRINT(handle, "One of the parameters was illegal\n"); goto Cleanup; } if (handle->log_callback) { @@ -764,7 +764,7 @@ TEESTATUS TEEAPI TeeGetKind(IN PTEEHANDLE handle, IN OUT char *kind, IN OUT size if (NULL == impl_handle || NULL == kindSize) { status = TEE_INVALID_PARAMETER; - ERRPRINT(handle, "One of the parameters was illegal"); + ERRPRINT(handle, "One of the parameters was illegal\n"); goto Cleanup; } status = GetDeviceKind(handle, kind, kindSize); diff --git a/src/Windows/metee_winhelpers.c b/src/Windows/metee_winhelpers.c index 21deb4a..ba21e68 100644 --- a/src/Windows/metee_winhelpers.c +++ b/src/Windows/metee_winhelpers.c @@ -63,7 +63,7 @@ TEESTATUS BeginOverlappedInternal(IN TEE_OPERATION operation, IN PTEEHANDLE hand if (INVALID_HANDLE_VALUE == impl_handle->handle || NULL == buffer || 0 == bufferSize || NULL == evt) { status = TEE_INVALID_PARAMETER; - ERRPRINT(handle, "One of the parameters was illegal"); + ERRPRINT(handle, "One of the parameters was illegal\n"); goto Cleanup; } @@ -180,7 +180,7 @@ TEESTATUS GetDevicePath(IN PTEEHANDLE handle, IN LPCGUID InterfaceGuid, if (InterfaceGuid == NULL || path == NULL || pathSize < 1) { status = TEE_INTERNAL_ERROR; - ERRPRINT(handle, "One of the parameters was illegal"); + ERRPRINT(handle, "One of the parameters was illegal\n"); goto Cleanup; } @@ -199,7 +199,7 @@ TEESTATUS GetDevicePath(IN PTEEHANDLE handle, IN LPCGUID InterfaceGuid, if (deviceInterfaceListLength <= 1) { status = TEE_DEVICE_NOT_FOUND; - ERRPRINT(handle, "SetupDiGetClassDevs returned status %d", GetLastError()); + ERRPRINT(handle, "SetupDiGetClassDevs returned status %d\n", GetLastError()); goto Cleanup; } @@ -226,7 +226,7 @@ TEESTATUS GetDevicePath(IN PTEEHANDLE handle, IN LPCGUID InterfaceGuid, hr = StringCchCopyA(path, pathSize, deviceInterfaceList); if (FAILED(hr)) { status = TEE_INTERNAL_ERROR; - ERRPRINT(handle, "Error: StringCchCopy failed with HRESULT 0x%x", hr); + ERRPRINT(handle, "Error: StringCchCopy failed with HRESULT 0x%x\n", hr); goto Cleanup; } @@ -384,7 +384,7 @@ TEESTATUS SendIOCTL(IN PTEEHANDLE handle, IN EVENTHANDLE evt, IN DWORD ioControl if (INVALID_HANDLE_VALUE == impl_handle->handle || NULL == pBytesRetuned) { status = ERROR_INVALID_PARAMETER; - ERRPRINT(handle, "One of the parameters was illegal"); + ERRPRINT(handle, "One of the parameters was illegal\n"); goto Cleanup; } diff --git a/src/uefi/heci_efi.c b/src/uefi/heci_efi.c index 1df445a..6c449f0 100644 --- a/src/uefi/heci_efi.c +++ b/src/uefi/heci_efi.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation */ #include @@ -207,7 +207,7 @@ heciReset( } EFI_STATUS -HeciFwStatus( +EfiTeeHeciFwStatus( IN struct METEE_EFI_IMPL *Handle, IN UINT32 fwStatusNum, OUT UINT32 *fwStatus) @@ -245,7 +245,7 @@ HeciFwStatus( } EFI_STATUS -HeciGetTrc( +EfiTeeHeciGetTrc( IN struct METEE_EFI_IMPL *Handle, OUT UINT32 *trcVal) { @@ -271,7 +271,7 @@ HeciGetTrc( } EFI_STATUS -HeciUninitialize( +EfiTeeHeciUninitialize( IN struct METEE_EFI_IMPL *Handle) { EFI_STATUS status = EFI_UNSUPPORTED; @@ -317,7 +317,7 @@ HeciUninitialize( status = heciReadMsg(Handle, BLOCKING, (UINT32 *)&disconnectMsgReply, sizeof(disconnectMsgReply), &msgReplyLen); if (EFI_ERROR(status)) { - DBGPRINT(Handle->TeeHandle, "####HeciUninitialize failed with ReadMsg, Status: %d.\n", status); + DBGPRINT(Handle->TeeHandle, "####Failed with ReadMsg, Status: %d.\n", status); goto End; } DBGPRINT(Handle->TeeHandle, "#### disconnectMsgReply Command %02X , Status: %02X.\n", disconnectMsgReply.Command, disconnectMsgReply.Status); @@ -580,7 +580,7 @@ HeciDeviceEnumerateClients( EFI_STATUS -HeciConnectClient( +EfiTeeHeciConnectClient( IN struct METEE_EFI_IMPL *Handle) { EFI_STATUS status = EFI_UNSUPPORTED; @@ -734,7 +734,7 @@ HeciConnectClient( } EFI_STATUS -HeciSendMessage( +EfiTeeHeciSendMessage( IN struct METEE_EFI_IMPL *Handle, IN const UINT8 *buffer, IN UINT32 bufferLength, @@ -815,7 +815,7 @@ HeciSendMessage( } EFI_STATUS -HeciReceiveMessage( +EfiTeeHeciReceiveMessage( IN struct METEE_EFI_IMPL *Handle, OUT UINT8 *Buffer, IN UINT32 BufferSize, diff --git a/src/uefi/heci_efi.h b/src/uefi/heci_efi.h index ea67700..e227acc 100644 --- a/src/uefi/heci_efi.h +++ b/src/uefi/heci_efi.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation */ #ifndef HECI_EFI_H_ #define HECI_EFI_H_ @@ -8,11 +8,11 @@ #include "metee_efi.h" EFI_STATUS -HeciConnectClient( +EfiTeeHeciConnectClient( IN struct METEE_EFI_IMPL *Handle); EFI_STATUS -HeciReceiveMessage( +EfiTeeHeciReceiveMessage( IN struct METEE_EFI_IMPL *Handle, OUT UINT8 *Buffer, IN UINT32 BufferSize, @@ -20,7 +20,7 @@ HeciReceiveMessage( IN UINT32 timeout); EFI_STATUS -HeciSendMessage( +EfiTeeHeciSendMessage( IN struct METEE_EFI_IMPL *Handle, IN const UINT8 *buffer, IN UINT32 bufferLength, @@ -28,18 +28,18 @@ HeciSendMessage( IN UINT32 timeout); EFI_STATUS -HeciFwStatus( +EfiTeeHeciFwStatus( IN struct METEE_EFI_IMPL *Handle, IN UINT32 fwStatusNum, OUT UINT32 *fwStatus); EFI_STATUS -HeciGetTrc( +EfiTeeHeciGetTrc( IN struct METEE_EFI_IMPL *Handle, OUT UINT32 *trcVal); EFI_STATUS -HeciUninitialize( +EfiTeeHeciUninitialize( IN struct METEE_EFI_IMPL *Handle); #endif // HECI_EFI_H_ \ No newline at end of file diff --git a/src/uefi/metee_efi.c b/src/uefi/metee_efi.c index f5590f2..22c2d8f 100644 --- a/src/uefi/metee_efi.c +++ b/src/uefi/metee_efi.c @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: Apache-2.0 */ /* - * Copyright (C) 2024 Intel Corporation + * Copyright (C) 2024-2025 Intel Corporation */ #include #include @@ -346,7 +346,7 @@ TEESTATUS TEEAPI TeeConnect(OUT PTEEHANDLE handle) goto Cleanup; } - efi_status = HeciConnectClient(impl_handle); + efi_status = EfiTeeHeciConnectClient(impl_handle); if (EFI_ERROR(efi_status)) { switch (efi_status) @@ -407,7 +407,7 @@ TEESTATUS TEEAPI TeeRead(IN PTEEHANDLE handle, IN OUT void *buffer, IN size_t bu FUNC_ENTRY(handle); - // HeciReceiveMessage works only with uint32_t + // EfiTeeHeciReceiveMessage works only with uint32_t if (NULL == impl_handle || NULL == buffer || 0 == bufferSize || bufferSize > 0xFFFFFFFF) { status = TEE_INVALID_PARAMETER; @@ -421,7 +421,7 @@ TEESTATUS TEEAPI TeeRead(IN PTEEHANDLE handle, IN OUT void *buffer, IN size_t bu ERRPRINT(handle, "The client is not connected\n"); goto End; } - efi_status = HeciReceiveMessage(impl_handle, buffer, (UINT32)bufferSize, &bytesRead, timeout); + efi_status = EfiTeeHeciReceiveMessage(impl_handle, buffer, (UINT32)bufferSize, &bytesRead, timeout); if (EFI_ERROR(efi_status)) { @@ -471,7 +471,7 @@ TEESTATUS TEEAPI TeeWrite(IN PTEEHANDLE handle, IN const void *buffer, IN size_t FUNC_ENTRY(handle); - // HeciSendMessage works only with uint32_t + // EfiTeeHeciSendMessage works only with uint32_t if (NULL == impl_handle || NULL == buffer || 0 == bufferSize || bufferSize > 0xFFFFFFFF) { status = TEE_INVALID_PARAMETER; @@ -486,7 +486,7 @@ TEESTATUS TEEAPI TeeWrite(IN PTEEHANDLE handle, IN const void *buffer, IN size_t goto End; } - efi_status = HeciSendMessage(impl_handle, buffer, (UINT32)bufferSize, &bytesWritten, timeout); + efi_status = EfiTeeHeciSendMessage(impl_handle, buffer, (UINT32)bufferSize, &bytesWritten, timeout); if (EFI_ERROR(efi_status)) { @@ -538,7 +538,7 @@ TEESTATUS TEEAPI TeeFWStatus(IN PTEEHANDLE handle, status = TEE_INVALID_PARAMETER; goto End; } - efi_status = HeciFwStatus(impl_handle, fwStatusNum, fwStatus); + efi_status = EfiTeeHeciFwStatus(impl_handle, fwStatusNum, fwStatus); if (EFI_ERROR(efi_status)) { @@ -581,7 +581,7 @@ TEESTATUS TEEAPI TeeGetTRC(IN PTEEHANDLE handle, OUT uint32_t *trc_val) goto End; } - efi_status = HeciGetTrc(impl_handle, trc_val); + efi_status = EfiTeeHeciGetTrc(impl_handle, trc_val); if (EFI_ERROR(efi_status)) { @@ -615,7 +615,7 @@ void TEEAPI TeeDisconnect(IN PTEEHANDLE handle) goto Cleanup; } - HeciUninitialize(impl_handle); + EfiTeeHeciUninitialize(impl_handle); FreePool(impl_handle); impl_handle = NULL; @@ -825,7 +825,7 @@ TEESTATUS TEEAPI TeeGetKind(IN PTEEHANDLE handle, IN OUT char *kind, IN OUT size } if (impl_handle->HwType == HECI_HW_TYPE_PCH) { - efi_status = HeciFwStatus(impl_handle, HECI1_FW_STS3, &fw_sts3); + efi_status = EfiTeeHeciFwStatus(impl_handle, HECI1_FW_STS3, &fw_sts3); if (EFI_ERROR(efi_status)) { ERRPRINT(handle, "Failed to retrieve FW Status %d\n", efi_status);