---
name: "tpm2tss_tpm2data_read"
section: "3"
platform: "linux"
package: "tpm2-tss-engine"
version: "1.2.0-2"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/tpm2tss_tpm2data_read"
---

# tpm2tss\_tpm2data\_read(3)

read/write TPM2\_DATA

## NAME

**tpm2tss\_tpm2data\_write**, **tpm2tss\_tpm2data\_read** – read/write TPM2\_DATA

## SYNOPSIS

**#include \<tpm2tss.h\>**

\*\*int tpm2tss\_tpm2data\_read(const char \*filename, TPM2\_DATA **tpm2Datap);**

**int tpm2tss\_tpm2data\_write(const TPM2\_DATA** ***tpm2Data, const*** ***char*** **filename);**

## DESCRIPTION

**tpm2tss\_tpm2data\_read** reads the TPM2\_DATA object from a file called `filename`, allocates memory and stores it under the parameter `tpm2Datap`. Must be freed using the `free()` function.

**tpm2tss\_tpm2data\_write** writes the TPM2\_DATA object from the parameter `tpm2Data` to a newly created file called `filename`.

## RETURN VALUE

Upon successful completion **tpm2tss\_tpm2data\_write**() and **tpm2tss\_tpm2data\_read**() return 1. Otherwise 0.

### AUTHOR

Written by Andreas Fuchs.

### COPYRIGHT

tpm2tss is Copyright (C) 2018 Fraunhofer SIT sponsored by Infineon Technologies AG. License BSD 3-clause.

### SEE ALSO

[openssl(1)](/openssl/1.md)
