SecurityPkg/Library/Tpm2CommandLib/Tpm2NVStorage.c File Reference


Defines

#define RC_NV_ReadPublic_nvIndex   (TPM_RC_H + TPM_RC_1)
#define RC_NV_DefineSpace_authHandle   (TPM_RC_H + TPM_RC_1)
#define RC_NV_DefineSpace_auth   (TPM_RC_P + TPM_RC_1)
#define RC_NV_DefineSpace_publicInfo   (TPM_RC_P + TPM_RC_2)
#define RC_NV_UndefineSpace_authHandle   (TPM_RC_H + TPM_RC_1)
#define RC_NV_UndefineSpace_nvIndex   (TPM_RC_H + TPM_RC_2)
#define RC_NV_Read_authHandle   (TPM_RC_H + TPM_RC_1)
#define RC_NV_Read_nvIndex   (TPM_RC_H + TPM_RC_2)
#define RC_NV_Read_size   (TPM_RC_P + TPM_RC_1)
#define RC_NV_Read_offset   (TPM_RC_P + TPM_RC_2)
#define RC_NV_Write_authHandle   (TPM_RC_H + TPM_RC_1)
#define RC_NV_Write_nvIndex   (TPM_RC_H + TPM_RC_2)
#define RC_NV_Write_data   (TPM_RC_P + TPM_RC_1)
#define RC_NV_Write_offset   (TPM_RC_P + TPM_RC_2)

Functions

EFI_STATUS EFIAPI Tpm2NvReadPublic (IN TPMI_RH_NV_INDEX NvIndex, OUT TPM2B_NV_PUBLIC *NvPublic, OUT TPM2B_NAME *NvName)
EFI_STATUS EFIAPI Tpm2NvDefineSpace (IN TPMI_RH_PROVISION AuthHandle, IN TPMS_AUTH_COMMAND *AuthSession, IN TPM2B_AUTH *Auth, IN TPM2B_NV_PUBLIC *NvPublic)
EFI_STATUS EFIAPI Tpm2NvUndefineSpace (IN TPMI_RH_PROVISION AuthHandle, IN TPMI_RH_NV_INDEX NvIndex, IN TPMS_AUTH_COMMAND *AuthSession)
EFI_STATUS EFIAPI Tpm2NvRead (IN TPMI_RH_NV_AUTH AuthHandle, IN TPMI_RH_NV_INDEX NvIndex, IN TPMS_AUTH_COMMAND *AuthSession, IN UINT16 Size, IN UINT16 Offset, IN OUT TPM2B_MAX_BUFFER *OutData)
EFI_STATUS EFIAPI Tpm2NvWrite (IN TPMI_RH_NV_AUTH AuthHandle, IN TPMI_RH_NV_INDEX NvIndex, IN TPMS_AUTH_COMMAND *AuthSession, IN TPM2B_MAX_BUFFER *InData, IN UINT16 Offset)
EFI_STATUS EFIAPI Tpm2NvReadLock (IN TPMI_RH_NV_AUTH AuthHandle, IN TPMI_RH_NV_INDEX NvIndex, IN TPMS_AUTH_COMMAND *AuthSession)
EFI_STATUS EFIAPI Tpm2NvWriteLock (IN TPMI_RH_NV_AUTH AuthHandle, IN TPMI_RH_NV_INDEX NvIndex, IN TPMS_AUTH_COMMAND *AuthSession)
EFI_STATUS EFIAPI Tpm2NvGlobalWriteLock (IN TPMI_RH_PROVISION AuthHandle, IN TPMS_AUTH_COMMAND *AuthSession)

Detailed Description

Implement TPM2 NVStorage related command.

Copyright (c) 2013, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.


Define Documentation

#define RC_NV_DefineSpace_auth   (TPM_RC_P + TPM_RC_1)

Referenced by Tpm2NvDefineSpace().

#define RC_NV_DefineSpace_authHandle   (TPM_RC_H + TPM_RC_1)

Referenced by Tpm2NvDefineSpace().

#define RC_NV_DefineSpace_publicInfo   (TPM_RC_P + TPM_RC_2)

Referenced by Tpm2NvDefineSpace().

