• James Bottomley's avatar
    tpm: Add HMAC session name/handle append · d0a25bb9
    James Bottomley authored
    Add tpm2_append_name() for appending to the handle area of the TPM
    command.  When TPM_BUS_SECURITY is enabled and HMAC sessions are in
    use this adds the standard u32 handle to the buffer but additionally
    records the name of the object which must be used as part of the HMAC
    computation.  The name of certain object types (volatile and permanent
    handles and NV indexes) is a hash of the public area of the object.
    Since this hash is not known ahead of time, it must be requested from
    the TPM using TPM2_ReadPublic() (which cannot be HMAC protected, but
    if an interposer lies about it, the HMAC check will fail and the
    problem will be detected).
    Signed-off-by: default avatarJames Bottomley <James.Bottomley@HansenPartnership.com>
    Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> # crypto API parts
    Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
    Tested-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
    Signed-off-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
    d0a25bb9
tpm2-sessions.c 24.6 KB