]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
libpts: Fix PCR read, avoid cast of a pointer to different sized integer
authorMartin Willi <martin@revosec.ch>
Thu, 9 Jan 2014 16:29:35 +0000 (17:29 +0100)
committerMartin Willi <martin@revosec.ch>
Wed, 4 Jun 2014 13:53:07 +0000 (15:53 +0200)
src/libpts/pts/pts.c

index 075af5bcc0acca759d5236f5106e88226a2a38c4..b82b7440545acef575338170c4cfedc756057942 100644 (file)
@@ -623,7 +623,8 @@ METHOD(pts_t, read_pcr, bool,
        TSS_HCONTEXT hContext;
        TSS_HTPM hTPM;
        TSS_RESULT result;
-       chunk_t rgbPcrValue;
+       BYTE *buf;
+       UINT32 len;
 
        bool success = FALSE;
 
@@ -644,12 +645,12 @@ METHOD(pts_t, read_pcr, bool,
        {
                goto err;
        }
-       result = Tspi_TPM_PcrRead(hTPM, pcr_num, (UINT32*)&rgbPcrValue.len, &rgbPcrValue.ptr);
+       result = Tspi_TPM_PcrRead(hTPM, pcr_num, &len, &buf);
        if (result != TSS_SUCCESS)
        {
                goto err;
        }
-       *pcr_value = chunk_clone(rgbPcrValue);
+       *pcr_value = chunk_clone(chunk_create(buf, len));
        DBG3(DBG_PTS, "PCR %d value:%B", pcr_num, pcr_value);
        success = TRUE;