Removes the carriage returns from some of the vtpm

source files that were edited in windows at some point.

Signed-off-by: Vinnie Scarlata <vincent.r.scarlata@intel.com>
This commit is contained in:
kaf24@firebug.cl.cam.ac.uk committed 2005-11-30 12:07:28 +01:00
1 parent af9e4ad732
commit 4b3fd3a9f3
10 files changed
+1509 -1516

No files matched your search

+19 -19
View File
@@ -1,19 +1,19 @@
XEN_ROOT = ../../..
include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
BIN = libtcpaCrypto.a
all: build
build: $(BIN)
install: build
clean:
rm -f *.a *.so *.o *.rpm $(DEP_FILES)
mrproper: clean
rm -f *~
$(BIN): $(OBJS)
$(AR) rcs $(BIN) $(OBJS)
XEN_ROOT = ../../..
include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
BIN = libtcpaCrypto.a
all: build
build: $(BIN)
install: build
clean:
rm -f *.a *.so *.o *.rpm $(DEP_FILES)
mrproper: clean
rm -f *~
$(BIN): $(OBJS)
$(AR) rcs $(BIN) $(OBJS)
+27 -27
View File
@@ -1,27 +1,27 @@
XEN_ROOT = ../../..
include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
BIN = vtpm_managerd
all: build
build: $(BIN)
install: build
if [ ! -d "$(DESTDIR)/var/vtpm/fifos" ]; \
then mkdir -p $(DESTDIR)/var/vtpm/fifos; \
fi
$(INSTALL_PROG) $(BIN) $(TOOLS_INSTALL_DIR)
clean:
rm -f *.a *.so *.o *.rpm $(DEP_FILES)
mrproper: clean
rm -f $(BIN) *~
$(BIN): $(OBJS)
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
# libraries
LIBS += ../tcs/libTCS.a ../util/libTCGUtils.a ../crypto/libtcpaCrypto.a
LIBS += -lcrypto -lpthread -lrt -lm
XEN_ROOT = ../../..
include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
BIN = vtpm_managerd
all: build
build: $(BIN)
install: build
if [ ! -d "$(DESTDIR)/var/vtpm/fifos" ]; \
then mkdir -p $(DESTDIR)/var/vtpm/fifos; \
fi
$(INSTALL_PROG) $(BIN) $(TOOLS_INSTALL_DIR)
clean:
rm -f *.a *.so *.o *.rpm $(DEP_FILES)
mrproper: clean
rm -f $(BIN) *~
$(BIN): $(OBJS)
$(CC) $(LDFLAGS) $^ $(LIBS) -o $@
# libraries
LIBS += ../tcs/libTCS.a ../util/libTCGUtils.a ../crypto/libtcpaCrypto.a
LIBS += -lcrypto -lpthread -lrt -lm
+110 -110
View File
@@ -1,110 +1,110 @@
// ===================================================================
//
// Copyright (c) 2005, Intel Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Intel Corporation nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
// ===================================================================
//
// tpmpassthrough.c
//
// Functions regarding passing DMI requests to HWTPM
//
// ==================================================================
#include "tcg.h"
#include "vtpm_manager.h"
#include "vtpmpriv.h"
#include "vtsp.h"
#include "log.h"
TPM_RESULT VTPM_Handle_TPM_Command( VTPM_DMI_RESOURCE *dmi,
buffer_t *inbuf,
buffer_t *outbuf) {
TPM_RESULT status = TPM_SUCCESS;
TPM_COMMAND_CODE *ord;
ord = (TPM_COMMAND_CODE *) (inbuf->bytes + sizeof(TPM_TAG) + sizeof(UINT32));
switch (*ord) {
// Forbidden for DMI use
case TPM_ORD_TakeOwnership:
case TPM_ORD_ChangeAuthOwner:
case TPM_ORD_DirWriteAuth:
case TPM_ORD_DirRead:
case TPM_ORD_AuthorizeMigrationKey:
case TPM_ORD_CreateMaintenanceArchive:
case TPM_ORD_LoadMaintenanceArchive:
case TPM_ORD_KillMaintenanceFeature:
case TPM_ORD_LoadManuMaintPub:
case TPM_ORD_ReadManuMaintPub:
case TPM_ORD_SelfTestFull:
case TPM_ORD_SelfTestStartup:
case TPM_ORD_CertifySelfTest:
case TPM_ORD_ContinueSelfTest:
case TPM_ORD_GetTestResult:
case TPM_ORD_Reset:
case TPM_ORD_OwnerClear:
case TPM_ORD_DisableOwnerClear:
case TPM_ORD_ForceClear:
case TPM_ORD_DisableForceClear:
case TPM_ORD_GetCapabilityOwner:
case TPM_ORD_OwnerSetDisable:
case TPM_ORD_PhysicalEnable:
case TPM_ORD_PhysicalDisable:
case TPM_ORD_SetOwnerInstall:
case TPM_ORD_PhysicalSetDeactivated:
case TPM_ORD_SetTempDeactivated:
case TPM_ORD_CreateEndorsementKeyPair:
case TPM_ORD_GetAuditEvent:
case TPM_ORD_GetAuditEventSigned:
case TPM_ORD_GetOrdinalAuditStatus:
case TPM_ORD_SetOrdinalAuditStatus:
case TPM_ORD_SetRedirection:
case TPM_ORD_FieldUpgrade:
case TSC_ORD_PhysicalPresence:
status = TPM_DISABLED_CMD;
goto abort_egress;
break;
} // End ORD Switch
// Call TCS with command
TPMTRY(TPM_IOERROR, VTSP_RawTransmit( dmi->TCSContext,inbuf, outbuf) );
goto egress;
abort_egress:
vtpmloginfo(VTPM_LOG_VTPM, "TPM Command Failed in tpmpassthrough.\n");
egress:
return status;
}
// ===================================================================
//
// Copyright (c) 2005, Intel Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Intel Corporation nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
// ===================================================================
//
// tpmpassthrough.c
//
// Functions regarding passing DMI requests to HWTPM
//
// ==================================================================
#include "tcg.h"
#include "vtpm_manager.h"
#include "vtpmpriv.h"
#include "vtsp.h"
#include "log.h"
TPM_RESULT VTPM_Handle_TPM_Command( VTPM_DMI_RESOURCE *dmi,
buffer_t *inbuf,
buffer_t *outbuf) {
TPM_RESULT status = TPM_SUCCESS;
TPM_COMMAND_CODE *ord;
ord = (TPM_COMMAND_CODE *) (inbuf->bytes + sizeof(TPM_TAG) + sizeof(UINT32));
switch (*ord) {
// Forbidden for DMI use
case TPM_ORD_TakeOwnership:
case TPM_ORD_ChangeAuthOwner:
case TPM_ORD_DirWriteAuth:
case TPM_ORD_DirRead:
case TPM_ORD_AuthorizeMigrationKey:
case TPM_ORD_CreateMaintenanceArchive:
case TPM_ORD_LoadMaintenanceArchive:
case TPM_ORD_KillMaintenanceFeature:
case TPM_ORD_LoadManuMaintPub:
case TPM_ORD_ReadManuMaintPub:
case TPM_ORD_SelfTestFull:
case TPM_ORD_SelfTestStartup:
case TPM_ORD_CertifySelfTest:
case TPM_ORD_ContinueSelfTest:
case TPM_ORD_GetTestResult:
case TPM_ORD_Reset:
case TPM_ORD_OwnerClear:
case TPM_ORD_DisableOwnerClear:
case TPM_ORD_ForceClear:
case TPM_ORD_DisableForceClear:
case TPM_ORD_GetCapabilityOwner:
case TPM_ORD_OwnerSetDisable:
case TPM_ORD_PhysicalEnable:
case TPM_ORD_PhysicalDisable:
case TPM_ORD_SetOwnerInstall:
case TPM_ORD_PhysicalSetDeactivated:
case TPM_ORD_SetTempDeactivated:
case TPM_ORD_CreateEndorsementKeyPair:
case TPM_ORD_GetAuditEvent:
case TPM_ORD_GetAuditEventSigned:
case TPM_ORD_GetOrdinalAuditStatus:
case TPM_ORD_SetOrdinalAuditStatus:
case TPM_ORD_SetRedirection:
case TPM_ORD_FieldUpgrade:
case TSC_ORD_PhysicalPresence:
status = TPM_DISABLED_CMD;
goto abort_egress;
break;
} // End ORD Switch
// Call TCS with command
TPMTRY(TPM_IOERROR, VTSP_RawTransmit( dmi->TCSContext,inbuf, outbuf) );
goto egress;
abort_egress:
vtpmloginfo(VTPM_LOG_VTPM, "TPM Command Failed in tpmpassthrough.\n");
egress:
return status;
}
+137 -137
View File
@@ -1,137 +1,137 @@
// ===================================================================
//
// Copyright (c) 2005, Intel Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Intel Corporation nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
// ===================================================================
//
// vtpm_manager.h
//
// Public Interface header for VTPM Manager
//
// ==================================================================
#ifndef __VTPM_MANAGER_H__
#define __VTPM_MANAGER_H__
#include "tcg.h"
#define VTPM_TAG_REQ 0x01c1
#define VTPM_TAG_RSP 0x01c4
#define COMMAND_BUFFER_SIZE 4096
// Header sizes. Note Header MAY include the DMI
#define VTPM_COMMAND_HEADER_SIZE_SRV ( sizeof(UINT32) + sizeof(TPM_TAG) + sizeof(UINT32) + sizeof(TPM_COMMAND_CODE))
#define VTPM_COMMAND_HEADER_SIZE_CLT ( sizeof(TPM_TAG) + sizeof(UINT32) + sizeof(TPM_COMMAND_CODE))
// ********************** Public Functions *************************
TPM_RESULT VTPM_Init_Service(); // Start VTPM Service
void VTPM_Stop_Service(); // Stop VTPM Service
#ifdef VTPM_MULTI_VM
int VTPM_Service_Handler();
#else
void *VTPM_Service_Handler(void *threadTypePtr);
#endif
//************************ Command Codes ****************************
#define VTPM_ORD_OPEN 1 // ULM Creates New DMI
#define VTPM_ORD_CLOSE 2 // ULM Closes a DMI
#define VTPM_ORD_DELETE 3 // ULM Permemently Deletes DMI
#define VTPM_ORD_SAVENVM 4 // DMI requests Secrets Unseal
#define VTPM_ORD_LOADNVM 5 // DMI requests Secrets Saved
#define VTPM_ORD_TPMCOMMAND 6 // DMI issues HW TPM Command
//************************ Return Codes ****************************
#define VTPM_SUCCESS 0
#define VTPM_FAIL 1
#define VTPM_UNSUPPORTED 2
#define VTPM_FORBIDDEN 3
#define VTPM_RESTORE_CONTEXT_FAILED 4
#define VTPM_INVALID_REQUEST 5
/******************* Command Parameter API *************************
VTPM Command Format
dmi: 4 bytes // Source of message.
// WARNING: This is prepended by the channel.
// Thus it is received by VTPM Manager,
// but not sent by DMI
tpm tag: 2 bytes
command size: 4 bytes // Size of command including header but not DMI
ord: 4 bytes // Command ordinal above
parameters: size - 10 bytes // Command Parameter
VTPM Response Format
tpm tag: 2 bytes
response_size: 4 bytes
status: 4 bytes
parameters: size - 10 bytes
VTPM_Open:
Input Parameters:
Domain_type: 1 byte
domain_id: 4 bytes
instance_id: 4 bytes
Output Parameters:
None
VTPM_Close
Input Parameters:
instance_id: 4 bytes
Output Parameters:
None
VTPM_Delete
Input Parameters:
instance_id: 4 bytes
Output Parameters:
None
VTPM_SaveNVM
Input Parameters:
data: n bytes (Header indicates size of data)
Output Parameters:
None
VTPM_LoadNVM
Input Parameters:
None
Output Parameters:
data: n bytes (Header indicates size of data)
VTPM_TPMCommand
Input Parameters:
TPM Command Byte Stream: n bytes
Output Parameters:
TPM Reponse Byte Stream: n bytes
*********************************************************************/
#endif //_VTPM_MANAGER_H_
// ===================================================================
//
// Copyright (c) 2005, Intel Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Intel Corporation nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
// ===================================================================
//
// vtpm_manager.h
//
// Public Interface header for VTPM Manager
//
// ==================================================================
#ifndef __VTPM_MANAGER_H__
#define __VTPM_MANAGER_H__
#include "tcg.h"
#define VTPM_TAG_REQ 0x01c1
#define VTPM_TAG_RSP 0x01c4
#define COMMAND_BUFFER_SIZE 4096
// Header sizes. Note Header MAY include the DMI
#define VTPM_COMMAND_HEADER_SIZE_SRV ( sizeof(UINT32) + sizeof(TPM_TAG) + sizeof(UINT32) + sizeof(TPM_COMMAND_CODE))
#define VTPM_COMMAND_HEADER_SIZE_CLT ( sizeof(TPM_TAG) + sizeof(UINT32) + sizeof(TPM_COMMAND_CODE))
// ********************** Public Functions *************************
TPM_RESULT VTPM_Init_Service(); // Start VTPM Service
void VTPM_Stop_Service(); // Stop VTPM Service
#ifdef VTPM_MULTI_VM
int VTPM_Service_Handler();
#else
void *VTPM_Service_Handler(void *threadTypePtr);
#endif
//************************ Command Codes ****************************
#define VTPM_ORD_OPEN 1 // ULM Creates New DMI
#define VTPM_ORD_CLOSE 2 // ULM Closes a DMI
#define VTPM_ORD_DELETE 3 // ULM Permemently Deletes DMI
#define VTPM_ORD_SAVENVM 4 // DMI requests Secrets Unseal
#define VTPM_ORD_LOADNVM 5 // DMI requests Secrets Saved
#define VTPM_ORD_TPMCOMMAND 6 // DMI issues HW TPM Command
//************************ Return Codes ****************************
#define VTPM_SUCCESS 0
#define VTPM_FAIL 1
#define VTPM_UNSUPPORTED 2
#define VTPM_FORBIDDEN 3
#define VTPM_RESTORE_CONTEXT_FAILED 4
#define VTPM_INVALID_REQUEST 5
/******************* Command Parameter API *************************
VTPM Command Format
dmi: 4 bytes // Source of message.
// WARNING: This is prepended by the channel.
// Thus it is received by VTPM Manager,
// but not sent by DMI
tpm tag: 2 bytes
command size: 4 bytes // Size of command including header but not DMI
ord: 4 bytes // Command ordinal above
parameters: size - 10 bytes // Command Parameter
VTPM Response Format
tpm tag: 2 bytes
response_size: 4 bytes
status: 4 bytes
parameters: size - 10 bytes
VTPM_Open:
Input Parameters:
Domain_type: 1 byte
domain_id: 4 bytes
instance_id: 4 bytes
Output Parameters:
None
VTPM_Close
Input Parameters:
instance_id: 4 bytes
Output Parameters:
None
VTPM_Delete
Input Parameters:
instance_id: 4 bytes
Output Parameters:
None
VTPM_SaveNVM
Input Parameters:
data: n bytes (Header indicates size of data)
Output Parameters:
None
VTPM_LoadNVM
Input Parameters:
None
Output Parameters:
data: n bytes (Header indicates size of data)
VTPM_TPMCommand
Input Parameters:
TPM Command Byte Stream: n bytes
Output Parameters:
TPM Reponse Byte Stream: n bytes
*********************************************************************/
#endif //_VTPM_MANAGER_H_
+134 -134
View File
@@ -1,134 +1,134 @@
// ===================================================================
//
// Copyright (c) 2005, Intel Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Intel Corporation nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
// ===================================================================
//
// vtpmd.c
//
// Application
//
// ===================================================================
#include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include "vtpm_manager.h"
#include "vtpmpriv.h"
#include "tcg.h"
#include "log.h"
#ifndef VTPM_MULTI_VM
#include <pthread.h>
#endif
void signal_handler(int reason) {
#ifndef VTPM_MULTI_VM
if (pthread_equal(pthread_self(), vtpm_globals->master_pid)) {
if (reason >= 0) { // Reason is a signal
vtpmloginfo(VTPM_LOG_VTPM, "VTPM Manager shutting down for signal %d.\n", reason);
} else {// Reason is a TPM_RESULT * -1
vtpmloginfo(VTPM_LOG_VTPM,"VTPM Manager shuting down for: %s\n", tpm_get_error_name(-1 * reason) );
}
return;
} else {
vtpmloginfo(VTPM_LOG_VTPM, "Child shutting down\n");
pthread_exit(NULL);
}
#else
VTPM_Stop_Service();
exit(-1);
#endif
}
struct sigaction ctl_c_handler;
int main(int argc, char **argv) {
vtpmloginfo(VTPM_LOG_VTPM, "Starting VTPM.\n");
if (VTPM_Init_Service() != TPM_SUCCESS) {
vtpmlogerror(VTPM_LOG_VTPM, "Closing vtpmd due to error during startup.\n");
return -1;
}
ctl_c_handler.sa_handler = signal_handler;
sigemptyset(&ctl_c_handler.sa_mask);
ctl_c_handler.sa_flags = 0;
if (sigaction(SIGINT, &ctl_c_handler, NULL) == -1)
vtpmlogerror(VTPM_LOG_VTPM, "Could not install SIGINT handler. Ctl+break will not stop service gently.\n");
// For easier debuggin with gdb
if (sigaction(SIGHUP, &ctl_c_handler, NULL) == -1)
vtpmlogerror(VTPM_LOG_VTPM, "Could not install SIGHUP handler. Ctl+break will not stop service gently.\n");
#ifdef VTPM_MULTI_VM
TPM_RESULT status = VTPM_Service_Handler();
if (status != TPM_SUCCESS)
vtpmlogerror(VTPM_LOG_VTPM, "VTPM Manager exited with status %s. It never should exit.\n", tpm_get_error_name(status));
return -1;
#else
sigset_t sig_mask;
sigemptyset(&sig_mask);
sigaddset(&sig_mask, SIGPIPE);
sigprocmask(SIG_BLOCK, &sig_mask, NULL);
//pthread_mutex_init(&vtpm_globals->dmi_mutex, NULL);
pthread_t be_thread, dmi_thread;
int betype_be, dmitype_dmi;
vtpm_globals->master_pid = pthread_self();
betype_be = BE_LISTENER_THREAD;
if (pthread_create(&be_thread, NULL, VTPM_Service_Handler, &betype_be) != 0) {
vtpmlogerror(VTPM_LOG_VTPM, "Failed to launch BE Thread.\n");
exit(-1);
}
dmitype_dmi = DMI_LISTENER_THREAD;
if (pthread_create(&dmi_thread, NULL, VTPM_Service_Handler, &dmitype_dmi) != 0) {
vtpmlogerror(VTPM_LOG_VTPM, "Failed to launch DMI Thread.\n");
exit(-1);
}
//Join the other threads until exit time.
pthread_join(be_thread, NULL);
pthread_join(dmi_thread, NULL);
VTPM_Stop_Service();
return 0;
#endif
}
// ===================================================================
//
// Copyright (c) 2005, Intel Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Intel Corporation nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
// ===================================================================
//
// vtpmd.c
//
// Application
//
// ===================================================================
#include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include "vtpm_manager.h"
#include "vtpmpriv.h"
#include "tcg.h"
#include "log.h"
#ifndef VTPM_MULTI_VM
#include <pthread.h>
#endif
void signal_handler(int reason) {
#ifndef VTPM_MULTI_VM
if (pthread_equal(pthread_self(), vtpm_globals->master_pid)) {
if (reason >= 0) { // Reason is a signal
vtpmloginfo(VTPM_LOG_VTPM, "VTPM Manager shutting down for signal %d.\n", reason);
} else {// Reason is a TPM_RESULT * -1
vtpmloginfo(VTPM_LOG_VTPM,"VTPM Manager shuting down for: %s\n", tpm_get_error_name(-1 * reason) );
}
return;
} else {
vtpmloginfo(VTPM_LOG_VTPM, "Child shutting down\n");
pthread_exit(NULL);
}
#else
VTPM_Stop_Service();
exit(-1);
#endif
}
struct sigaction ctl_c_handler;
int main(int argc, char **argv) {
vtpmloginfo(VTPM_LOG_VTPM, "Starting VTPM.\n");
if (VTPM_Init_Service() != TPM_SUCCESS) {
vtpmlogerror(VTPM_LOG_VTPM, "Closing vtpmd due to error during startup.\n");
return -1;
}
ctl_c_handler.sa_handler = signal_handler;
sigemptyset(&ctl_c_handler.sa_mask);
ctl_c_handler.sa_flags = 0;
if (sigaction(SIGINT, &ctl_c_handler, NULL) == -1)
vtpmlogerror(VTPM_LOG_VTPM, "Could not install SIGINT handler. Ctl+break will not stop service gently.\n");
// For easier debuggin with gdb
if (sigaction(SIGHUP, &ctl_c_handler, NULL) == -1)
vtpmlogerror(VTPM_LOG_VTPM, "Could not install SIGHUP handler. Ctl+break will not stop service gently.\n");
#ifdef VTPM_MULTI_VM
TPM_RESULT status = VTPM_Service_Handler();
if (status != TPM_SUCCESS)
vtpmlogerror(VTPM_LOG_VTPM, "VTPM Manager exited with status %s. It never should exit.\n", tpm_get_error_name(status));
return -1;
#else
sigset_t sig_mask;
sigemptyset(&sig_mask);
sigaddset(&sig_mask, SIGPIPE);
sigprocmask(SIG_BLOCK, &sig_mask, NULL);
//pthread_mutex_init(&vtpm_globals->dmi_mutex, NULL);
pthread_t be_thread, dmi_thread;
int betype_be, dmitype_dmi;
vtpm_globals->master_pid = pthread_self();
betype_be = BE_LISTENER_THREAD;
if (pthread_create(&be_thread, NULL, VTPM_Service_Handler, &betype_be) != 0) {
vtpmlogerror(VTPM_LOG_VTPM, "Failed to launch BE Thread.\n");
exit(-1);
}
dmitype_dmi = DMI_LISTENER_THREAD;
if (pthread_create(&dmi_thread, NULL, VTPM_Service_Handler, &dmitype_dmi) != 0) {
vtpmlogerror(VTPM_LOG_VTPM, "Failed to launch DMI Thread.\n");
exit(-1);
}
//Join the other threads until exit time.
pthread_join(be_thread, NULL);
pthread_join(dmi_thread, NULL);
VTPM_Stop_Service();
return 0;
#endif
}
+151 -151
View File
@@ -1,151 +1,151 @@
// ===================================================================
//
// Copyright (c) 2005, Intel Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Intel Corporation nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
// ===================================================================
//
// vtpmpriv.h
//
// Structures and functions private to the manager
//
// ==================================================================
#ifndef __VTPMPRIV_H__
#define __VTPMPRIV_H__
#include "tcg.h"
#include "tcs.h"
#include "buffer.h"
#include "crypto.h"
#define STATE_FILE "/var/vtpm/VTPM"
#define DMI_NVM_FILE "/var/vtpm/vtpm_dm_%d.data"
#define VTPM_BE_DEV "/dev/vtpm0"
#define VTPM_CTL_DM 0
#ifndef VTPM_MUTLI_VM
#include <sys/types.h>
#define GUEST_TX_FIFO "/var/vtpm/fifos/guest-to-%d.fifo"
#define GUEST_RX_FIFO "/var/vtpm/fifos/guest-from-all.fifo"
#define VTPM_TX_FIFO "/var/vtpm/fifos/vtpm-to-%d.fifo"
#define VTPM_RX_FIFO "/var/vtpm/fifos/vtpm-from-all.fifo"
#define BE_LISTENER_THREAD 1
#define DMI_LISTENER_THREAD 2
// Seconds until DMI timeout. Timeouts result in DMI being out
// of sync, which may require a reboot of DMI and guest to recover
// from. Don't set this to low. Also note that DMI may issue a TPM
// call so we should expect time to process at DMI + TPM processing.
#define DMI_TIMEOUT 90
#endif
// ------------------------ Private Structures -----------------------
typedef struct VTPM_DMI_RESOURCE_T {
// I/O info for Manager to talk to DMI's over FIFOs
#ifndef VTPM_MUTLI_VM
int guest_tx_fh; // open GUEST_TX_FIFO
int vtpm_tx_fh; // open VTPM_TX_FIFO
char *guest_tx_fname; // open GUEST_TX_FIFO
char *vtpm_tx_fname; // open VTPM_TX_FIFO
pid_t dmi_pid;
#endif
// Non-persistent Information
bool connected;
UINT32 dmi_domain_id;
TCS_CONTEXT_HANDLE TCSContext; // TCS Handle
char *NVMLocation; // NULL term string indicating location
// of NVM.
// Persistent Information about DMI
UINT32 dmi_id;
TPM_DIGEST NVM_measurement; // Equal to the SHA1 of the blob
TPM_DIGEST DMI_measurement; // Correct measurement of the owning DMI
} VTPM_DMI_RESOURCE;
typedef struct tdVTPM_GLOBALS {
// Non-persistent data
int be_fh; // File handle to ipc used to communicate with backend
#ifndef VTPM_MULTI_VM
int vtpm_rx_fh;
int guest_rx_fh;
pid_t master_pid;
#endif
struct hashtable *dmi_map; // Table of all DMI's known indexed by persistent instance #
#ifndef VTPM_MULTI_VM
pthread_mutex_t dmi_map_mutex; //
#endif
TCS_CONTEXT_HANDLE manager_tcs_handle; // TCS Handle used by manager
TPM_HANDLE storageKeyHandle; // Key used by persistent store
CRYPTO_INFO storageKey; // For software encryption
TCS_AUTH keyAuth; // OIAP session for storageKey
BOOL DMI_table_dirty; // Indicates that a command
// has updated the DMI table
// Persistent Data
TPM_AUTHDATA owner_usage_auth; // OwnerAuth of real TPM
TPM_AUTHDATA srk_usage_auth; // SRK Auth of real TPM
buffer_t storageKeyWrap; // Wrapped copy of storageKey
TPM_AUTHDATA storage_key_usage_auth;
}VTPM_GLOBALS;
//Global dmi map
extern VTPM_GLOBALS *vtpm_globals;
// ********************** Command Handler Prototypes ***********************
TPM_RESULT VTPM_Handle_Load_NVM( VTPM_DMI_RESOURCE *myDMI,
const buffer_t *inbuf,
buffer_t *outbuf);
TPM_RESULT VTPM_Handle_Save_NVM( VTPM_DMI_RESOURCE *myDMI,
const buffer_t *inbuf,
buffer_t *outbuf);
TPM_RESULT VTPM_Handle_TPM_Command( VTPM_DMI_RESOURCE *dmi,
buffer_t *inbuf,
buffer_t *outbuf);
TPM_RESULT VTPM_Handle_New_DMI(const buffer_t *param_buf);
TPM_RESULT VTPM_Handle_Close_DMI(const buffer_t *param_buf);
TPM_RESULT VTPM_Handle_Delete_DMI(const buffer_t *param_buf);
TPM_RESULT VTPM_SaveService(void);
TPM_RESULT VTPM_LoadService(void);
TPM_RESULT close_dmi( VTPM_DMI_RESOURCE *dmi_res);
#endif // __VTPMPRIV_H__
// ===================================================================
//
// Copyright (c) 2005, Intel Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Intel Corporation nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
// ===================================================================
//
// vtpmpriv.h
//
// Structures and functions private to the manager
//
// ==================================================================
#ifndef __VTPMPRIV_H__
#define __VTPMPRIV_H__
#include "tcg.h"
#include "tcs.h"
#include "buffer.h"
#include "crypto.h"
#define STATE_FILE "/var/vtpm/VTPM"
#define DMI_NVM_FILE "/var/vtpm/vtpm_dm_%d.data"
#define VTPM_BE_DEV "/dev/vtpm0"
#define VTPM_CTL_DM 0
#ifndef VTPM_MUTLI_VM
#include <sys/types.h>
#define GUEST_TX_FIFO "/var/vtpm/fifos/guest-to-%d.fifo"
#define GUEST_RX_FIFO "/var/vtpm/fifos/guest-from-all.fifo"
#define VTPM_TX_FIFO "/var/vtpm/fifos/vtpm-to-%d.fifo"
#define VTPM_RX_FIFO "/var/vtpm/fifos/vtpm-from-all.fifo"
#define BE_LISTENER_THREAD 1
#define DMI_LISTENER_THREAD 2
// Seconds until DMI timeout. Timeouts result in DMI being out
// of sync, which may require a reboot of DMI and guest to recover
// from. Don't set this to low. Also note that DMI may issue a TPM
// call so we should expect time to process at DMI + TPM processing.
#define DMI_TIMEOUT 90
#endif
// ------------------------ Private Structures -----------------------
typedef struct VTPM_DMI_RESOURCE_T {
// I/O info for Manager to talk to DMI's over FIFOs
#ifndef VTPM_MUTLI_VM
int guest_tx_fh; // open GUEST_TX_FIFO
int vtpm_tx_fh; // open VTPM_TX_FIFO
char *guest_tx_fname; // open GUEST_TX_FIFO
char *vtpm_tx_fname; // open VTPM_TX_FIFO
pid_t dmi_pid;
#endif
// Non-persistent Information
bool connected;
UINT32 dmi_domain_id;
TCS_CONTEXT_HANDLE TCSContext; // TCS Handle
char *NVMLocation; // NULL term string indicating location
// of NVM.
// Persistent Information about DMI
UINT32 dmi_id;
TPM_DIGEST NVM_measurement; // Equal to the SHA1 of the blob
TPM_DIGEST DMI_measurement; // Correct measurement of the owning DMI
} VTPM_DMI_RESOURCE;
typedef struct tdVTPM_GLOBALS {
// Non-persistent data
int be_fh; // File handle to ipc used to communicate with backend
#ifndef VTPM_MULTI_VM
int vtpm_rx_fh;
int guest_rx_fh;
pid_t master_pid;
#endif
struct hashtable *dmi_map; // Table of all DMI's known indexed by persistent instance #
#ifndef VTPM_MULTI_VM
pthread_mutex_t dmi_map_mutex; //
#endif
TCS_CONTEXT_HANDLE manager_tcs_handle; // TCS Handle used by manager
TPM_HANDLE storageKeyHandle; // Key used by persistent store
CRYPTO_INFO storageKey; // For software encryption
TCS_AUTH keyAuth; // OIAP session for storageKey
BOOL DMI_table_dirty; // Indicates that a command
// has updated the DMI table
// Persistent Data
TPM_AUTHDATA owner_usage_auth; // OwnerAuth of real TPM
TPM_AUTHDATA srk_usage_auth; // SRK Auth of real TPM
buffer_t storageKeyWrap; // Wrapped copy of storageKey
TPM_AUTHDATA storage_key_usage_auth;
}VTPM_GLOBALS;
//Global dmi map
extern VTPM_GLOBALS *vtpm_globals;
// ********************** Command Handler Prototypes ***********************
TPM_RESULT VTPM_Handle_Load_NVM( VTPM_DMI_RESOURCE *myDMI,
const buffer_t *inbuf,
buffer_t *outbuf);
TPM_RESULT VTPM_Handle_Save_NVM( VTPM_DMI_RESOURCE *myDMI,
const buffer_t *inbuf,
buffer_t *outbuf);
TPM_RESULT VTPM_Handle_TPM_Command( VTPM_DMI_RESOURCE *dmi,
buffer_t *inbuf,
buffer_t *outbuf);
TPM_RESULT VTPM_Handle_New_DMI(const buffer_t *param_buf);
TPM_RESULT VTPM_Handle_Close_DMI(const buffer_t *param_buf);
TPM_RESULT VTPM_Handle_Delete_DMI(const buffer_t *param_buf);
TPM_RESULT VTPM_SaveService(void);
TPM_RESULT VTPM_LoadService(void);
TPM_RESULT close_dmi( VTPM_DMI_RESOURCE *dmi_res);
#endif // __VTPMPRIV_H__
File diff suppressed because it is too large. Load diff
+102 -102
View File
@@ -1,102 +1,102 @@
// ===================================================================
//
// Copyright (c) 2005, Intel Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Intel Corporation nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
// ===================================================================
//
// vtsp.h
//
// Higher level interface to TCS.
//
// ==================================================================
#ifndef __VTSP_H__
#define __VTSP_H__
#include "tcg.h"
#include "tcs.h"
#define KEY_BUFFER_SIZE 2048
TPM_RESULT VTSP_RawTransmit(const TCS_CONTEXT_HANDLE hContext,
const buffer_t *inbuf,
buffer_t *outbuf );
TPM_RESULT VTSP_OIAP( const TCS_CONTEXT_HANDLE hContext,
TCS_AUTH *auth);
TPM_RESULT VTSP_OSAP( const TCS_CONTEXT_HANDLE hContext,
const TPM_ENTITY_TYPE entityType,
const UINT32 entityValue,
const TPM_AUTHDATA *usageAuth,
TPM_SECRET *sharedsecret,
TCS_AUTH *auth);
TPM_RESULT VTSP_ReadPubek( const TCS_CONTEXT_HANDLE hContext,
CRYPTO_INFO *cypto_info);
TPM_RESULT VTSP_TakeOwnership( const TCS_CONTEXT_HANDLE hContext,
const TPM_AUTHDATA *ownerAuth,
const TPM_AUTHDATA *srkAuth,
CRYPTO_INFO *ek_cryptoInfo,
TCS_AUTH *auth);
TPM_RESULT VTSP_DisablePubekRead( const TCS_CONTEXT_HANDLE hContext,
const TPM_AUTHDATA *ownerAuth,
TCS_AUTH *auth);
TPM_RESULT VTSP_CreateWrapKey( const TCS_CONTEXT_HANDLE hContext,
const TPM_KEY_USAGE usage,
const TPM_AUTHDATA *newKeyAuth,
const TCS_KEY_HANDLE parentHandle,
const TPM_AUTHDATA *osapSharedSecret,
buffer_t *pubKeyBuf,
TCS_AUTH *auth);
TPM_RESULT VTSP_LoadKey(const TCS_CONTEXT_HANDLE hContext,
const TCS_KEY_HANDLE hUnwrappingKey,
const buffer_t *rgbWrappedKeyBlob,
const TPM_AUTHDATA *parentAuth,
TPM_HANDLE *newKeyHandle,
TCS_AUTH *pAuth,
CRYPTO_INFO *cryptoinfo);
TPM_RESULT VTSP_Unbind( const TCS_CONTEXT_HANDLE hContext,
const TPM_KEY_HANDLE key_handle,
const buffer_t *bound_data,
const TPM_AUTHDATA *usage_auth,
buffer_t *clear_data,
TCS_AUTH *auth);
TPM_RESULT VTSP_Bind( CRYPTO_INFO *cryptoInfo,
const buffer_t *inData,
buffer_t *outData);
#endif //_VTSP_H_
// ===================================================================
//
// Copyright (c) 2005, Intel Corp.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following
// disclaimer in the documentation and/or other materials provided
// with the distribution.
// * Neither the name of Intel Corporation nor the names of its
// contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
// ===================================================================
//
// vtsp.h
//
// Higher level interface to TCS.
//
// ==================================================================
#ifndef __VTSP_H__
#define __VTSP_H__
#include "tcg.h"
#include "tcs.h"
#define KEY_BUFFER_SIZE 2048
TPM_RESULT VTSP_RawTransmit(const TCS_CONTEXT_HANDLE hContext,
const buffer_t *inbuf,
buffer_t *outbuf );
TPM_RESULT VTSP_OIAP( const TCS_CONTEXT_HANDLE hContext,
TCS_AUTH *auth);
TPM_RESULT VTSP_OSAP( const TCS_CONTEXT_HANDLE hContext,
const TPM_ENTITY_TYPE entityType,
const UINT32 entityValue,
const TPM_AUTHDATA *usageAuth,
TPM_SECRET *sharedsecret,
TCS_AUTH *auth);
TPM_RESULT VTSP_ReadPubek( const TCS_CONTEXT_HANDLE hContext,
CRYPTO_INFO *cypto_info);
TPM_RESULT VTSP_TakeOwnership( const TCS_CONTEXT_HANDLE hContext,
const TPM_AUTHDATA *ownerAuth,
const TPM_AUTHDATA *srkAuth,
CRYPTO_INFO *ek_cryptoInfo,
TCS_AUTH *auth);
TPM_RESULT VTSP_DisablePubekRead( const TCS_CONTEXT_HANDLE hContext,
const TPM_AUTHDATA *ownerAuth,
TCS_AUTH *auth);
TPM_RESULT VTSP_CreateWrapKey( const TCS_CONTEXT_HANDLE hContext,
const TPM_KEY_USAGE usage,
const TPM_AUTHDATA *newKeyAuth,
const TCS_KEY_HANDLE parentHandle,
const TPM_AUTHDATA *osapSharedSecret,
buffer_t *pubKeyBuf,
TCS_AUTH *auth);
TPM_RESULT VTSP_LoadKey(const TCS_CONTEXT_HANDLE hContext,
const TCS_KEY_HANDLE hUnwrappingKey,
const buffer_t *rgbWrappedKeyBlob,
const TPM_AUTHDATA *parentAuth,
TPM_HANDLE *newKeyHandle,
TCS_AUTH *pAuth,
CRYPTO_INFO *cryptoinfo);
TPM_RESULT VTSP_Unbind( const TCS_CONTEXT_HANDLE hContext,
const TPM_KEY_HANDLE key_handle,
const buffer_t *bound_data,
const TPM_AUTHDATA *usage_auth,
buffer_t *clear_data,
TCS_AUTH *auth);
TPM_RESULT VTSP_Bind( CRYPTO_INFO *cryptoInfo,
const buffer_t *inData,
buffer_t *outData);
#endif //_VTSP_H_
+19 -19
View File
@@ -1,19 +1,19 @@
XEN_ROOT = ../../..
include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
BIN = libTCGUtils.a
all: build
build: $(BIN)
install: build
clean:
rm -f *.a *.so *.o *.rpm $(DEP_FILES)
mrproper: clean
rm -f *~
$(BIN): $(OBJS)
$(AR) rcs $(BIN) $(OBJS)
XEN_ROOT = ../../..
include $(XEN_ROOT)/tools/vtpm_manager/Rules.mk
BIN = libTCGUtils.a
all: build
build: $(BIN)
install: build
clean:
rm -f *.a *.so *.o *.rpm $(DEP_FILES)
mrproper: clean
rm -f *~
$(BIN): $(OBJS)
$(AR) rcs $(BIN) $(OBJS)
-7
View File
@@ -1,7 +0,0 @@
hashtable.o: hashtable.c hashtable.h hashtable_private.h
hashtable_itr.o: hashtable_itr.c hashtable.h hashtable_private.h \
hashtable_itr.h
bsg.o: bsg.c tcg.h ../crypto/crypto.h ../crypto/sym_crypto.h buffer.h \
bsg.h log.h
log.o: log.c buffer.h tcg.h
buffer.o: buffer.c tcg.h bsg.h buffer.h
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.