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_commands.h"
18 #include "mtm_handles.h"
19 #include "tpm/tpm_commands.h"
20 
MTM_FlushSpecific(TPM_HANDLE handle,TPM_RESOURCE_TYPE resourceType)21 TPM_RESULT MTM_FlushSpecific(TPM_HANDLE handle,
22                              TPM_RESOURCE_TYPE resourceType)
23 {
24   MTM_KEY_DATA *key;
25 
26   info("MTM_FlushSpecific()");
27   debug("handle = %08x, resourceType = %08x", handle, resourceType);
28   if (resourceType == TPM_RT_KEY) {
29     key = mtm_get_key(handle);
30     if (key != NULL) {
31       free_MTM_KEY_DATA((*key));
32       memset(key, 0, sizeof(*key));
33       tpm_invalidate_sessions(handle);
34       return TPM_SUCCESS;
35     }
36   }
37   return TPM_FlushSpecific(handle, resourceType);
38 }
39 
40