#define RC_NV_Read_authHandle   (TPM_RC_H + TPM_RC_1)

Referenced by Tpm2NvRead().

#define RC_NV_Read_nvIndex   (TPM_RC_H + TPM_RC_2)

Referenced by Tpm2NvRead().

#define RC_NV_Read_offset   (TPM_RC_P + TPM_RC_2)

#define RC_NV_Read_size   (TPM_RC_P + TPM_RC_1)

#define RC_NV_ReadPublic_nvIndex   (TPM_RC_H + TPM_RC_1)

Referenced by Tpm2NvReadPublic().

#define RC_NV_UndefineSpace_authHandle   (TPM_RC_H + TPM_RC_1)

Referenced by Tpm2NvUndefineSpace().

#define RC_NV_UndefineSpace_nvIndex   (TPM_RC_H + TPM_RC_2)

Referenced by Tpm2NvUndefineSpace().

#define RC_NV_Write_authHandle   (TPM_RC_H + TPM_RC_1)

Referenced by Tpm2NvWrite().

#define RC_NV_Write_data   (TPM_RC_P + TPM_RC_1)

#define RC_NV_Write_nvIndex   (TPM_RC_H + TPM_RC_2)

Referenced by Tpm2NvWrite().

#define RC_NV_Write_offset   (TPM_RC_P + TPM_RC_2)


Function Documentation

EFI_STATUS EFIAPI Tpm2NvDefineSpace ( IN TPMI_RH_PROVISION  AuthHandle,
IN TPMS_AUTH_COMMAND *  AuthSession,
IN TPM2B_AUTH *  Auth,
IN TPM2B_NV_PUBLIC *  NvPublic 
)

This command defines the attributes of an NV Index and causes the TPM to reserve space to hold the data associated with the index. If a definition already exists at the index, the TPM will return TPM_RC_NV_DEFINED.

Parameters:
[in] AuthHandle TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}.
[in] AuthSession Auth Session context
[in] Auth The authorization data.
[in] NvPublic The public area of the index.
Return values:
EFI_SUCCESS Operation completed successfully.
EFI_DEVICE_ERROR The command was unsuccessful.
EFI_ALREADY_STARTED The command was returned successfully, but NvIndex is already defined.

References CopyAuthSessionCommand(), EFI_STATUS(), RC_NV_DefineSpace_auth, RC_NV_DefineSpace_authHandle, RC_NV_DefineSpace_publicInfo, and Tpm2SubmitCommand().

EFI_STATUS EFIAPI Tpm2NvGlobalWriteLock ( IN TPMI_RH_PROVISION  AuthHandle,
IN TPMS_AUTH_COMMAND *  AuthSession 
)

The command will SET TPMA_NV_WRITELOCKED for all indexes that have their TPMA_NV_GLOBALLOCK attribute SET.

Parameters:
[in] AuthHandle TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}.
[in] AuthSession Auth Session context
Return values:
EFI_SUCCESS Operation completed successfully.
EFI_DEVICE_ERROR The command was unsuccessful.
EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.

References CopyAuthSessionCommand(), EFI_STATUS(), and Tpm2SubmitCommand().

EFI_STATUS EFIAPI Tpm2NvRead ( IN TPMI_RH_NV_AUTH  AuthHandle,
IN TPMI_RH_NV_INDEX  NvIndex,
IN TPMS_AUTH_COMMAND *  AuthSession,
IN UINT16  Size,
IN UINT16  Offset,
IN OUT TPM2B_MAX_BUFFER *  OutData 
)

This command reads a value from an area in NV memory previously defined by TPM2_NV_DefineSpace().

Parameters:
[in] AuthHandle the handle indicating the source of the authorization value.
[in] NvIndex The index to be read.
[in] AuthSession Auth Session context
[in] Size Number of bytes to read.
[in] Offset Byte offset into the area.
[in,out] OutData The data read.
Return values:
EFI_SUCCESS Operation completed successfully.
EFI_DEVICE_ERROR The command was unsuccessful.
EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.

References CopyAuthSessionCommand(), EFI_STATUS(), RC_NV_Read_authHandle, RC_NV_Read_nvIndex, and Tpm2SubmitCommand().

