| // This file was extracted from the TCG Published |
| // Trusted Platform Module Library |
| // Level 00 Revision 01.16 |
| #include "InternalRoutines.h" |
| // TPM_RC_NV_AUTHORIZATION the authorization was valid but the authorizing entity (authHandle) is |
| // not allowed to read from the Index referenced by nvIndex |
| // TPM_RC_NV_LOCKED the Index referenced by nvIndex is read locked |
| // TPM_RC_NV_RANGE read range defined by size and offset is outside the range of the |
| // Index referenced by nvIndex |
| // TPM_RC_NV_UNINITIALIZED the Index referenced by nvIndex has not been initialized (written) |
| NV_Read_In *in, // IN: input parameter list |
| NV_Read_Out *out // OUT: output parameter list |
| NvGetIndexInfo(in->nvIndex, &nvIndex); |
| // Common read access checks. NvReadAccessChecks() returns |
| // TPM_RC_NV_AUTHORIZATION, TPM_RC_NV_LOCKED, or TPM_RC_NV_UNINITIALIZED |
| // error may be returned at this point |
| result = NvReadAccessChecks(in->authHandle, in->nvIndex); |
| if(result != TPM_RC_SUCCESS) |
| if((in->size + in->offset) > nvIndex.publicArea.dataSize) |
| out->data.t.size = in->size; |
| NvGetIndexData(in->nvIndex, &nvIndex, in->offset, in->size, out->data.t.buffer); |