Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.0
6.0.1
20 changes: 10 additions & 10 deletions src/Windows/metee_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions src/Windows/metee_winhelpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
16 changes: 8 additions & 8 deletions src/uefi/heci_efi.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: Apache-2.0 */
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*/

#include <Uefi.h>
Expand Down Expand Up @@ -207,7 +207,7 @@ heciReset(
}

EFI_STATUS
HeciFwStatus(
EfiTeeHeciFwStatus(
IN struct METEE_EFI_IMPL *Handle,
IN UINT32 fwStatusNum,
OUT UINT32 *fwStatus)
Expand Down Expand Up @@ -245,7 +245,7 @@ HeciFwStatus(
}

EFI_STATUS
HeciGetTrc(
EfiTeeHeciGetTrc(
IN struct METEE_EFI_IMPL *Handle,
OUT UINT32 *trcVal)
{
Expand All @@ -271,7 +271,7 @@ HeciGetTrc(
}

EFI_STATUS
HeciUninitialize(
EfiTeeHeciUninitialize(
IN struct METEE_EFI_IMPL *Handle)
{
EFI_STATUS status = EFI_UNSUPPORTED;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -580,7 +580,7 @@ HeciDeviceEnumerateClients(


EFI_STATUS
HeciConnectClient(
EfiTeeHeciConnectClient(
IN struct METEE_EFI_IMPL *Handle)
{
EFI_STATUS status = EFI_UNSUPPORTED;
Expand Down Expand Up @@ -734,7 +734,7 @@ HeciConnectClient(
}

EFI_STATUS
HeciSendMessage(
EfiTeeHeciSendMessage(
IN struct METEE_EFI_IMPL *Handle,
IN const UINT8 *buffer,
IN UINT32 bufferLength,
Expand Down Expand Up @@ -815,7 +815,7 @@ HeciSendMessage(
}

EFI_STATUS
HeciReceiveMessage(
EfiTeeHeciReceiveMessage(
IN struct METEE_EFI_IMPL *Handle,
OUT UINT8 *Buffer,
IN UINT32 BufferSize,
Expand Down
14 changes: 7 additions & 7 deletions src/uefi/heci_efi.h
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
/* 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_

#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,
OUT UINT32 *NumOfBytesRead,
IN UINT32 timeout);

EFI_STATUS
HeciSendMessage(
EfiTeeHeciSendMessage(
IN struct METEE_EFI_IMPL *Handle,
IN const UINT8 *buffer,
IN UINT32 bufferLength,
OUT UINT32 *BytesWritten,
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_
20 changes: 10 additions & 10 deletions src/uefi/metee_efi.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* SPDX-License-Identifier: Apache-2.0 */
/*
* Copyright (C) 2024 Intel Corporation
* Copyright (C) 2024-2025 Intel Corporation
*/
#include <Uefi.h>
#include <Library/UefiLib.h>
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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))
{
Expand Down Expand Up @@ -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;
Expand All @@ -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))
{
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -615,7 +615,7 @@ void TEEAPI TeeDisconnect(IN PTEEHANDLE handle)
goto Cleanup;
}

HeciUninitialize(impl_handle);
EfiTeeHeciUninitialize(impl_handle);

FreePool(impl_handle);
impl_handle = NULL;
Expand Down Expand Up @@ -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);
Expand Down