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

# FapiTestgroup(3)

Fapi-Testing

## NAME

FapiTestgroup - Fapi-Testing

## SYNOPSIS

### Functions

int **test\_fapi\_data\_crypt** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_duplicate** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_ext\_public\_key** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_get\_random** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_info** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_change\_auth** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_create\_ckda\_sign** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_create\_policies\_sign** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_create\_policy\_authorize\_nv** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_create\_policy\_authorize\_sign** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_create\_policy\_nv\_sign** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_create\_policy\_or\_sign** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_create\_policy\_pcr\_sign** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_create\_policy\_secret\_nv\_sign** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_create\_policy\_signed** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_create\_sign** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_create\_sign\_password\_provision** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_key\_create\_sign\_policy\_provision** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_nv\_extend** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_nv\_increment** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_nv\_ordinary** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_nv\_set\_bits** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_nv\_written\_policy** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_pcr\_test** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_platform\_certificates** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_quote** (**FAPI\_CONTEXT** \*context)\
 int **test\_fapi\_unseal** (**FAPI\_CONTEXT** \*context)\

## Detailed Description

Testing of FAPI functionality. The tested FAPI functions are listed in each of the testcase functions' descriptions.

## Function Documentation

### int test\_fapi\_data\_crypt (FAPI\_CONTEXT \* context)

Test the FAPI functions for encryption and decryption.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_SetSignCB()**

- •

  **Fapi\_Encrypt()**

- •

  **Fapi\_Decrypt()**

- •

  **Fapi\_Free()**

Tested Policies:

- •

  PolicySigned

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_duplicate (FAPI\_CONTEXT \* context)

Test the FAPI functions for key duplication.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_ExportKey()**

- •

  **Fapi\_Delete()**

Tested Policies:

- •

  PolicyDuplicationSelect

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_ext\_public\_key (FAPI\_CONTEXT \* context)

Test the FAPI functions use an external public key for signature and quote verify without TPM.

Tested FAPI commands:

- •

  **Fapi\_Import()**

- •

  **Fapi\_VerifySignature()**

- •

  **Fapi\_SetCertificate()**

- •

  **Fapi\_GetCertificate()**

- •

  **Fapi\_List()**

- •

  **Fapi\_VerifyQuote()**

- •

  **Fapi\_Delete()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_get\_random (FAPI\_CONTEXT \* context)

Test the FAPI function FAPI\_GetRandom and async invocations.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_GetRandom\_Async()**

- •

  **Fapi\_GetRandom\_Finish()**

- •

  **Fapi\_GetPollHandles()**

- •

  **Fapi\_GetRandom()**

- •

  **Fapi\_Delete()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_info (FAPI\_CONTEXT \* context)

Test the FAPI functions for GetInfo.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_GetInfo()**

- •

  **Fapi\_Delete()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_key\_change\_auth (FAPI\_CONTEXT \* context)

Test the FAPI function for changing key authorizations.

The setting of the authorization callback and usage of the key with Fapi\_Sign afterwards is also tested.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_ChangeAuth()**

- •

  **Fapi\_SetAuthCB()**

- •

  **Fapi\_Sign()**

- •

  **Fapi\_Delete()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_key\_create\_ckda\_sign (FAPI\_CONTEXT \* context)

Test the FAPI functions for key creation and usage with noda and da flag.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_SetAuthCB()**

- •

  **Fapi\_Sign()**

- •

  **Fapi\_Delete()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_key\_create\_policies\_sign (FAPI\_CONTEXT \* context)

Test several FAPI policies by usage of signing key.

Which test case will be executed is determined by the compiler switches: TEST\_POLICY\_PASSWORD, TEST\_POLICY\_AUTH\_VALUE, TEST\_POLICY\_LOCALITY TEST\_POLICY\_PHYSICAL\_PRESENCE, TEST\_POLICY\_COMMAND\_CODE, TEST\_POLICY\_COUNTERTIMER.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_SetAuthCB()**

- •

  **Fapi\_Sign()**

- •

  **Fapi\_Delete()**

Tested Policies:

- •

  PolicyPassword

- •

  PolicyAuthValue

- •

  PolicyLocality

- •

  PolicyPhysicalPresence

- •

  PolicyCommandCode

- •

  PolicyCounterTimer

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_key\_create\_policy\_authorize\_sign (FAPI\_CONTEXT \* context)

Test the FAPI functions for PolicyAuthoirze with signing.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_SetBranchCB()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_AuthorizePolicy()**

- •

  **Fapi\_Sign()**

- •

  **Fapi\_List()**

- •

  **Fapi\_Delete()**

Tested Policies:

- •

  PolicyNameHash

- •

  PolicyAuthorize

- •

  PolicyCpHash (Not entered, only as alternative branch)

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_key\_create\_policy\_nv\_sign (FAPI\_CONTEXT \* context)

Test the FAPI functions for NV writing and key usage.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_NvWrite()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_Sign()**

- •

  **Fapi\_Delete()**

Tested Policies:

- •

  PolicyNv

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_key\_create\_policy\_or\_sign (FAPI\_CONTEXT \* context)

Test the FAPI for PolicyOr using signing.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_SetBranchCB()**

- •

  **Fapi\_Sign()**

- •

  **Fapi\_Delete()**

Tested Policies:

- •

  PolicyOr

- •

  PolicyPcr

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_key\_create\_policy\_pcr\_sign (FAPI\_CONTEXT \* context)

