aboutsummaryrefslogtreecommitdiff
path: root/emulators/tpm-emulator
diff options
context:
space:
mode:
authorNorikatsu Shigemura <nork@FreeBSD.org>2010-11-07 12:08:52 +0000
committerNorikatsu Shigemura <nork@FreeBSD.org>2010-11-07 12:08:52 +0000
commit1cf92127b214d45040e6429373dbe4caa266c68a (patch)
tree8ebda50beeb8a641516bc71fbcf900e9a31f86f7 /emulators/tpm-emulator
parentc38e52a3c0b061b44ebb589d362563613f2edab8 (diff)
downloadports-1cf92127b214d45040e6429373dbe4caa266c68a.tar.gz
ports-1cf92127b214d45040e6429373dbe4caa266c68a.zip
Add tpm-emulator 0.7.1, is a Trusted Platform Module (TPM) emulator.
Notes
Notes: svn path=/head/; revision=264184
Diffstat (limited to 'emulators/tpm-emulator')
-rw-r--r--emulators/tpm-emulator/Makefile44
-rw-r--r--emulators/tpm-emulator/distinfo2
-rw-r--r--emulators/tpm-emulator/files/patch-CMakeLists.txt44
-rw-r--r--emulators/tpm-emulator/files/patch-mtm-mtm_structures.h11
-rw-r--r--emulators/tpm-emulator/files/patch-tddl-CMakeLists.txt26
-rw-r--r--emulators/tpm-emulator/files/patch-tpm-tpm_ticks.c40
-rw-r--r--emulators/tpm-emulator/files/patch-tpmd-CMakeLists.txt9
-rw-r--r--emulators/tpm-emulator/files/patch-tpmd-unix-CMakeLists.txt13
-rw-r--r--emulators/tpm-emulator/files/patch-tpmd_dev-CMakeLists.txt29
-rw-r--r--emulators/tpm-emulator/files/patch-tpmd_dev-openbsd-Makefile28
-rw-r--r--emulators/tpm-emulator/files/patch-tpmd_dev-openbsd-tpmd_dev.c29
-rw-r--r--emulators/tpm-emulator/files/patch-tpmd_dev-openbsd-tpmd_dev.h11
-rw-r--r--emulators/tpm-emulator/pkg-descr4
-rw-r--r--emulators/tpm-emulator/pkg-plist7
14 files changed, 297 insertions, 0 deletions
diff --git a/emulators/tpm-emulator/Makefile b/emulators/tpm-emulator/Makefile
new file mode 100644
index 000000000000..8abcf954d625
--- /dev/null
+++ b/emulators/tpm-emulator/Makefile
@@ -0,0 +1,44 @@
+# New ports collection makefile for: tpm-emulator
+# Date created: 18 Sep 2007
+# Whom: Sebastian Schuetz <sschuetz@fhm.edu>
+#
+# $FreeBSD$
+#
+
+PORTNAME= tpm-emulator
+PORTVERSION= 0.7.1
+CATEGORIES= emulators
+MASTER_SITES= BERLIOS/${PORTNAME}
+DISTNAME= ${PORTNAME:S/-/_/}-${PORTVERSION}
+
+MAINTAINER= nork@freebsd.org
+COMMENT= Trusted Platform Module (TPM) emulator
+
+LIB_DEPENDS= gmp.10:${PORTSDIR}/math/gmp
+
+USE_CMAKE= YES
+USE_LDCONFIG= YES
+MAKE_JOBS_SAFE= YES
+
+CONFLICTS= trousers-tddl*
+
+WANTLIB= c
+CMAKE_VERBOSE= YES
+CMAKE_SOURCE_PATH= ${WRKSRC}
+NO_CONFIGURE= YES
+BUILD_WRKSRC= ${CONFIGURE_WRKSRC}
+INSTALL_WRKSRC= ${CONFIGURE_WRKSRC}
+CONFIGURE_WRKSRC= ${CMAKE_SOURCE_PATH}/build
+
+CMAKE_ARGS+= -DCMAKE_INCLUDE_PATH="${LOCALBASE}/include" \
+ -DCMAKE_EXE_LINKER_FLAGS="-L${LOCALBASE}/lib"
+
+LICENSE= GPLv2
+LICENSE_FILE= ${WRKSRC}/README
+
+WRKSRC= ${WRKDIR}/${PORTNAME:S/-/_/}-${PORTVERSION}
+
+post-patch:
+ @${MKDIR} ${WRKSRC}/build
+
+.include <bsd.port.mk>
diff --git a/emulators/tpm-emulator/distinfo b/emulators/tpm-emulator/distinfo
new file mode 100644
index 000000000000..d24da4d49ac2
--- /dev/null
+++ b/emulators/tpm-emulator/distinfo
@@ -0,0 +1,2 @@
+SHA256 (tpm_emulator-0.7.1.tar.gz) = 7c10a753206bf0f32a767dc69039a866bd8d3eb8a4834f5e722c7510a9f54c24
+SIZE (tpm_emulator-0.7.1.tar.gz) = 207497
diff --git a/emulators/tpm-emulator/files/patch-CMakeLists.txt b/emulators/tpm-emulator/files/patch-CMakeLists.txt
new file mode 100644
index 000000000000..76de9a3fa2f7
--- /dev/null
+++ b/emulators/tpm-emulator/files/patch-CMakeLists.txt
@@ -0,0 +1,44 @@
+--- CMakeLists.txt.orig 2010-07-06 06:21:20.000000000 +0900
++++ CMakeLists.txt 2010-10-25 02:56:43.617558705 +0900
+@@ -5,13 +5,13 @@
+
+ project(TPM_Emulator C)
+
+-cmake_minimum_required(VERSION 2.6)
++cmake_minimum_required(VERSION 2.4)
+
+ # enforce out of source build
+ string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" IS_INSOURCE)
+ if(IS_INSOURCE)
+ message(FATAL_ERROR "${PROJECT_NAME} requires an out of source build.")
+-endif()
++endif(IS_INSOURCE)
+
+ # set project and build version
+ set(${PROJECT_NAME}_VERSION_MAJOR 0)
+@@ -29,14 +29,14 @@
+ set(TPM_SOCKET_NAME "/private/var/run/tpm/tpmd_socket:0")
+ set(TPM_STORAGE_NAME "/private/var/lib/tpm/tpm_emulator-1_2_${${PROJECT_NAME}_VERSION_MAJOR}_${${PROJECT_NAME}_VERSION_MINOR}")
+ set(TPM_DEVICE_NAME "/dev/tpm")
+-else()
++else(WIN32)
+ set(TPM_LOG_FILE "/var/log/tpmd.log")
+ set(TPM_SOCKET_NAME "/var/run/tpm/tpmd_socket:0")
+ set(TPM_STORAGE_NAME "/var/lib/tpm/tpm_emulator-1_2_${${PROJECT_NAME}_VERSION_MAJOR}_${${PROJECT_NAME}_VERSION_MINOR}")
+ set(TPM_DEVICE_NAME "/dev/tpm")
+-endif()
++endif(WIN32)
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
+-add_definitions(-Wall -Werror -Wextra -Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings)
++add_definitions(-Wall -Werror -Wno-unused-parameter -Wpointer-arith -Wcast-align -Wwrite-strings)
+
+ # configure CPack
+ set(CPACK_PACKAGE_VERSION_MAJOR ${${PROJECT_NAME}_VERSION_MAJOR})
+@@ -51,6 +51,7 @@
+ # include root directories
+ include_directories(${CMAKE_SOURCE_DIR})
+ include_directories(${CMAKE_BINARY_DIR})
++include_directories("/usr/local/include")
+
+ # add internal libraries
+ add_subdirectory(tpm)
diff --git a/emulators/tpm-emulator/files/patch-mtm-mtm_structures.h b/emulators/tpm-emulator/files/patch-mtm-mtm_structures.h
new file mode 100644
index 000000000000..6f9055193e67
--- /dev/null
+++ b/emulators/tpm-emulator/files/patch-mtm-mtm_structures.h
@@ -0,0 +1,11 @@
+--- mtm/mtm_structures.h.orig 2010-07-06 06:21:20.000000000 +0900
++++ mtm/mtm_structures.h 2010-10-25 02:56:43.619561686 +0900
+@@ -228,8 +228,6 @@
+ MTM_PERMANENT_DATA data;
+ } permanent;
+ struct {
+- } stclear;
+- struct {
+ MTM_STANY_FLAGS flags;
+ } stany;
+ } MTM_DATA;
diff --git a/emulators/tpm-emulator/files/patch-tddl-CMakeLists.txt b/emulators/tpm-emulator/files/patch-tddl-CMakeLists.txt
new file mode 100644
index 000000000000..f264de37e902
--- /dev/null
+++ b/emulators/tpm-emulator/files/patch-tddl-CMakeLists.txt
@@ -0,0 +1,26 @@
+--- tddl/CMakeLists.txt.orig 2010-07-06 06:21:20.000000000 +0900
++++ tddl/CMakeLists.txt 2010-10-25 02:56:43.620555878 +0900
+@@ -5,18 +5,21 @@
+
+ set(tddl_SRCS "tddl.c" "tddl.h")
+ add_library(tddl SHARED ${tddl_SRCS})
++add_library(tddlStatic STATIC ${tddl_SRCS})
+ if(UNIX)
+ set_target_properties(tddl PROPERTIES SOVERSION "1.2"
+ VERSION "1.2.${${PROJECT_NAME}_VERSION_MAJOR}.${${PROJECT_NAME}_VERSION_MINOR}")
++ set_target_properties(tddlStatic PROPERTIES OUTPUT_NAME tddl)
+ elseif(WIN32)
+ set_target_properties(tddl PROPERTIES OUTPUT_NAME ifxtpm)
+ set_target_properties(tddl PROPERTIES PREFIX "")
+-endif()
++endif(UNIX)
+
+ install(TARGETS tddl DESTINATION lib)
++install(TARGETS tddlStatic DESTINATION lib)
+ install(FILES "tddl.h" DESTINATION include)
+
+ include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+ add_executable(test_tddl test_tddl.c)
+-target_link_libraries(test_tddl tddl)
++target_link_libraries(test_tddl tddlStatic)
+
diff --git a/emulators/tpm-emulator/files/patch-tpm-tpm_ticks.c b/emulators/tpm-emulator/files/patch-tpm-tpm_ticks.c
new file mode 100644
index 000000000000..00b1daaeb1f3
--- /dev/null
+++ b/emulators/tpm-emulator/files/patch-tpm-tpm_ticks.c
@@ -0,0 +1,40 @@
+--- tpm/tpm_ticks.c.orig 2010-07-06 06:21:20.000000000 +0900
++++ tpm/tpm_ticks.c 2010-10-25 02:56:43.622559766 +0900
+@@ -42,7 +42,7 @@
+ {
+ TPM_RESULT res;
+ TPM_KEY_DATA *key;
+- BYTE *info, *ptr;
++ BYTE *info_buffer, *ptr;
+ UINT32 info_length, len;
+ info("TPM_TickStampBlob()");
+ /* get key */
+@@ -66,21 +66,21 @@
+ if (*sig == NULL) return TPM_FAIL;
+ /* setup TPM_SIGN_INFO structure */
+ info_length = 30 + sizeof(TPM_DIGEST) + sizeof_TPM_CURRENT_TICKS(currentTicks);
+- info = tpm_malloc(info_length);
+- if (info == NULL) {
++ info_buffer = tpm_malloc(info_length);
++ if (info_buffer == NULL) {
+ tpm_free(*sig);
+ return TPM_FAIL;
+ }
+- memcpy(&info[0], "\x00\x05TSTP", 6);
+- memcpy(&info[6], antiReplay->nonce, 20);
+- ptr = &info[26]; len = info_length - 26;
++ memcpy(&info_buffer[0], "\x00\x05TSTP", 6);
++ memcpy(&info_buffer[6], antiReplay->nonce, 20);
++ ptr = &info_buffer[26]; len = info_length - 26;
+ tpm_marshal_UINT32(&ptr, &len, info_length - 30);
+ memcpy(ptr, digestToStamp->digest, sizeof(TPM_DIGEST));
+ ptr += sizeof(TPM_DIGEST); len -= sizeof(TPM_DIGEST);
+ if (tpm_marshal_TPM_CURRENT_TICKS(&ptr, &len, currentTicks)
+- || tpm_rsa_sign(&key->key, RSA_SSA_PKCS1_SHA1, info, info_length, *sig)) {
++ || tpm_rsa_sign(&key->key, RSA_SSA_PKCS1_SHA1, info_buffer, info_length, *sig)) {
+ tpm_free(*sig);
+- tpm_free(info);
++ tpm_free(info_buffer);
+ return TPM_FAIL;
+ }
+ return TPM_SUCCESS;
diff --git a/emulators/tpm-emulator/files/patch-tpmd-CMakeLists.txt b/emulators/tpm-emulator/files/patch-tpmd-CMakeLists.txt
new file mode 100644
index 000000000000..8c1f00c2c879
--- /dev/null
+++ b/emulators/tpm-emulator/files/patch-tpmd-CMakeLists.txt
@@ -0,0 +1,9 @@
+--- tpmd/CMakeLists.txt.orig 2010-07-06 06:21:20.000000000 +0900
++++ tpmd/CMakeLists.txt 2010-10-25 02:56:43.624559116 +0900
+@@ -11,5 +11,5 @@
+
+ add_subdirectory(windows)
+
+-endif()
++endif(UNIX)
+
diff --git a/emulators/tpm-emulator/files/patch-tpmd-unix-CMakeLists.txt b/emulators/tpm-emulator/files/patch-tpmd-unix-CMakeLists.txt
new file mode 100644
index 000000000000..b97fb103c0c2
--- /dev/null
+++ b/emulators/tpm-emulator/files/patch-tpmd-unix-CMakeLists.txt
@@ -0,0 +1,13 @@
+--- tpmd/unix/CMakeLists.txt.orig 2010-07-06 06:21:20.000000000 +0900
++++ tpmd/unix/CMakeLists.txt 2010-10-25 02:56:43.633558246 +0900
+@@ -10,8 +10,8 @@
+ if(MTM_EMULATOR)
+ add_definitions(-DMTM_EMULATOR)
+ target_link_libraries(tpmd mtm tpm crypto)
+-else()
++else(MTM_EMULATOR)
+ target_link_libraries(tpmd tpm crypto)
+-endif()
++endif(MTM_EMULATOR)
+ install(TARGETS tpmd RUNTIME DESTINATION bin)
+
diff --git a/emulators/tpm-emulator/files/patch-tpmd_dev-CMakeLists.txt b/emulators/tpm-emulator/files/patch-tpmd_dev-CMakeLists.txt
new file mode 100644
index 000000000000..e16dec4e6fa2
--- /dev/null
+++ b/emulators/tpm-emulator/files/patch-tpmd_dev-CMakeLists.txt
@@ -0,0 +1,29 @@
+--- tpmd_dev/CMakeLists.txt.orig 2010-07-06 06:21:20.000000000 +0900
++++ tpmd_dev/CMakeLists.txt 2010-10-25 02:56:43.626557976 +0900
+@@ -17,8 +17,8 @@
+ set(tpmd_dev_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/openbsd")
+ set(tpmd_dev_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/openbsd")
+ set(tpmd_dev_OBJ "${tpmd_dev_BINARY_DIR}/tpmd_dev.o")
+-set(tpmd_dev_BUILD_CMD make -C ${tpmd_dev_BINARY_DIR})
+-set(tpmd_dev_INSTALL_CMD make -C ${tpmd_dev_BINARY_DIR} install)
++set(tpmd_dev_BUILD_CMD gmake -C ${tpmd_dev_BINARY_DIR})
++set(tpmd_dev_INSTALL_CMD gmake -C ${tpmd_dev_BINARY_DIR} install)
+
+ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
+
+@@ -28,7 +28,7 @@
+ set(tpmd_dev_BUILD_CMD make -C ${tpmd_dev_BINARY_DIR})
+ set(tpmd_dev_INSTALL_CMD make -C ${tpmd_dev_BINARY_DIR} install)
+
+-endif()
++endif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+
+ # compile module
+ if(tpmd_dev_OBJ)
+@@ -45,5 +45,5 @@
+
+ install(CODE "EXECUTE_PROCESS(COMMAND ${tpmd_dev_INSTALL_CMD})")
+
+-endif()
++endif(tpmd_dev_OBJ)
+
diff --git a/emulators/tpm-emulator/files/patch-tpmd_dev-openbsd-Makefile b/emulators/tpm-emulator/files/patch-tpmd_dev-openbsd-Makefile
new file mode 100644
index 000000000000..b081bb6b9e78
--- /dev/null
+++ b/emulators/tpm-emulator/files/patch-tpmd_dev-openbsd-Makefile
@@ -0,0 +1,28 @@
+--- tpmd_dev/openbsd/Makefile.orig 2010-07-06 06:21:20.000000000 +0900
++++ tpmd_dev/openbsd/Makefile 2010-10-25 02:56:43.628559140 +0900
+@@ -6,14 +6,15 @@
+
+ CFLAGS= -D_KERNEL -I/usr/src/sys
+ SRC= tpmd_dev.c
++OBJ= tpmd_dev.obj
+ MODULE= tpmd_dev.o
+
+ all:
+- cc -c $(SRC) $(CFLAGS)
+- ld -r -o $(MODULE) $(SRC:.c=.o)
++ cc -o $(OBJ) -c $(SRC) $(CFLAGS)
++ ld -r -o $(MODULE) $(OBJ)
+
+ clean:
+- rm -rf $(SRC:.c=.o)
++ rm -rf $(OBJ)
+ rm -f $(MODULE)
+
+ load: all mknod
+@@ -27,3 +28,6 @@
+
+ rmnod:
+ rm /dev/tpm
++
++install:
++
diff --git a/emulators/tpm-emulator/files/patch-tpmd_dev-openbsd-tpmd_dev.c b/emulators/tpm-emulator/files/patch-tpmd_dev-openbsd-tpmd_dev.c
new file mode 100644
index 000000000000..26b71e5b7ffe
--- /dev/null
+++ b/emulators/tpm-emulator/files/patch-tpmd_dev-openbsd-tpmd_dev.c
@@ -0,0 +1,29 @@
+--- tpmd_dev/openbsd/tpmd_dev.c.orig 2010-07-06 06:21:20.000000000 +0900
++++ tpmd_dev/openbsd/tpmd_dev.c 2010-10-25 02:56:43.630557372 +0900
+@@ -32,7 +32,7 @@
+ #include <sys/proc.h>
+ #include <machine/intr.h>
+
+-#include "tpm_dev.h"
++#include "tpmd_dev.h"
+
+
+ int tpmopen __P((dev_t dev, int oflags, int devtype, struct proc *p));
+@@ -57,7 +57,7 @@
+ cdev_decl(tpm);
+
+ /* define our cdev struct containing the functions */
+-static struct cdevsw cdev_tpm = cdev_tpm_init(1,tpm);
++static struct cdevsw cdev_tpm = cdev_tpmd_init(1,tpm);
+
+ /* fill in the lkm_dev structure */
+ MOD_DEV("tpm",LM_DT_CHAR,-1,&cdev_tpm);
+@@ -213,7 +213,7 @@
+ * sometime returns EINTR
+ */
+ tpmd_sock->so_rcv.sb_flags |= SB_NOINTR;
+- error = soreceive(tpmd_sock,NULL,uio,NULL,NULL,NULL);
++ error = soreceive(tpmd_sock,NULL,uio,NULL,NULL,NULL,0);
+
+ if (error) {
+ debug("soreceive() failed %i",error);
diff --git a/emulators/tpm-emulator/files/patch-tpmd_dev-openbsd-tpmd_dev.h b/emulators/tpm-emulator/files/patch-tpmd_dev-openbsd-tpmd_dev.h
new file mode 100644
index 000000000000..77b57d3188e9
--- /dev/null
+++ b/emulators/tpm-emulator/files/patch-tpmd_dev-openbsd-tpmd_dev.h
@@ -0,0 +1,11 @@
+--- tpmd_dev/openbsd/tpmd_dev.h.orig 2010-07-06 06:21:20.000000000 +0900
++++ tpmd_dev/openbsd/tpmd_dev.h 2010-10-25 02:56:43.632557559 +0900
+@@ -20,7 +20,7 @@
+
+ #include "config.h"
+
+-#define cdev_tpm_init(c,n) { \
++#define cdev_tpmd_init(c,n) { \
+ dev_init(c,n,open),dev_init(c,n,close),dev_init(c,n,read), \
+ dev_init(c,n,write), dev_init(c,n,ioctl),(dev_type_stop((*))) lkmenodev, \
+ 0,(dev_type_poll((*))) lkmenodev,(dev_type_mmap((*))) lkmenodev }
diff --git a/emulators/tpm-emulator/pkg-descr b/emulators/tpm-emulator/pkg-descr
new file mode 100644
index 000000000000..1fff0f91dc81
--- /dev/null
+++ b/emulators/tpm-emulator/pkg-descr
@@ -0,0 +1,4 @@
+The project aims to create a fully working Trusted Platform Module (TPM)
+emulator follwing the specifications of the Trusted Computing Group.
+The port provides a driver library libtddl which can be linked against programs
+providing a Trusted Software Stack to redirect TPM calls to the emulator.
diff --git a/emulators/tpm-emulator/pkg-plist b/emulators/tpm-emulator/pkg-plist
new file mode 100644
index 000000000000..cb00edbd91b9
--- /dev/null
+++ b/emulators/tpm-emulator/pkg-plist
@@ -0,0 +1,7 @@
+include/tddl.h
+lib/libtddl.so.1.2.0.7
+lib/libtddl.so.1.2
+lib/libtddl.a
+bin/tpmd
+@unexec rm -f /var/tpm/tpmd_socket*
+@unexec rm -rf /var/tpm