summaryrefslogtreecommitdiff
path: root/src/tspi/tsp_oper.c
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2012-11-25 14:36:20 +0000
committerIgor Pashev <pashev.igor@gmail.com>2012-11-25 14:36:20 +0000
commitc3649a2def02c41d837ae1f79dda729ccb91e677 (patch)
treebea46dff212fdef977fe9094a70a939e8cc21885 /src/tspi/tsp_oper.c
downloadtrousers-c3649a2def02c41d837ae1f79dda729ccb91e677.tar.gz
Imported Upstream version 0.3.9upstream/0.3.9upstream
Diffstat (limited to 'src/tspi/tsp_oper.c')
-rw-r--r--src/tspi/tsp_oper.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/tspi/tsp_oper.c b/src/tspi/tsp_oper.c
new file mode 100644
index 0000000..092b5ce
--- /dev/null
+++ b/src/tspi/tsp_oper.c
@@ -0,0 +1,48 @@
+
+/*
+ * Licensed Materials - Property of IBM
+ *
+ * trousers - An open source TCG Software Stack
+ *
+ * (C) Copyright International Business Machines Corp. 2004-2007
+ *
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+
+#include "trousers/tss.h"
+#include "trousers/trousers.h"
+#include "trousers_types.h"
+#include "spi_utils.h"
+#include "capabilities.h"
+#include "tsplog.h"
+#include "obj.h"
+
+
+#ifdef TSS_BUILD_TRANSPORT
+TSS_RESULT
+Transport_SetOperatorAuth(TSS_HCONTEXT tspContext, /* in */
+ TCPA_SECRET *operatorAuth) /* in */
+{
+ TSS_RESULT result;
+ UINT64 offset;
+ TCS_HANDLE handlesLen = 0;
+ BYTE data[sizeof(TCPA_SECRET)];
+
+ if ((result = obj_context_transport_init(tspContext)))
+ return result;
+
+ LogDebugFn("Executing in a transport session");
+
+ offset = 0;
+ Trspi_LoadBlob(&offset, TPM_SHA1_160_HASH_LEN, data, operatorAuth->authdata);
+
+ return obj_context_transport_execute(tspContext, TPM_ORD_SetOperatorAuth, sizeof(data),
+ data, NULL, &handlesLen, NULL, NULL, NULL, NULL, NULL);
+}
+#endif