1
2 /*
3 * Licensed Materials - Property of IBM
4 *
5 * trousers - An open source TCG Software Stack
6 *
7 * (C) Copyright International Business Machines Corp. 2004-2007
8 *
9 */
10
11
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <string.h>
15 #include <unistd.h>
16 #include <sys/types.h>
17 #include <sys/stat.h>
18 #include <sys/mman.h>
19 #include <fcntl.h>
20 #include <errno.h>
21
22 #include "trousers/tss.h"
23 #include "trousers_types.h"
24 #include "trousers_types.h"
25 #include "tcs_tsp.h"
26 #include "tcs_utils.h"
27 #include "tcs_int_literals.h"
28 #include "capabilities.h"
29 #include "tcsps.h"
30 #include "tcslog.h"
31
32
33 void
UnloadBlob_COUNTER_VALUE(UINT64 * offset,BYTE * blob,TPM_COUNTER_VALUE * ctr)34 UnloadBlob_COUNTER_VALUE(UINT64 *offset, BYTE *blob, TPM_COUNTER_VALUE *ctr)
35 {
36 if (!ctr) {
37 UnloadBlob_UINT16(offset, NULL, blob);
38 UnloadBlob(offset, 4, blob, NULL);
39 UnloadBlob_UINT32(offset, NULL, blob);
40 return;
41 }
42
43 UnloadBlob_UINT16(offset, &ctr->tag, blob);
44 UnloadBlob(offset, 4, blob, (BYTE *)&ctr->label);
45 UnloadBlob_UINT32(offset, &ctr->counter, blob);
46 }
47
48 void
LoadBlob_COUNTER_VALUE(UINT64 * offset,BYTE * blob,TPM_COUNTER_VALUE * ctr)49 LoadBlob_COUNTER_VALUE(UINT64 *offset, BYTE *blob, TPM_COUNTER_VALUE *ctr)
50 {
51 LoadBlob_UINT16(offset, ctr->tag, blob);
52 LoadBlob(offset, 4, blob, (BYTE *)&ctr->label);
53 LoadBlob_UINT32(offset, ctr->counter, blob);
54 }
55