| OLD | NEW |
| 1 /* Software-Based Trusted Platform Module (TPM) Emulator for Linux | 1 /* Software-based Trusted Platform Module (TPM) Emulator |
| 2 * Copyright (C) 2004 Mario Strasser <mast@gmx.net>, | 2 * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net> |
| 3 * Swiss Federal Institute of Technology (ETH) Zurich | |
| 4 * | 3 * |
| 5 * This module is free software; you can redistribute it and/or modify | 4 * This module is free software; you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License as published | 5 * it under the terms of the GNU General Public License as published |
| 7 * by the Free Software Foundation; either version 2 of the License, | 6 * by the Free Software Foundation; either version 2 of the License, |
| 8 * or (at your option) any later version. | 7 * or (at your option) any later version. |
| 9 * | 8 * |
| 10 * This module is distributed in the hope that it will be useful, | 9 * This module is distributed in the hope that it will be useful, |
| 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 14 * | 13 * |
| 15 * $Id$ | 14 * $Id: tpm_startup.c 367 2010-02-13 15:52:18Z mast $ |
| 16 */ | 15 */ |
| 17 | 16 |
| 18 #include "tpm_emulator.h" | 17 #include "tpm_emulator.h" |
| 19 #include "tpm_commands.h" | 18 #include "tpm_commands.h" |
| 20 #include "tpm_data.h" | 19 #include "tpm_data.h" |
| 21 #include "tpm_handles.h" | 20 #include "tpm_handles.h" |
| 22 | 21 |
| 23 /* | 22 /* |
| 24 * Admin Startup and State ([TPM_Part3], Section 3) | 23 * Admin Startup and State ([TPM_Part3], Section 3) |
| 25 * This section describes the commands that start a TPM. | 24 * This section describes the commands that start a TPM. |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 else | 59 else |
| 61 SET_TO_ZERO(&tpmData.permanent.data.pcrValue[i].digest); | 60 SET_TO_ZERO(&tpmData.permanent.data.pcrValue[i].digest); |
| 62 } | 61 } |
| 63 /* reset STCLEAR_FLAGS */ | 62 /* reset STCLEAR_FLAGS */ |
| 64 SET_TO_ZERO(&tpmData.stclear.flags); | 63 SET_TO_ZERO(&tpmData.stclear.flags); |
| 65 tpmData.stclear.flags.tag = TPM_TAG_STCLEAR_FLAGS; | 64 tpmData.stclear.flags.tag = TPM_TAG_STCLEAR_FLAGS; |
| 66 tpmData.stclear.flags.deactivated = tpmData.permanent.flags.deactivated; | 65 tpmData.stclear.flags.deactivated = tpmData.permanent.flags.deactivated; |
| 67 /* reset STCLEAR_DATA */ | 66 /* reset STCLEAR_DATA */ |
| 68 SET_TO_ZERO(&tpmData.stclear.data); | 67 SET_TO_ZERO(&tpmData.stclear.data); |
| 69 tpmData.stclear.data.tag = TPM_TAG_STCLEAR_DATA; | 68 tpmData.stclear.data.tag = TPM_TAG_STCLEAR_DATA; |
| 70 /* flush volatiles and PCR dependent keys keys */ | 69 /* flush volatiles and PCR dependent keys */ |
| 71 for (i = 0; i < TPM_MAX_KEYS; i++) { | 70 for (i = 0; i < TPM_MAX_KEYS; i++) { |
| 72 if (tpmData.permanent.data.keys[i].payload | 71 if (tpmData.permanent.data.keys[i].payload |
| 73 && ((tpmData.permanent.data.keys[i].keyFlags & TPM_KEY_FLAG_VOLATILE) | 72 && ((tpmData.permanent.data.keys[i].keyFlags & TPM_KEY_FLAG_VOLATILE) |
| 74 || tpmData.permanent.data.keys[i].parentPCRStatus)) | 73 || tpmData.permanent.data.keys[i].parentPCRStatus)) |
| 75 TPM_FlushSpecific(INDEX_TO_KEY_HANDLE(i), TPM_RT_KEY); | 74 TPM_FlushSpecific(INDEX_TO_KEY_HANDLE(i), TPM_RT_KEY); |
| 76 } | 75 } |
| 77 /* init key-context nonce */ | 76 /* init key-context nonce */ |
| 78 SET_TO_RAND(&tpmData.stclear.data.contextNonceKey); | 77 SET_TO_RAND(&tpmData.stclear.data.contextNonceKey); |
| 79 /* invalidate counter handle */ | 78 /* invalidate counter handle */ |
| 80 tpmData.stclear.data.countID = TPM_INVALID_HANDLE; | 79 tpmData.stclear.data.countID = TPM_INVALID_HANDLE; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 105 TPM_RESULT TPM_SaveState() | 104 TPM_RESULT TPM_SaveState() |
| 106 { | 105 { |
| 107 info("TPM_SaveState()"); | 106 info("TPM_SaveState()"); |
| 108 if (tpmData.permanent.flags.selfTestSucceeded && !tpmData.stclear.flags.deacti
vated) { | 107 if (tpmData.permanent.flags.selfTestSucceeded && !tpmData.stclear.flags.deacti
vated) { |
| 109 return (tpm_store_permanent_data()) ? TPM_FAIL : TPM_SUCCESS; | 108 return (tpm_store_permanent_data()) ? TPM_FAIL : TPM_SUCCESS; |
| 110 } else { | 109 } else { |
| 111 debug("TPM is deactivated or in fail-stop mode, thus the permanent data is n
ot stored"); | 110 debug("TPM is deactivated or in fail-stop mode, thus the permanent data is n
ot stored"); |
| 112 return TPM_SUCCESS; | 111 return TPM_SUCCESS; |
| 113 } | 112 } |
| 114 } | 113 } |
| OLD | NEW |