metee.h(3)
NAME π
okay bestie, welcome to the metee.h(3) Library Functions Manual page. The name is metee.h, and it is literally giving metee library API. That is the whole NAME moment, no cap. β¨
SYNOPSIS π¦
First, the includes β keep these exact, bestie:
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
Data Structures π
The struct cast is:
struct _TEEHANDLEstruct tee_device_addressstruct teeDriverVersion_t
Macros π
Copy these exactly, character for character:
#define TEEHANDLE_ZERO {0}
#define TEE_ERROR_BASE 0x0000U
#define TEE_SUCCESS (TEE_ERROR_BASE + 0)
#define TEE_INTERNAL_ERROR (TEE_ERROR_BASE + 1)
#define TEE_DEVICE_NOT_FOUND (TEE_ERROR_BASE + 2)
#define TEE_DEVICE_NOT_READY (TEE_ERROR_BASE + 3)
#define TEE_INVALID_PARAMETER (TEE_ERROR_BASE + 4)
#define TEE_UNABLE_TO_COMPLETE_OPERATION (TEE_ERROR_BASE + 5)
#define TEE_TIMEOUT (TEE_ERROR_BASE + 6)
#define TEE_NOTSUPPORTED (TEE_ERROR_BASE + 7)
#define TEE_CLIENT_NOT_FOUND (TEE_ERROR_BASE + 8)
#define TEE_BUSY (TEE_ERROR_BASE + 9)
#define TEE_DISCONNECTED (TEE_ERROR_BASE + 10)
#define TEE_INSUFFICIENT_BUFFER (TEE_ERROR_BASE + 11)
#define TEE_PERMISSION_DENIED (TEE_ERROR_BASE + 12)
#define TEE_IS_SUCCESS(Status)
Typedefs π§
The typedef lineup is:
typedef void(* TeeLogCallback) (bool is_error, const char *fmt,...)
typedef void(* TeeLogCallback2) (bool is_error, const char *msg)
typedef struct _TEEHANDLE TEEHANDLE
typedef TEEHANDLE * PTEEHANDLE
typedef uint16_t TEESTATUS
- Tiny note on
PTEEHANDLE: A type definition for pointer toTEEHANDLE. π«Ά
Enumerations β
enum tee_log_level { TEE_LOG_LEVEL_QUIET = 0, TEE_LOG_LEVEL_ERROR = 1,
TEE_LOG_LEVEL_VERBOSE = 2, TEE_LOG_LEVEL_MAX = 3 }
Functions π
Here is the whole function lineup, signatures verbatim β do not edit these, bestie:
TEESTATUS TEEAPI TeeInitFull (IN OUT PTEEHANDLE handle, IN const GUID
*guid, IN const struct tee_device_address device, IN uint32_t
log_level, IN OPTIONAL TeeLogCallback log_callback)
TEESTATUS TEEAPI TeeInitFull2 (IN OUT PTEEHANDLE handle, IN const GUID
*guid, IN const struct tee_device_address device, IN uint32_t
log_level, IN OPTIONAL TeeLogCallback2 log_callback)
TEESTATUS TEEAPI TeeInit (IN OUT PTEEHANDLE handle, IN const GUID *guid,
IN OPTIONAL const char *device)
TEESTATUS TEEAPI TeeInitHandle (IN OUT PTEEHANDLE handle, IN const GUID
*guid, IN const TEE_DEVICE_HANDLE device_handle)
TEESTATUS TEEAPI TeeConnect (OUT PTEEHANDLE handle)
TEESTATUS TEEAPI TeeRead (IN PTEEHANDLE handle, IN OUT void *buffer, IN
size_t bufferSize, OUT OPTIONAL size_t *pNumOfBytesRead, IN OPTIONAL
uint32_t timeout)
TEESTATUS TEEAPI TeeWrite (IN PTEEHANDLE handle, IN const void *buffer,
IN size_t bufferSize, OUT OPTIONAL size_t *numberOfBytesWritten, IN
OPTIONAL uint32_t timeout)
TEESTATUS TEEAPI TeeFWStatus (IN PTEEHANDLE handle, IN uint32_t
fwStatusNum, OUT uint32_t *fwStatus)
TEESTATUS TEEAPI TeeGetTRC (IN PTEEHANDLE handle, OUT uint32_t *trc_val)
void TEEAPI TeeDisconnect (IN PTEEHANDLE handle)
void TEEAPI TeeCancelIO (IN PTEEHANDLE handle)
TEE_DEVICE_HANDLE TEEAPI TeeGetDeviceHandle (IN PTEEHANDLE handle)
TEESTATUS TEEAPI GetDriverVersion (IN PTEEHANDLE handle, IN OUT
teeDriverVersion_t *driverVersion)
uint32_t TEEAPI TeeSetLogLevel (IN PTEEHANDLE handle, IN uint32_t
log_level)
uint32_t TEEAPI TeeGetLogLevel (IN const PTEEHANDLE handle)
TEESTATUS TEEAPI TeeSetLogCallback (IN const PTEEHANDLE handle,
TeeLogCallback log_callback)
TEESTATUS TEEAPI TeeSetLogCallback2 (IN const PTEEHANDLE handle,
TeeLogCallback2 log_callback)
uint32_t TEEAPI TeeGetMaxMsgLen (IN const PTEEHANDLE handle)
uint8_t TEEAPI TeeGetProtocolVer (IN const PTEEHANDLE handle)
TEESTATUS TEEAPI TeeGetKind (IN PTEEHANDLE handle, IN OUT char *kind, IN
OUT size_t *kindSize)
Detailed Description πΈ
metee library API.
Definition in file metee.h.
Macro Definition Documentation π
Every macro is getting its own little spotlight, and yes, we are keeping the line numbers. Periodt.
#define TEE_BUSY (TEE_ERROR_BASE + 9)
The device is busy. Definition at line 190 of file metee.h.
#define TEE_CLIENT_NOT_FOUND (TEE_ERROR_BASE + 8)
The ME client is not present in the firmware. Definition at line 188 of file metee.h.
#define TEE_DEVICE_NOT_FOUND (TEE_ERROR_BASE + 2)
The device is not in the system or is not working. Definition at line 176 of file metee.h.
#define TEE_DEVICE_NOT_READY (TEE_ERROR_BASE + 3)
The device is not ready for the operation. Definition at line 178 of file metee.h.
#define TEE_DISCONNECTED (TEE_ERROR_BASE + 10)
The ME client is not connected. Definition at line 192 of file metee.h.
#define TEE_ERROR_BASE 0x0000U
METEE ERROR BASE β the base, the blueprint, the 0x0000U. Definition at line 170 of file metee.h.
#define TEE_INSUFFICIENT_BUFFER (TEE_ERROR_BASE + 11)
The buffer for read is not big enough β your read buffer needs more room. Definition at line 194 of file metee.h.
#define TEE_INTERNAL_ERROR (TEE_ERROR_BASE + 1)
An internal error occurred in the library. Definition at line 174 of file metee.h.
#define TEE_INVALID_PARAMETER (TEE_ERROR_BASE + 4)
An invalid parameter was used in the call. Definition at line 180 of file metee.h.
#define TEE_IS_SUCCESS( Status)
Value:
(((TEESTATUS)(Status)) == TEE_SUCCESS)
Macro for successful operation result check. Definition at line 200 of file metee.h.
#define TEE_NOTSUPPORTED (TEE_ERROR_BASE + 7)
The operation is not supported. Definition at line 186 of file metee.h.
#define TEE_PERMISSION_DENIED (TEE_ERROR_BASE + 12)
The user doesn't have permission for this operation. Definition at line 196 of file metee.h.
#define TEE_SUCCESS (TEE_ERROR_BASE + 0)
METEE SUCCESS β the icon, the goal, the one. Definition at line 172 of file metee.h.
#define TEE_TIMEOUT (TEE_ERROR_BASE + 6)
The operation has timed out. Definition at line 184 of file metee.h.
#define TEE_UNABLE_TO_COMPLETE_OPERATION (TEE_ERROR_BASE + 5)
It is not possible to complete the operation. Definition at line 182 of file metee.h.
#define TEEHANDLE_ZERO {0}
ZERO/NULL device handle. Definition at line 166 of file metee.h.
Typedef Documentation π§
typedef TEEHANDLE* PTEEHANDLE
A type definition for pointer to TEEHANDLE. Definition at line 125 of file metee.h.
typedef struct _TEEHANDLE TEEHANDLE
Structure to store connection data.
typedef void(* TeeLogCallback) (bool is_error, const char *fmt,...)
log callback function format.
β οΈ Deprecated since version 6.0.
Definition at line 100 of file metee.h.
typedef void(* TeeLogCallback2) (bool is_error, const char *msg)
log callback function format. Definition at line 104 of file metee.h.
typedef uint16_t TEESTATUS
return status for API functions. Definition at line 168 of file metee.h.
Enumeration Type Documentation π₯
enum tee_log_level
log level.
Enumerator:
TEE_LOG_LEVEL_QUIETβ no log prints.TEE_LOG_LEVEL_ERRORβ error log prints.TEE_LOG_LEVEL_VERBOSEβ verbose log prints.TEE_LOG_LEVEL_MAXβ upper sentinel.
Definition at line 90 of file metee.h.
π FUNCTION DOCUMENTATION π
okay bestie, this is the part where we meet literally all the functions π each one gets its own little spotlight, and I'm keeping every param, every return value and every deprecation note because that's just how we do it π«Ά
πΈ GetDriverVersion
TEESTATUS TEEAPI GetDriverVersion (IN PTEEHANDLE handle, IN OUT teeDriverVersion_t * driverVersion)
Grabs the version of the TEE device driver β¨
heads up bestie: this one is not implemented on Linux π so don't come for me when it doesn't do the thing.
Parameters
handleβ the handle of the session πdriverVersionβ pointer to a driver version struct
Returns: 0 if successful, otherwise an error code π
π¦ TeeCancelIO
void TEEAPI TeeCancelIO (IN PTEEHANDLE handle)
It tries to stop all in-process reads and writes π key word tries, no cap.
Parameters
handleβ the handle of the session
π TeeConnect
TEESTATUS TEEAPI TeeConnect (OUT PTEEHANDLE handle)
Connects to the TEE driver and starts a whole session, main character energy from the jump π
Parameters
handleβ a handle to the TEE device
Returns: 0 if successful, otherwise an error code π
π TeeDisconnect
void TEEAPI TeeDisconnect (IN PTEEHANDLE handle)
Closes the session to the TEE driver πͺ
fr fr, call this the SECOND you're done with the device β other clients might literally be blocked until the session is closed π don't be that person.
Parameters
handleβ the handle of the session to close
β TeeFWStatus
TEESTATUS TEEAPI TeeFWStatus (IN PTEEHANDLE handle, IN uint32_t fwStatusNum, OUT uint32_t * fwStatus)
Pulls up the specified FW status register, like a little status checkup π
Parameters
handleβ the handle of the sessionfwStatusNumβ the FW status register number (0-5) π’fwStatusβ the memory to store the obtained FW status
Returns: 0 if successful, otherwise an error code π
π§ TeeGetDeviceHandle
TEE_DEVICE_HANDLE TEEAPI TeeGetDeviceHandle (IN PTEEHANDLE handle)
Returns the handle of the TEE device π« β it obtains a HECI device handle on Windows and an mei device file descriptor on Linux, iykyk.
Parameters
handleβ the handle of the session
Returns: the device handle π
π TeeGetKind
TEESTATUS TEEAPI TeeGetKind (IN PTEEHANDLE handle, IN OUT char * kind, IN OUT size_t * kindSize)
Obtains the kind of the TEE device β like a little vibe check on what this thing actually is π¦
Parameters
handleβ the handle of the sessionkindβ buffer to fill with the device kind as a null terminated string; may beNULLkindSizeβ pointer to the kind buffer size in bytes, updated on out to the number of bytes filled in the buffer, including the null character. If the buffer isNULL, the required size is returned anyway π
Returns: 0 if successful, otherwise an error code π
π TeeGetLogLevel
uint32_t TEEAPI TeeGetLogLevel (IN const PTEEHANDLE handle)
Retrieves the current log level π
Parameters
handleβ the handle of the session
Returns: the current log level β¨
π TeeGetMaxMsgLen
uint32_t TEEAPI TeeGetMaxMsgLen (IN const PTEEHANDLE handle)
Retrieves the client's maximum message length (the MTU, bestie) π
Parameters
handleβ the handle of the session
Returns: the client maximum message length. If the client never connected, it will return zero π
πΈ TeeGetProtocolVer
uint8_t TEEAPI TeeGetProtocolVer (IN const PTEEHANDLE handle)
Retrieves the client protocol version π·οΈ
Parameters
handleβ the handle of the session
Returns: the client protocol version. If the client never connected, it will return zero π
π₯ TeeGetTRC
TEESTATUS TEEAPI TeeGetTRC (IN PTEEHANDLE handle, OUT uint32_t * trc_val)
Retrieves the TRC register, periodt π
Parameters
handleβ the handle of the sessiontrc_valβ the memory to store the obtained TRC value
Returns: 0 if successful, otherwise an error code π
π TeeInit
TEESTATUS TEEAPI TeeInit (IN OUT PTEEHANDLE handle, IN const GUID * guid, IN OPTIONAL const char * device)
Initializes a TEE connection β the moment it all begins β¨
Parameters
handleβ a handle to the TEE device. All subsequent calls to the lib's functions must be with this handle πguidβ GUID of the FW client that wants to start a sessiondeviceβ optional device path, setNULLto use the default π
Returns: 0 if successful, otherwise an error code π
β TeeInitFull
TEESTATUS TEEAPI TeeInitFull (IN OUT PTEEHANDLE handle, IN const GUID * guid, IN const struct tee_device_address device, IN uint32_t log_level, IN OPTIONAL TeeLogCallback log_callback)
Initializes a TEE connection, the fuller version π«Ά
Deprecated β since version 6.0 π she's iconic but she's retired, bestie.
Parameters
handleβ a handle to the TEE device. All subsequent calls to the lib's functions must be with this handle πguidβ GUID of the FW client that wants to start a sessiondeviceβ device address structurelog_levelβ log level to set (fromenum tee_log_level)log_callbackβ pointer to function to run for log write, setNULLto use the built-in function
Returns: 0 if successful, otherwise an error code π
π TeeInitFull2
TEESTATUS TEEAPI TeeInitFull2 (IN OUT PTEEHANDLE handle, IN const GUID * guid, IN const struct tee_device_address device, IN uint32_t log_level, IN OPTIONAL TeeLogCallback2 log_callback)
Initializes a TEE connection β the sequel, and this one is not deprecated πβ¨
Parameters
handleβ a handle to the TEE device. All subsequent calls to the lib's functions must be with this handle πguidβ GUID of the FW client that wants to start a sessiondeviceβ device address structurelog_levelβ log level to set (fromenum tee_log_level)log_callbackβ pointer to function to run for log write, setNULLto use the built-in function
Returns: 0 if successful, otherwise an error code π
π§ TeeInitHandle
TEESTATUS TEEAPI TeeInitHandle (IN OUT PTEEHANDLE handle, IN const GUID * guid, IN const TEE_DEVICE_HANDLE device_handle)
Initializes a TEE connection, but you're bringing your own handle π
Parameters
handleβ a handle to the TEE device. All subsequent calls to the lib's functions must be with this handle πguidβ GUID of the FW client that wants to start a sessiondevice_handleβ open file handle
Returns: 0 if successful, otherwise an error code π
π¦ TeeRead
TEESTATUS TEEAPI TeeRead (IN PTEEHANDLE handle, IN OUT void * buffer, IN size_t bufferSize, OUT OPTIONAL size_t * pNumOfBytesRead, IN OPTIONAL uint32_t timeout)
Reads data from the TEE device synchronously π
Parameters
handleβ the handle of the session to read frombufferβ a pointer to a buffer that receives the data read from the TEE devicebufferSizeβ the number of bytes to be readpNumOfBytesReadβ a pointer to the variable that receives the number of bytes read; ignored if set toNULLπtimeoutβ the timeout to complete the read in milliseconds, zero for infinite β³
Returns: 0 if successful, otherwise an error code π
π TeeSetLogCallback
TEESTATUS TEEAPI TeeSetLogCallback (IN const PTEEHANDLE handle, TeeLogCallback log_callback)
Sets the log callback π
Deprecated β since version 6.0 π use the 2 one, bestie.
Parameters
handleβ the handle of the sessionlog_callbackβ pointer to function to run for log write, setNULLto use the built-in function
Returns: 0 if successful, otherwise an error code π
β TeeSetLogCallback2
TEESTATUS TEEAPI TeeSetLogCallback2 (IN const PTEEHANDLE handle, TeeLogCallback2 log_callback)
Sets the log callback β the current, non-deprecated glow-up version β¨
Parameters
handleβ the handle of the sessionlog_callbackβ pointer to function to run for log write, setNULLto use the built-in function
Returns: 0 if successful, otherwise an error code π
π₯ TeeSetLogLevel
uint32_t TEEAPI TeeSetLogLevel (IN PTEEHANDLE handle, IN uint32_t log_level)
Sets the log level ποΈ
Parameters
handleβ the handle of the sessionlog_levelβ log level to set
Returns: the previous log level π (yes, she remembers what you were before)
πΈ TeeWrite
TEESTATUS TEEAPI TeeWrite (IN PTEEHANDLE handle, IN const void * buffer, IN size_t bufferSize, OUT OPTIONAL size_t * numberOfBytesWritten, IN OPTIONAL uint32_t timeout)
Writes the specified buffer to the TEE device synchronously βοΈ
Parameters
handleβ the handle of the session to write tobufferβ a pointer to the buffer containing the data to be written to the TEE devicebufferSizeβ the number of bytes to be writtennumberOfBytesWrittenβ a pointer to the variable that receives the number of bytes written; ignored if set toNULLπtimeoutβ the timeout to complete the write in milliseconds, zero for infinite β³
Returns: 0 if successful, otherwise an error code π
π AUTHOR π
Generated automatically by Doxygen for metee from the source code π€β¨ like yes queen, the docs wrote themselves.
and that's a wrap on metee.h(3) bestie!! π This beauty comes from the metee source, version-tagged metee at the bottom with the date, and honestly? she ate. go forth, connect to your TEE driver, and remember to TeeDisconnect when you're done π
π mwah π«Ά
π¦ where this page comes from
- epel 10: intel-metee-devel 6.2.5-1.el10_3 Β· Apache-2.0 AND BSD-3-Clause AND ((GPL-2.0-only WITH Linux-syscall-note) OR BSD-3-Clause)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms