This patch adds the necessary code in Tspi_Context_LoadKeyByUUID() for
determining the correct loadkey ordinal (it depends on the TPM version).
This information is used later in the function secret_PerformAuth_OIAP()
to set the authentication data in the TCS_LOADKEY_INFO structure, needed
to load the parent key.

Signed-off-by: Roberto Sassu <[email protected]>
---
 src/tspi/tspi_ps.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/tspi/tspi_ps.c b/src/tspi/tspi_ps.c
index 5aa6ea8..b6df78c 100644
--- a/src/tspi/tspi_ps.c
+++ b/src/tspi/tspi_ps.c
@@ -44,6 +44,7 @@ Tspi_Context_LoadKeyByUUID(TSS_HCONTEXT tspContext,           
/* in */
        TCS_LOADKEY_INFO info;
        UINT32          ulPubKeyLength;
        BYTE            *rgbPubKey;
+       TPM_COMMAND_CODE ordinal;
 
        if (phKey == NULL)
                return TSPERR(TSS_E_BAD_PARAMETER);
@@ -51,6 +52,9 @@ Tspi_Context_LoadKeyByUUID(TSS_HCONTEXT tspContext,           
/* in */
        if ((!obj_is_context(tspContext)))
                return TSPERR(TSS_E_INVALID_HANDLE);
 
+       if ((result = obj_context_get_loadkey_ordinal(tspContext, &ordinal)))
+               return result;
+
        /* This key is in the System Persistant storage */
        if (persistentStorageType == TSS_PS_TYPE_SYSTEM) {
 #if 1
@@ -78,7 +82,7 @@ Tspi_Context_LoadKeyByUUID(TSS_HCONTEXT tspContext,           
/* in */
                                                  &hPolicy, NULL))
                                return result;
 
-                       if (secret_PerformAuth_OIAP(keyHandle, TPM_ORD_LoadKey, 
hPolicy, FALSE,
+                       if (secret_PerformAuth_OIAP(keyHandle, ordinal, 
hPolicy, FALSE,
                                                    &info.paramDigest, 
&info.authData))
                                return result;
 
-- 
1.7.6.4

Attachment: smime.p7s
Description: S/MIME cryptographic signature

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
TrouSerS-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-tech

Reply via email to