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_authorization.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_handles.h" | 19 #include "tpm_handles.h" |
21 #include "tpm_data.h" | 20 #include "tpm_data.h" |
22 #include "tpm_marshalling.h" | 21 #include "tpm_marshalling.h" |
23 #include "crypto/hmac.h" | 22 #include "crypto/hmac.h" |
24 #include "crypto/sha1.h" | 23 #include "crypto/sha1.h" |
25 | 24 |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 switch (entityType & 0x00FF) { | 189 switch (entityType & 0x00FF) { |
191 case TPM_ET_KEYHANDLE: | 190 case TPM_ET_KEYHANDLE: |
192 session->handle = entityValue; | 191 session->handle = entityValue; |
193 if (session->handle == TPM_KH_OPERATOR) return TPM_BAD_HANDLE; | 192 if (session->handle == TPM_KH_OPERATOR) return TPM_BAD_HANDLE; |
194 if (tpm_get_key(session->handle) != NULL) | 193 if (tpm_get_key(session->handle) != NULL) |
195 secret = &tpm_get_key(session->handle)->usageAuth; | 194 secret = &tpm_get_key(session->handle)->usageAuth; |
196 else | 195 else |
197 debug("TPM_OSAP failed(): tpm_get_key(handle) == NULL"); | 196 debug("TPM_OSAP failed(): tpm_get_key(handle) == NULL"); |
198 break; | 197 break; |
199 case TPM_ET_OWNER: | 198 case TPM_ET_OWNER: |
| 199 case TPM_ET_VERIFICATION_AUTH: |
200 session->handle = TPM_KH_OWNER; | 200 session->handle = TPM_KH_OWNER; |
201 if (tpmData.permanent.flags.owned) | 201 if (tpmData.permanent.flags.owned) |
202 secret = &tpmData.permanent.data.ownerAuth; | 202 secret = &tpmData.permanent.data.ownerAuth; |
203 break; | 203 break; |
204 case TPM_ET_SRK: | 204 case TPM_ET_SRK: |
205 session->handle = TPM_KH_SRK; | 205 session->handle = TPM_KH_SRK; |
206 if (tpmData.permanent.data.srk.payload) | 206 if (tpmData.permanent.data.srk.payload) |
207 secret = &tpmData.permanent.data.srk.usageAuth; | 207 secret = &tpmData.permanent.data.srk.usageAuth; |
208 break; | 208 break; |
209 case TPM_ET_COUNTER: | 209 case TPM_ET_COUNTER: |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 { | 582 { |
583 unsigned int i; | 583 unsigned int i; |
584 tpm_sha1_ctx_t ctx; | 584 tpm_sha1_ctx_t ctx; |
585 tpm_sha1_init(&ctx); | 585 tpm_sha1_init(&ctx); |
586 tpm_sha1_update(&ctx, secret, sizeof(TPM_SECRET)); | 586 tpm_sha1_update(&ctx, secret, sizeof(TPM_SECRET)); |
587 tpm_sha1_update(&ctx, nonce->nonce, sizeof(nonce->nonce)); | 587 tpm_sha1_update(&ctx, nonce->nonce, sizeof(nonce->nonce)); |
588 tpm_sha1_final(&ctx, plainAuth); | 588 tpm_sha1_final(&ctx, plainAuth); |
589 for (i = 0; i < sizeof(TPM_SECRET); i++) | 589 for (i = 0; i < sizeof(TPM_SECRET); i++) |
590 plainAuth[i] ^= encAuth[i]; | 590 plainAuth[i] ^= encAuth[i]; |
591 } | 591 } |
OLD | NEW |