OLD | NEW |
(Empty) | |
| 1 /* Software-based Mobile Trusted Module (MTM) Emulator |
| 2 * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net> |
| 3 * |
| 4 * This module is free software; you can redistribute it and/or modify |
| 5 * it under the terms of the GNU General Public License as published |
| 6 * by the Free Software Foundation; either version 2 of the License, |
| 7 * or (at your option) any later version. |
| 8 * |
| 9 * This module is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. |
| 13 * |
| 14 * $Id$ |
| 15 */ |
| 16 |
| 17 #include "mtm_structures.h" |
| 18 #include "mtm_data.h" |
| 19 #include "tpm/tpm_commands.h" |
| 20 |
| 21 TPM_RESULT MTM_Extend(TPM_PCRINDEX pcrNum, TPM_DIGEST *inDigest, |
| 22 TPM_PCRVALUE *outDigest) |
| 23 { |
| 24 info("MTM_Extend()"); |
| 25 if (mtmData.permanent.data.verifiedPCRs.pcrSelect[pcrNum >> 3] & (1 << (pcrNum
& 7))) { |
| 26 return TPM_BAD_LOCALITY; |
| 27 } |
| 28 return TPM_Extend(pcrNum, inDigest, outDigest); |
| 29 } |
| 30 |
| 31 TPM_RESULT MTM_PCR_Reset(TPM_PCR_SELECTION *pcrSelection) |
| 32 { |
| 33 int i; |
| 34 info("MTM_PCR_Reset()"); |
| 35 for (i = 0; i < pcrSelection->sizeOfSelect * 8; i++) { |
| 36 if ((pcrSelection->pcrSelect[i >> 3] & (1 << (i & 7))) |
| 37 && (mtmData.permanent.data.verifiedPCRs.pcrSelect[i >> 3] & (1 << (i & 7
)))) { |
| 38 return TPM_FAIL; |
| 39 } |
| 40 } |
| 41 return TPM_PCR_Reset(pcrSelection); |
| 42 } |
| 43 |
OLD | NEW |