From c3649a2def02c41d837ae1f79dda729ccb91e677 Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Sun, 25 Nov 2012 14:36:20 +0000 Subject: Imported Upstream version 0.3.9 --- src/tspi/tspi_oper.c | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 src/tspi/tspi_oper.c (limited to 'src/tspi/tspi_oper.c') diff --git a/src/tspi/tspi_oper.c b/src/tspi/tspi_oper.c new file mode 100644 index 0000000..01db9ff --- /dev/null +++ b/src/tspi/tspi_oper.c @@ -0,0 +1,52 @@ + +/* + * Licensed Materials - Property of IBM + * + * trousers - An open source TCG Software Stack + * + * (C) Copyright International Business Machines Corp. 2007 + * + */ + + +#include +#include +#include + +#include "trousers/tss.h" +#include "trousers/trousers.h" +#include "trousers_types.h" +#include "spi_utils.h" +#include "obj.h" +#include "tsplog.h" + + +TSS_RESULT +Tspi_TPM_SetOperatorAuth(TSS_HTPM hTpm, /* in */ + TSS_HPOLICY hOperatorPolicy) /* in */ +{ + TSS_HCONTEXT tspContext; + UINT32 type; + TCPA_SECRET operatorAuth; + TSS_RESULT result = TSS_SUCCESS; + + if ((result = obj_tpm_get_tsp_context(hTpm, &tspContext))) + return result; + + if ((result = obj_policy_get_type(hOperatorPolicy, &type))) + return result; + + if (type != TSS_POLICY_OPERATOR) + return TSPERR(TSS_E_BAD_PARAMETER); + + if ((result = obj_policy_get_secret(hOperatorPolicy, TR_SECRET_CTX_NEW, &operatorAuth))) + return result; + + if ((result = TCS_API(tspContext)->SetOperatorAuth(tspContext, &operatorAuth))) + return result; + + if ((result = obj_tpm_set_policy(hTpm, hOperatorPolicy))) + return result; + + return result; +} -- cgit v1.2.3