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 <time.h>
16 #include <errno.h>
17
18 #include "trousers/tss.h"
19 #include "trousers/trousers.h"
20 #include "trousers_types.h"
21 #include "spi_utils.h"
22 #include "capabilities.h"
23 #include "tsplog.h"
24 #include "obj.h"
25
26
27 #ifdef TSS_BUILD_TRANSPORT
28 TSS_RESULT
Transport_SetOperatorAuth(TSS_HCONTEXT tspContext,TCPA_SECRET * operatorAuth)29 Transport_SetOperatorAuth(TSS_HCONTEXT tspContext, /* in */
30 TCPA_SECRET *operatorAuth) /* in */
31 {
32 TSS_RESULT result;
33 UINT64 offset;
34 TCS_HANDLE handlesLen = 0;
35 BYTE data[sizeof(TCPA_SECRET)];
36
37 if ((result = obj_context_transport_init(tspContext)))
38 return result;
39
40 LogDebugFn("Executing in a transport session");
41
42 offset = 0;
43 Trspi_LoadBlob(&offset, TPM_SHA1_160_HASH_LEN, data, operatorAuth->authdata);
44
45 return obj_context_transport_execute(tspContext, TPM_ORD_SetOperatorAuth, sizeof(data),
46 data, NULL, &handlesLen, NULL, NULL, NULL, NULL, NULL);
47 }
48 #endif
49