[PATCH v2 04/11] tpm: Add an API that can support v1.2 and v2