EFI_STATUS EFIAPI Tpm2NvReadLock ( IN TPMI_RH_NV_AUTH  AuthHandle,
IN TPMI_RH_NV_INDEX  NvIndex,
IN TPMS_AUTH_COMMAND *  AuthSession 
)

This command may be used to prevent further reads of the Index until the next TPM2_Startup (TPM_SU_CLEAR).

Parameters:
[in] AuthHandle the handle indicating the source of the authorization value.
[in] NvIndex The NV Index of the area to lock.
[in] AuthSession Auth Session context
Return values:
EFI_SUCCESS Operation completed successfully.
EFI_DEVICE_ERROR The command was unsuccessful.
EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.

References CopyAuthSessionCommand(), EFI_STATUS(), and Tpm2SubmitCommand().

EFI_STATUS EFIAPI Tpm2NvReadPublic ( IN TPMI_RH_NV_INDEX  NvIndex,
OUT TPM2B_NV_PUBLIC *  NvPublic,
OUT TPM2B_NAME *  NvName 
)

This command is used to read the public area and Name of an NV Index.

Parameters:
[in] NvIndex The NV Index.
[out] NvPublic The public area of the index.
[out] NvName The Name of the nvIndex.
Return values:
EFI_SUCCESS Operation completed successfully.
EFI_DEVICE_ERROR The command was unsuccessful.
EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.

References EFI_STATUS(), RC_NV_ReadPublic_nvIndex, and Tpm2SubmitCommand().

EFI_STATUS EFIAPI Tpm2NvUndefineSpace ( IN TPMI_RH_PROVISION  AuthHandle,
IN TPMI_RH_NV_INDEX  NvIndex,
IN TPMS_AUTH_COMMAND *  AuthSession 
)

This command removes an index from the TPM.

Parameters:
[in] AuthHandle TPM_RH_OWNER or TPM_RH_PLATFORM+{PP}.
[in] NvIndex The NV Index.
[in] AuthSession Auth Session context
Return values:
EFI_SUCCESS Operation completed successfully.
EFI_DEVICE_ERROR The command was unsuccessful.
EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.

References CopyAuthSessionCommand(), EFI_STATUS(), RC_NV_UndefineSpace_authHandle, RC_NV_UndefineSpace_nvIndex, and Tpm2SubmitCommand().

EFI_STATUS EFIAPI Tpm2NvWrite ( IN TPMI_RH_NV_AUTH  AuthHandle,
IN TPMI_RH_NV_INDEX  NvIndex,
IN TPMS_AUTH_COMMAND *  AuthSession,
IN TPM2B_MAX_BUFFER *  InData,
IN UINT16  Offset 
)

This command writes a value to an area in NV memory that was previously defined by TPM2_NV_DefineSpace().

Parameters:
[in] AuthHandle the handle indicating the source of the authorization value.
[in] NvIndex The NV Index of the area to write.
[in] AuthSession Auth Session context
[in] InData The data to write.
[in] Offset The offset into the NV Area.
Return values:
EFI_SUCCESS Operation completed successfully.
EFI_DEVICE_ERROR The command was unsuccessful.
EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.

References CopyAuthSessionCommand(), EFI_STATUS(), RC_NV_Write_authHandle, RC_NV_Write_nvIndex, and Tpm2SubmitCommand().

EFI_STATUS EFIAPI Tpm2NvWriteLock ( IN TPMI_RH_NV_AUTH  AuthHandle,
IN TPMI_RH_NV_INDEX  NvIndex,
IN TPMS_AUTH_COMMAND *  AuthSession 
)

This command may be used to inhibit further writes of the Index.

Parameters:
[in] AuthHandle the handle indicating the source of the authorization value.
[in] NvIndex The NV Index of the area to lock.
[in] AuthSession Auth Session context
Return values:
EFI_SUCCESS Operation completed successfully.
EFI_DEVICE_ERROR The command was unsuccessful.
EFI_NOT_FOUND The command was returned successfully, but NvIndex is not found.

References CopyAuthSessionCommand(), EFI_STATUS(), and Tpm2SubmitCommand().


Generated on Thu Sep 24 23:44:24 2015 for SecurityPkg[ALL] by  doxygen 1.5.7.1