Lines Matching +full:- +full:nv
8 # http://www.apache.org/licenses/LICENSE-2.0
19 * \brief TPM NV API implementation.
22 #include "epid/member/tpm2/nv.h"
27 /// Find nv_index in nv array
31 if (ctx->nv[i].nv_index == nv_index) return i; in EpidFindNvIndex()
33 return -1; in EpidFindNvIndex()
36 /// Find empty node in nv array
40 if (!ctx->nv[i].data_size) return i; in EpidFindFirstEmptyNvIndex()
42 return -1; in EpidFindFirstEmptyNvIndex()
53 if (EpidFindNvIndex(ctx, nv_index) != -1) { in Tpm2NvDefineSpace()
57 if (index == -1) { in Tpm2NvDefineSpace()
60 ctx->nv[index].nv_index = nv_index; in Tpm2NvDefineSpace()
62 ctx->nv[index].data_size = size; in Tpm2NvDefineSpace()
75 if (index == -1) { in Tpm2NvUndefineSpace()
78 ctx->nv[index].nv_index = 0; in Tpm2NvUndefineSpace()
79 SAFE_FREE(ctx->nv[index].data); in Tpm2NvUndefineSpace()
80 ctx->nv[index].data_size = 0; in Tpm2NvUndefineSpace()
95 if (index == -1 || !ctx->nv[index].data) { in Tpm2NvRead()
98 if (offset + size > ctx->nv[index].data_size) { in Tpm2NvRead()
101 buf = (uint8_t*)ctx->nv[index].data + offset; in Tpm2NvRead()
119 if (index == -1) { in Tpm2NvWrite()
122 if (offset + size > ctx->nv[index].data_size) { in Tpm2NvWrite()
125 if (!ctx->nv[index].data) { in Tpm2NvWrite()
126 ctx->nv[index].data = SAFE_ALLOC(ctx->nv[index].data_size); in Tpm2NvWrite()
127 if (!ctx->nv[index].data) return kEpidMemAllocErr; in Tpm2NvWrite()
129 buf = (uint8_t*)ctx->nv[index].data + offset; in Tpm2NvWrite()