OLD | NEW |
1 /* | 1 /* |
2 * The Initial Developer of the Original Code is Intel Corporation. | 2 * The Initial Developer of the Original Code is Intel Corporation. |
3 * Portions created by Intel Corporation are Copyright (C) 2007 Intel Corporatio
n. | 3 * Portions created by Intel Corporation are Copyright (C) 2007 Intel Corporatio
n. |
4 * All Rights Reserved. | 4 * All Rights Reserved. |
5 * | 5 * |
6 * This program is free software; you can redistribute it and/or modify | 6 * This program is free software; you can redistribute it and/or modify |
7 * it under the terms of the GNU General Public License as published by | 7 * it under the terms of the GNU General Public License as published by |
8 * the Free Software Foundation; either version 2 of the License, or | 8 * the Free Software Foundation; either version 2 of the License, or |
9 * (at your option) any later version. | 9 * (at your option) any later version. |
10 * | 10 * |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 { | 188 { |
189 print_error("Tspi_SetAttribUint32 for setting data size", result
); | 189 print_error("Tspi_SetAttribUint32 for setting data size", result
); |
190 print_error_exit(nameOfFunction, err_string(result)); | 190 print_error_exit(nameOfFunction, err_string(result)); |
191 Tspi_Context_FreeMemory(hContext, NULL); | 191 Tspi_Context_FreeMemory(hContext, NULL); |
192 Tspi_Context_Close(hContext); | 192 Tspi_Context_Close(hContext); |
193 exit(result); | 193 exit(result); |
194 } | 194 } |
195 | 195 |
196 /*Define NV space*/ | 196 /*Define NV space*/ |
197 result = Tspi_NV_DefineSpace(hNVStore, 0, 0); | 197 result = Tspi_NV_DefineSpace(hNVStore, 0, 0); |
| 198 #ifdef CLEAR_TEST_INDEX |
| 199 if (result== TSS_SUCCESS) |
| 200 { |
| 201 Tspi_Context_GetTpmObject(hContext, &hTPM); |
| 202 Tspi_GetPolicyObject(hTPM, TSS_POLICY_USAGE, &hPolicy); |
| 203 Tspi_Policy_SetSecret( hPolicy, TESTSUITE_OWNER_SECRET_MODE, |
| 204 TESTSUITE_OWNER_SECRET_LEN, TESTSUITE_OW
NER_SECRET); |
| 205 Tspi_NV_ReleaseSpace(hNVStore); |
| 206 } |
| 207 #endif |
198 #ifdef NV_LOCKED | 208 #ifdef NV_LOCKED |
199 if (TSS_ERROR_CODE(result)== TSS_E_BAD_PARAMETER) | 209 if (TSS_ERROR_CODE(result)== TSS_E_BAD_PARAMETER) |
200 { | 210 { |
201 print_success(nameOfFunction, result); | 211 print_success(nameOfFunction, result); |
202 print_end_test(nameOfFunction); | 212 print_end_test(nameOfFunction); |
203 Tspi_Context_FreeMemory(hContext, NULL); | 213 Tspi_Context_FreeMemory(hContext, NULL); |
204 Tspi_Context_Close(hContext); | 214 Tspi_Context_Close(hContext); |
205 exit(0); | 215 exit(0); |
206 } | 216 } |
207 else{ | 217 else{ |
208 print_error("Tspi_NV_DefineSpace", result); | 218 print_error("Tspi_NV_DefineSpace", result); |
209 print_end_test(nameOfFunction); | 219 print_end_test(nameOfFunction); |
210 #ifdef CLEAR_TEST_INDEX | |
211 if ( result == TSS_SUCCESS ) | |
212 Tspi_NV_ReleaseSpace(hNVStore); | |
213 #endif | |
214 Tspi_Context_FreeMemory(hContext, NULL); | 220 Tspi_Context_FreeMemory(hContext, NULL); |
215 Tspi_Context_Close(hContext); | 221 Tspi_Context_Close(hContext); |
216 if ( result == TSS_SUCCESS ) | 222 if ( result == TSS_SUCCESS ) |
217 exit(-1); | 223 exit(-1); |
218 exit(result); | 224 exit(result); |
219 } | 225 } |
220 | 226 |
221 #else | 227 #else |
222 if (TSS_ERROR_CODE(result)== TSS_E_BAD_PARAMETER) | 228 if (TSS_ERROR_CODE(result)== TSS_E_BAD_PARAMETER) |
223 { | 229 { |
224 print_success(nameOfFunction, result); | 230 print_success(nameOfFunction, result); |
225 print_end_test(nameOfFunction); | 231 print_end_test(nameOfFunction); |
226 Tspi_Context_FreeMemory(hContext, NULL); | 232 Tspi_Context_FreeMemory(hContext, NULL); |
227 Tspi_Context_Close(hContext); | 233 Tspi_Context_Close(hContext); |
228 exit(0); | 234 exit(0); |
229 } | 235 } |
230 else{ | 236 else{ |
231 print_error("Tspi_NV_DefineSpace", result); | 237 print_error("Tspi_NV_DefineSpace", result); |
232 print_end_test(nameOfFunction); | 238 print_end_test(nameOfFunction); |
233 Tspi_Context_FreeMemory(hContext, NULL); | 239 Tspi_Context_FreeMemory(hContext, NULL); |
234 Tspi_Context_Close(hContext); | 240 Tspi_Context_Close(hContext); |
235 if ( result == TSS_SUCCESS ) | 241 if ( result == TSS_SUCCESS ) |
236 exit(-1); | 242 exit(-1); |
237 exit(result); | 243 exit(result); |
238 } | 244 } |
239 #endif | 245 #endif |
240 } | 246 } |
OLD | NEW |