I am trying to use the Command Transmission Interface from the Trusted Software Stack for the TPM 2.0 and I cannot seem to get this library loaded. Any use gives an "undefined reference" error.
Had the same problem when using the ESAPI from TSS as well and fixed it with the following flag in my Makefile: TPMFLAGS =-L=/usr/local/lib/ -ltss2-esys
.
Following is my Makefile in its current implementation:
CC = gcc
CFLAGS = -std=c99 -Wall -I$(IDIR)
TPMFLAGS =-L=/usr/local/lib/ -ltss2-esys -ltss2-tcti-device
IDIR = ./includes/
SRCDIR = ./src/
BINDIR = ./bin/
SOURCES = $(SRCDIR)*.c
all: $(BINDIR)antiEvilMaid
$(BINDIR)antiEvilMaid: $(BINDIR)main.o $(BINDIR)errors.o
$(CC) $(BINDIR)main.o $(BINDIR)errors.o $(TPMFLAGS) -o $@
$(BINDIR)main.o: $(SRCDIR)main.c $(IDIR)main.h
$(CC)$(CFLAGS) -c $(SRCDIR)main.c -o $@
$(BINDIR)errors.o: $(SRCDIR)errors.c $(IDIR)main.h
$(CC)$(CFLAGS) -c $(SRCDIR)errors.c -o $@
run:
$(BINDIR)antiEvilMaid init
clean:
rm $(BINDIR)*.o $(BINDIR)antiEvilMaid
memtest:
valgrind --leak-check=full $(BINDIR)antiEvilMaid init