Question

I hope anyone from the large community here can help me write the simplest "Trusted" program that I can expand from.

I'm using Ubuntu Linux 9.04, with TPM emulator 0.60 from Mario Strasser (http://tpm-emulator.berlios.de/). I have installed the emulator and Trousers, and can successfully run programs from tpm-tools after running tpmd and tcsd daemons.

I hope to start developing my application, but I have problems compiling the code below.

#include <trousers/tss.h>
#include <trousers/trousers.h>
#include <stdio.h>

TSS_HCONTEXT hContext;
int main()
{
     Tspi_Context_Create(&hContext);
     Tspi_Context_Close(hContext);
     return 0;
}

After trying to compile with

g++ tpm.cpp -o tpmexe

I receive errors

undefined reference to 'Tspi_Context_Create' 
undefined reference to 'Tspi_Context_Close'

What do I have to #include to successfully compile this? Is there anything that I miss? I'm familiar with C, but not exactly so with Linux/Unix programming environment.

ps: I am a part time student in Master in Information Security programme. My involvement with programming has been largely for academic purposes.

Was it helpful?

Solution

You need to link to the library.

Try this:

g++ tpm.cpp -o tpmexe -ltspi
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top