TEE_Result TEE_GetObjectBufferAttribute(TEE_ObjectHandle object, uint32_t attributeID, void *buffer, uint32_t *size) { TEE_Result res; TEE_ObjectInfo info; uint64_t sz; res = utee_cryp_obj_get_info((unsigned long)object, &info); if (res != TEE_SUCCESS) goto exit; /* This function only supports reference attributes */ if ((attributeID & TEE_ATTR_BIT_VALUE)) { res = TEE_ERROR_BAD_PARAMETERS; goto exit; } sz = *size; res = utee_cryp_obj_get_attr((unsigned long)object, attributeID, buffer, &sz); *size = sz; exit: if (res != TEE_SUCCESS && res != TEE_ERROR_ITEM_NOT_FOUND && res != TEE_ERROR_SHORT_BUFFER && res != TEE_ERROR_CORRUPT_OBJECT && res != TEE_ERROR_STORAGE_NOT_AVAILABLE) TEE_Panic(0); return res; }
TEE_Result TEE_GetObjectValueAttribute(TEE_ObjectHandle object, uint32_t attributeID, uint32_t *a, uint32_t *b) { TEE_Result res; TEE_ObjectInfo info; uint32_t buf[2]; size_t size = sizeof(buf); res = utee_cryp_obj_get_info((uint32_t)object, &info); if (res != TEE_SUCCESS) TEE_Panic(0); if ((info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0) TEE_Panic(0); /* This function only supports value attributes */ if ((attributeID & TEE_ATTR_BIT_VALUE) == 0) TEE_Panic(0); res = utee_cryp_obj_get_attr((uint32_t)object, attributeID, buf, &size); if (res != TEE_SUCCESS && res != TEE_ERROR_ITEM_NOT_FOUND && res != TEE_ERROR_ACCESS_DENIED) TEE_Panic(0); if (size != sizeof(buf)) TEE_Panic(0); *a = buf[0]; *b = buf[1]; return res; }
TEE_Result TEE_GetObjectBufferAttribute(TEE_ObjectHandle object, uint32_t attributeID, void *buffer, size_t *size) { TEE_Result res; TEE_ObjectInfo info; res = utee_cryp_obj_get_info((uint32_t)object, &info); if (res != TEE_SUCCESS) TEE_Panic(0); if ((info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0) TEE_Panic(0); /* This function only supports reference attributes */ if ((attributeID & TEE_ATTR_BIT_VALUE) != 0) TEE_Panic(0); res = utee_cryp_obj_get_attr((uint32_t)object, attributeID, buffer, size); if (res != TEE_SUCCESS && res != TEE_ERROR_ITEM_NOT_FOUND && res != TEE_ERROR_SHORT_BUFFER) TEE_Panic(0); return res; }
TEE_Result TEE_GetObjectValueAttribute(TEE_ObjectHandle object, uint32_t attributeID, uint32_t *a, uint32_t *b) { TEE_Result res; TEE_ObjectInfo info; uint32_t buf[2]; uint64_t size = sizeof(buf); res = utee_cryp_obj_get_info((unsigned long)object, &info); if (res != TEE_SUCCESS) goto exit; /* This function only supports value attributes */ if (!(attributeID & TEE_ATTR_BIT_VALUE)) { res = TEE_ERROR_BAD_PARAMETERS; goto exit; } res = utee_cryp_obj_get_attr((unsigned long)object, attributeID, buf, &size); exit: if (res != TEE_SUCCESS && res != TEE_ERROR_ITEM_NOT_FOUND && res != TEE_ERROR_CORRUPT_OBJECT && res != TEE_ERROR_STORAGE_NOT_AVAILABLE) TEE_Panic(0); if (size != sizeof(buf)) TEE_Panic(0); if (res == TEE_SUCCESS) { if (a) *a = buf[0]; if (b) *b = buf[1]; } return res; }