---
name: "TPM_IO_Hash_End"
section: "3"
platform: "linux"
package: "libtpms"
version: "0.10.2-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/TPM_IO_Hash_Start"
---

# TPM\_IO\_Hash\_End(3)

indicate the beginging of a TPM TIS hash operation TPM\_IO\_Hash\_Data - hash the provided data TPM\_IO\_Hash\_End - indicate the end of a TPM TIS hash operation

Part of [TPM\_IO\_Hash\_Start(3)](/TPM_IO_Hash_Start/3.md).

## NAME

TPM\_IO\_Hash\_Start   - indicate the beginging of a TPM TIS hash operation

TPM\_IO\_Hash\_Data    - hash the provided data

TPM\_IO\_Hash\_End     - indicate the end of a TPM TIS hash operation

## LIBRARY

TPM library (libtpms, -ltpms)

## SYNOPSIS

**#include \<libtpms/tpm\_types.h**\>

**#include \<libtpms/tpm\_tis.h**\>

**#include \<libtpms/tpm\_error.h**\>

**TPM\_RESULT TPM\_IO\_Hash\_Start(void);**

**TPM\_RESULT TPM\_IO\_Hash\_Data(const unsigned char** \**data***,**\
                             **uint32\_t** *data\_length***);**

**TPM\_RESULT TPM\_IO\_Hash\_End(void);**

## DESCRIPTION

The **TPM\_IO\_Hash\_Start()** function can be used by an implementation of the TPM TIS hardware interface to indicate the beginning of a hash operation. Following the TPM TIS interface specification it resets several PCRs and terminates existing transport sessions.  The **TPM\_IO\_Hash\_Data()** function is used to send the data to be hashed to the TPM. The **TPM\_IO\_Hash\_End()** function calculates the final hash and stores it in the locality 4 PCR. The 3 functions must be called in the order they were explained.

The implementation of the above functions handles all TPM-internal actions such as the setting and clearing of permanent flags and PCRs and the calculation of the hash. Any functionality related to the TPM's TIS interface and the handling of flags, locality and state has to be implemented by the caller.

## ERRORS

- **TPM\_SUCCESS**

  The function completed successfully.

- **TPM\_FAIL**

  General failure.

- **TPM\_INVALID\_POSTINIT**

  The **TPM\_IO\_Hash\_Start()** function was called before the TPM received a TPM\_Startup command.

- **TPM\_SHA\_THREAD**

  The **TPM\_IO\_Hash\_Data()** or **TPM\_IO\_Hash\_End()** functions were called before the **TPM\_IO\_Hash\_Start()** function.

For a complete list of TPM error codes please consult the include file **libtpms/tpm\_error.h**

## SEE ALSO

[**TPMLIB\_MainInit**(3)](/TPMLIB_MainInit/3.md), [**TPMLIB\_Terminate**(3)](/TPMLIB_Terminate/3.md), [**TPMLIB\_RegisterCallbacks**(3)](/TPMLIB_RegisterCallbacks/3.md), [**TPMLIB\_Process**(3)](/TPMLIB_Process/3.md)
