The security in TPM session cryptography depends on starting the session with a shared initial value that the attacker can't guess. This can be done either by binding (using the authority value of a TPM object the user knows, effectively a shared secret) or salting (encrypting an initial value to a TPM public key so the attacker can't observe it) or both. This code does neither here (in tss.rs):
let maybe_auth_session = tpm_ctx
.start_auth_session(
None, // should be salt key for session encryption
None, // should be bind key for shared secret
None,
SessionType::Hmac,
SymmetricDefinition::AES_128_CFB,
HashingAlgorithm::Sha256,
)
So the initial value for session key derivation ends up as zero and any attacker would know it and could trivially derive the HMAC and encryption keys simply by observing the TPM transactions on the bus.
The security in TPM session cryptography depends on starting the session with a shared initial value that the attacker can't guess. This can be done either by binding (using the authority value of a TPM object the user knows, effectively a shared secret) or salting (encrypting an initial value to a TPM public key so the attacker can't observe it) or both. This code does neither here (in tss.rs):
So the initial value for session key derivation ends up as zero and any attacker would know it and could trivially derive the HMAC and encryption keys simply by observing the TPM transactions on the bus.