Test the FAPI functions for PolicyPCR with key creation and usage.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_Sign()**

- •

  **Fapi\_ExportPolicy()**

- •

  **Fapi\_Delete()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_List()**

Tested Policies:

- •

  PolicyPcr (with currentPCRs set)

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_key\_create\_policy\_secret\_nv\_sign (FAPI\_CONTEXT \* context)

Test the FAPI PolicySecret and PolicyAuthValue handling.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_CreateNv()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_Sign()**

- •

  **Fapi\_SetAuthCB()**

- •

  **Fapi\_Delete()**

Tested Policies:

- •

  PolicySecret

- •

  PolicyAuthValue

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_key\_create\_policy\_signed (FAPI\_CONTEXT \* context)

Test the FAPI functions for key creation and usage with a PolicySigned.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_SetSignCB()**

- •

  **Fapi\_Sign()**

- •

  **Fapi\_Delete()**

- •

  **Fapi\_List()**

Tested Policies:

- •

  PolicySigned

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_key\_create\_sign (FAPI\_CONTEXT \* context)

Test the FAPI functions for TpmBlobs and certificates.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_SetAuthCB()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_GetTpmBlobs()**

- •

  **Fapi\_Sign()**

- •

  **Fapi\_VerifySignature()**

- •

  **Fapi\_SetCertificate()**

- •

  **Fapi\_List()**

- •

  **Fapi\_ChangeAuth()**

- •

  **Fapi\_Delete()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_key\_create\_sign\_password\_provision (FAPI\_CONTEXT \* context)

Test the FAPI functions for key creation and usage with an SH password.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_SetAuthCB()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_GetTpmBlobs()**

- •

  **Fapi\_Sign()**

- •

  **Fapi\_SetCertificate()**

- •

  **Fapi\_List()**

- •

  **Fapi\_ChangeAuth()**

- •

  **Fapi\_Delete()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_key\_create\_sign\_policy\_provision (FAPI\_CONTEXT \* context)

Test the FAPI functions for key creation and usage.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_SetAuthCB()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_GetTpmBlobs()**

- •

  **Fapi\_Sign()**

- •

  **Fapi\_SetCertificate()**

- •

  **Fapi\_List()**

- •

  **Fapi\_Delete()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_nv\_extend (FAPI\_CONTEXT \* context)

Test the FAPI function FAPI\_NvExtend.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_CreateNv()**

- •

  **Fapi\_NvExtend()**

- •

  **Fapi\_Delete()**

- •

  **Fapi\_SetAuthCB()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_nv\_increment (FAPI\_CONTEXT \* context)

Test the FAPI function FAPI\_NvIncrement.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_CreateNv()**

- •

  **Fapi\_SetAuthCB()**

- •

  **Fapi\_ChangeAuth()**

- •

  **Fapi\_Delete()**

- •

  **Fapi\_NvIncrement()**

Tested Policies:

- •

  PolicyAuthValue

- •

  PolicyCommandCode

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_nv\_ordinary (FAPI\_CONTEXT \* context)

Test the FAPI NV functions.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_SetPolicyActionCB()**

- •

  **Fapi\_CreateNv()**

- •

  **Fapi\_NvWrite()**

- •

  **Fapi\_NvRead()**

- •

  **Fapi\_Delete()**

- •

  **Fapi\_SetDescription()**

- •

  **Fapi\_GetDescription()**

- •

  **Fapi\_SetAuthCB()**

Tested Policies:

- •

  PolicyAction

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_nv\_set\_bits (FAPI\_CONTEXT \* context)

Test the FAPI function Fapi\_NvSetBits.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_CreateNv()**

- •

  **Fapi\_NvSetBits()**

- •

  **Fapi\_Delete()**

- •

  **Fapi\_SetAuthCB()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_nv\_written\_policy (FAPI\_CONTEXT \* context)

Test the FAPI policy PolicyNvWritten.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_CreateNv()**

- •

  **Fapi\_SetAppData()**

- •

  **Fapi\_GetAppData()**

- •

  **Fapi\_NvWrite()**

- •

  **Fapi\_Delete()**

Tested Policies:

- •

  PolicyNvWritten

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_pcr\_test (FAPI\_CONTEXT \* context)

Test the FAPI function FAPI\_PcrExtend and Read.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_PcrExtend()**

- •

  **Fapi\_PcrRead()**

- •

  **Fapi\_Delete()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_quote (FAPI\_CONTEXT \* context)

Test the FAPI functions for quote commands.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_CreateKey()**

- •

  **Fapi\_PcrExtend()**

- •

  **Fapi\_Quote()**

- •

  **Fapi\_ExportKey()**

- •

  **Fapi\_Import()**

- •

  **Fapi\_PcrRead()**

- •

  **Fapi\_VerifyQuote()**

- •

  **Fapi\_List()**

- •

  **Fapi\_Delete()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

### int test\_fapi\_unseal (FAPI\_CONTEXT \* context)

Test the FAPI functions for sealing.

Tested FAPI commands:

- •

  **Fapi\_Provision()**

- •

  **Fapi\_CreateSeal()**

- •

  **Fapi\_Unseal()**

- •

  **Fapi\_Delete()**

**Parameters**

*context* The **FAPI\_CONTEXT**.

**Return values**

*EXIT\_FAILURE* \
 *EXIT\_SUCCESS*

## Author

Generated automatically by Doxygen for tpm2-tss from the source code.
