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. 2007
8  *
9  */
10 
11 
12 #include <stdlib.h>
13 #include <stdio.h>
14 #include <string.h>
15 
16 #include "trousers/tss.h"
17 #include "trousers_types.h"
18 #include "tcs_utils.h"
19 #include "tcslog.h"
20 #include "req_mgr.h"
21 
22 TSS_RESULT
TCSP_SetOperatorAuth_Internal(TCS_CONTEXT_HANDLE hContext,TCPA_SECRET * operatorAuth)23 TCSP_SetOperatorAuth_Internal(TCS_CONTEXT_HANDLE hContext,  /* in */
24                                     TCPA_SECRET *operatorAuth)        /* in */
25 {
26           TSS_RESULT result;
27           UINT64 offset = 0;
28           UINT32 paramSize;
29           BYTE txBlob[TSS_TPM_TXBLOB_SIZE];
30 
31           LogDebugFn("Enter");
32 
33           if ((result = ctx_verify_context(hContext)))
34                     return result;
35 
36           if ((result = tpm_rqu_build(TPM_ORD_SetOperatorAuth, &offset, txBlob, TPM_AUTHDATA_SIZE,
37                                             operatorAuth->authdata)))
38                     return result;
39 
40           if ((result = req_mgr_submit_req(txBlob)))
41                     goto done;
42 
43           result = UnloadBlob_Header(txBlob, &paramSize);
44 
45           LogResult("SetOperatorAuth", result);
46 done:
47           return result;
48 }
49 
50