Conversation

Jarkko Sakkinen

I learned a new thing in macro_rules! i.e., pattern matching:

tpm_struct! {
    #[derive(Debug, Default, PartialEq, Eq, Clone)]
    kind: Command,
    name: TpmStartAuthSessionCommand,
    cc: TpmCc::StartAuthSession,
    no_sessions: true,
    with_sessions: true,
    handles: {
        pub tpm_key: crate::data::TpmiDhObject,
        pub bind: crate::data::TpmiDhObject,
    },
    parameters: {
        pub nonce_caller: Tpm2bNonce,
        pub encrypted_salt: Tpm2b,
        pub session_type: TpmSe,
        pub symmetric: TpmtSymDefObject,
        pub auth_hash: TpmAlgId,
    }
}

tpm_struct! {
    #[derive(Debug, Default, PartialEq, Eq, Clone)]
    kind: Response,
    name: TpmStartAuthSessionResponse,
    cc: TpmCc::StartAuthSession,
    no_sessions: true,
    with_sessions: false,
    handles: {
        pub session_handle: TpmSession,
    },
    parameters: {
        pub nonce_tpm: Tpm2bNonce,
    }
}
1
0
1
And noticed a bug in that message that has gone unnoticed :-) with_sessions should be true also for the response.
0
0
0