[libvirt PATCH v2 03/12] util: refactor TPM helper methods to reduce duplicationm