Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: src/tcs/rpc/tcstp/rpc_random.c

Issue 3581012: Upgrade from trousers 0.3.3 to 0.3.6 and from testsuite 0.2 to 0.3. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/trousers.git
Patch Set: git cl push Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/tcs/rpc/tcstp/rpc_quote2.c ('k') | src/tcs/rpc/tcstp/rpc_seal.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Licensed Materials - Property of IBM 3 * Licensed Materials - Property of IBM
4 * 4 *
5 * trousers - An open source TCG Software Stack 5 * trousers - An open source TCG Software Stack
6 * 6 *
7 * (C) Copyright International Business Machines Corp. 2004-2006 7 * (C) Copyright International Business Machines Corp. 2004-2006
8 * 8 *
9 */ 9 */
10 10
(...skipping 20 matching lines...) Expand all
31 tcs_wrap_GetRandom(struct tcsd_thread_data *data) 31 tcs_wrap_GetRandom(struct tcsd_thread_data *data)
32 { 32 {
33 TCS_CONTEXT_HANDLE hContext; 33 TCS_CONTEXT_HANDLE hContext;
34 UINT32 bytesRequested; 34 UINT32 bytesRequested;
35 BYTE *randomBytes = NULL; 35 BYTE *randomBytes = NULL;
36 TSS_RESULT result; 36 TSS_RESULT result;
37 37
38 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) 38 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm))
39 return TCSERR(TSS_E_INTERNAL_ERROR); 39 return TCSERR(TSS_E_INTERNAL_ERROR);
40 40
41 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); 41 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext);
42 42
43 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &bytesRequested, 0, &data->comm) ) 43 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &bytesRequested, 0, &data->comm) )
44 return TCSERR(TSS_E_INTERNAL_ERROR); 44 return TCSERR(TSS_E_INTERNAL_ERROR);
45 45
46 MUTEX_LOCK(tcsp_lock); 46 MUTEX_LOCK(tcsp_lock);
47 47
48 result = TCSP_GetRandom_Internal(hContext, &bytesRequested, &randomBytes ); 48 result = TCSP_GetRandom_Internal(hContext, &bytesRequested, &randomBytes );
49 49
50 MUTEX_UNLOCK(tcsp_lock); 50 MUTEX_UNLOCK(tcsp_lock);
51 51
(...skipping 19 matching lines...) Expand all
71 tcs_wrap_StirRandom(struct tcsd_thread_data *data) 71 tcs_wrap_StirRandom(struct tcsd_thread_data *data)
72 { 72 {
73 TCS_CONTEXT_HANDLE hContext; 73 TCS_CONTEXT_HANDLE hContext;
74 UINT32 inDataSize; 74 UINT32 inDataSize;
75 BYTE *inData; 75 BYTE *inData;
76 TSS_RESULT result; 76 TSS_RESULT result;
77 77
78 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm)) 78 if (getData(TCSD_PACKET_TYPE_UINT32, 0, &hContext, 0, &data->comm))
79 return TCSERR(TSS_E_INTERNAL_ERROR); 79 return TCSERR(TSS_E_INTERNAL_ERROR);
80 80
81 » LogDebugFn("thread %zd context %x", THREAD_ID, hContext); 81 » LogDebugFn("thread %ld context %x", THREAD_ID, hContext);
82 82
83 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &inDataSize, 0, &data->comm)) 83 if (getData(TCSD_PACKET_TYPE_UINT32, 1, &inDataSize, 0, &data->comm))
84 return TCSERR(TSS_E_INTERNAL_ERROR); 84 return TCSERR(TSS_E_INTERNAL_ERROR);
85 85
86 inData = calloc(1, inDataSize); 86 inData = calloc(1, inDataSize);
87 if (inData == NULL) { 87 if (inData == NULL) {
88 LogError("malloc of %d bytes failed.", inDataSize); 88 LogError("malloc of %d bytes failed.", inDataSize);
89 return TCSERR(TSS_E_OUTOFMEMORY); 89 return TCSERR(TSS_E_OUTOFMEMORY);
90 } 90 }
91 if (getData(TCSD_PACKET_TYPE_PBYTE, 2, inData, inDataSize, &data->comm)) { 91 if (getData(TCSD_PACKET_TYPE_PBYTE, 2, inData, inDataSize, &data->comm)) {
92 free(inData); 92 free(inData);
93 return TCSERR(TSS_E_INTERNAL_ERROR); 93 return TCSERR(TSS_E_INTERNAL_ERROR);
94 } 94 }
95 95
96 MUTEX_LOCK(tcsp_lock); 96 MUTEX_LOCK(tcsp_lock);
97 97
98 result = TCSP_StirRandom_Internal(hContext, inDataSize, inData); 98 result = TCSP_StirRandom_Internal(hContext, inDataSize, inData);
99 99
100 MUTEX_UNLOCK(tcsp_lock); 100 MUTEX_UNLOCK(tcsp_lock);
101 free(inData); 101 free(inData);
102 102
103 initData(&data->comm, 0); 103 initData(&data->comm, 0);
104 data->comm.hdr.u.result = result; 104 data->comm.hdr.u.result = result;
105 105
106 return TSS_SUCCESS; 106 return TSS_SUCCESS;
107 } 107 }
OLDNEW
« no previous file with comments | « src/tcs/rpc/tcstp/rpc_quote2.c ('k') | src/tcs/rpc/tcstp/rpc_seal.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698