TPM (tpm v0.1.0)

Elixir wrapper for tpm2-tools.

Summary

Functions

Clear the TPM.

Get TPM capabilities.

Define a TPM Non-Volatile (NV) index.

Read the data stored in a Non-Volatile (NV) index.

Write data to a Non-Volatile (NV) index.

Types

Link to this type

tpm2_error()

@type tpm2_error() ::
  {:error, :invalid_options, message :: String.t()}
  | {:error, :not_authorized, message :: String.t()}
  | {:error, :tcti, message :: String.t()}
  | {:error, :unsupported_scheme, message :: String.t()}
  | {:error, return_code :: non_neg_integer(), message :: String.t()}

Functions

@spec clear([{:confirm, boolean()}]) :: :ok | tpm2_error() | :no_return

Clear the TPM.

Opts

  • confirm - Must be set true to clear the TPM. This prevents accidental auto-completion in IEx.
Link to this function

getcap(capability)

@spec getcap(capability :: :handles_nv_index) :: {:ok, [String.t()]} | tpm2_error()

Get TPM capabilities.

Link to this function

nvdefine(opts \\ [])

@spec nvdefine(address: String.t(), size: pos_integer()) ::
  {:ok, String.t()} | tpm2_error()

Define a TPM Non-Volatile (NV) index.

Opts

  • address - NV index or offset number.
  • size - Specifies the size of data area in bytes. Defaults to MAX_NV_INDEX_SIZE which is typically 2048.
Link to this function

nvread(address, opts \\ [])

@spec nvread(address :: String.t(), [{:output, String.t()}]) ::
  :ok | {:ok, String.t()} | tpm2_error()

Read the data stored in a Non-Volatile (NV) index.

Args

  • address - NV memory address.

Opts

  • output - File path to write the NV memory's contents to. Returns :ok.
Link to this function

nvwrite(address, path)

@spec nvwrite(address :: String.t(), path :: String.t()) :: :ok | tpm2_error()

Write data to a Non-Volatile (NV) index.

Args

  • address - NV memory address.
  • path - File path to read into the NV memory's contents.