ia64/xen-unstable

changeset 17162:5ea409d66ee4

TPM emulator: HMAC calculation fix for response from TPM_LoadKey2
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
author Keir Fraser <keir.fraser@citrix.com>
date Mon Mar 03 10:53:43 2008 +0000 (2008-03-03)
parents 71a8366fb212
children 35f4f285762f
files tools/vtpm/vtpm.patch
line diff
     1.1 --- a/tools/vtpm/vtpm.patch	Fri Feb 29 09:19:58 2008 -0700
     1.2 +++ b/tools/vtpm/vtpm.patch	Mon Mar 03 10:53:43 2008 +0000
     1.3 @@ -125,9 +125,32 @@ diff -uprN tpm_emulator/tpm/tpm_capabili
     1.4         return TPM_FAIL;
     1.5   
     1.6       case TPM_CAP_PROP_ACTIVE_COUNTER:
     1.7 +diff -uprN tpm_emulator/tpm/tpm_cmd_handler.c vtpm/tpm/tpm_cmd_handler.c
     1.8 +--- tpm_emulator/tpm/tpm_cmd_handler.c	2008-02-27 16:35:41.000000000 -0500
     1.9 ++++ vtpm/tpm/tpm_cmd_handler.c	2008-02-28 14:43:28.000000000 -0500
    1.10 +@@ -94,12 +94,18 @@ void tpm_compute_out_param_digest(TPM_CO
    1.11 +   sha1_ctx_t sha1;
    1.12 +   UINT32 res = CPU_TO_BE32(rsp->result);
    1.13 +   UINT32 ord = CPU_TO_BE32(ordinal);
    1.14 ++  UINT32 offset = 0;
    1.15 + 
    1.16 +   /* compute SHA1 hash */
    1.17 +   sha1_init(&sha1);
    1.18 +   sha1_update(&sha1, (BYTE*)&res, 4);
    1.19 +   sha1_update(&sha1, (BYTE*)&ord, 4);
    1.20 +-  sha1_update(&sha1, rsp->param, rsp->paramSize);
    1.21 ++  if (ordinal == TPM_ORD_LoadKey2) {
    1.22 ++      offset = 4;
    1.23 ++  }
    1.24 ++  if (rsp->paramSize - offset > 0) {
    1.25 ++      sha1_update(&sha1, rsp->param + offset, rsp->paramSize - offset);
    1.26 ++  }
    1.27 +   sha1_final(&sha1, rsp->auth1->digest);
    1.28 +   if (rsp->auth2 != NULL) memcpy(rsp->auth2->digest, 
    1.29 +     rsp->auth1->digest, sizeof(rsp->auth1->digest));
    1.30  diff -uprN tpm_emulator/tpm/tpm_data.c vtpm/tpm/tpm_data.c
    1.31 ---- tpm_emulator/tpm/tpm_data.c	2006-12-08 12:51:29.000000000 -0800
    1.32 -+++ vtpm/tpm/tpm_data.c	2006-12-13 16:38:52.000000000 -0800
    1.33 +--- tpm_emulator/tpm/tpm_data.c	2008-02-27 16:35:41.000000000 -0500
    1.34 ++++ vtpm/tpm/tpm_data.c	2008-02-27 16:35:40.000000000 -0500
    1.35  @@ -1,6 +1,7 @@
    1.36   /* Software-Based Trusted Platform Module (TPM) Emulator for Linux
    1.37    * Copyright (C) 2004 Mario Strasser <mast@gmx.net>,