diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2012-11-25 14:36:20 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2012-11-25 14:36:20 +0000 |
commit | c3649a2def02c41d837ae1f79dda729ccb91e677 (patch) | |
tree | bea46dff212fdef977fe9094a70a939e8cc21885 /src/tcs/tcsi_context.c | |
download | trousers-upstream.tar.gz |
Imported Upstream version 0.3.9upstream/0.3.9upstream
Diffstat (limited to 'src/tcs/tcsi_context.c')
-rw-r--r-- | src/tcs/tcsi_context.c | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/tcs/tcsi_context.c b/src/tcs/tcsi_context.c new file mode 100644 index 0000000..d6fe606 --- /dev/null +++ b/src/tcs/tcsi_context.c @@ -0,0 +1,62 @@ + +/* + * Licensed Materials - Property of IBM + * + * trousers - An open source TCG Software Stack + * + * (C) Copyright International Business Machines Corp. 2004 + * + */ + + +#include <stdlib.h> +#include <stdio.h> + +#include "trousers/tss.h" +#include "trousers_types.h" +#include "tcs_tsp.h" +#include "tcs_utils.h" +#include "tcs_int_literals.h" +#include "capabilities.h" +#include "tcslog.h" + + +TSS_RESULT +TCS_OpenContext_Internal(TCS_CONTEXT_HANDLE * hContext) /* out */ +{ + *hContext = make_context(); + if (*hContext == 0) + return TCSERR(TSS_E_OUTOFMEMORY); + + return TSS_SUCCESS; +} + +TSS_RESULT +TCS_CloseContext_Internal(TCS_CONTEXT_HANDLE hContext) /* in */ +{ + TSS_RESULT result; + + LogDebug("Closing context %.8X", hContext); + + if ((result = ctx_verify_context(hContext))) + return result; + + destroy_context(hContext); + + /* close all auth handles associated with hContext */ + auth_mgr_close_context(hContext); + + KEY_MGR_ref_count(); + + LogDebug("Context %.8X closed", hContext); + return TSS_SUCCESS; +} + +TSS_RESULT +TCS_FreeMemory_Internal(TCS_CONTEXT_HANDLE hContext, /* in */ + BYTE *pMemory) /* in */ +{ + free(pMemory); + + return TSS_SUCCESS; +} |