#180 Remote connection problem


Hi people? How have you been?

I started to use TrouSers some days ago to make a remote connection with TPM. For while I am using TPM Emulator.

I uncommented the line remote_ops in the file tcsd.conf and I enabled some commands to be accepted.

However, during the development I have had some problems to establish the connection using the function Tspi_Context_Connect(hContext, host).
The return message was:

Tspi_Context_Connect failed: 0x00002002 - layer=tcs, code=0002 (2), General failure

I took a look in tcsd log and the message was:

TCSD TCS ERROR: Error retrieving local socket address: Success
TCSD TCS Denied OpenContext operation from localhost

To make sure that this problem was not in my program, I made some tests with the program tpm_version. The same problem was being happened.

I searched for a lot in the internet to see whether someone had the same problem but I didn't have success.
So the only thing that rest to me was to take a look in the source code to understand what was the problem.

Unfortunately analyzing the source code I found two problems in the file "trousers-trousers/src/tcs/rpc/tcstp/rpc.c" inside of the function access_control.

The first one was in the line 527 where the return of the function getpeername() is treated of wrong way. This function return zero to success otherwise error.
In the source code this part is inverted.

The second one was after line 541 and in the line 551 where was missing to close the brace and open the brace.

With that, if we enable the remote connection uncommenting the line remote_ops in the file tcsd.conf, the function access_control will always return 1 denying the operation.

I fixed all and made some tests with my program and also with the program tpm_version. the result was success as shown below.

$ tpm_version
TPM 1.2 Version Info:
Chip Version:
Spec Level: 2
Errata Revision: 1
TPM Version: 01010000
Manufacturer Info: 4554485a

TCSD trousers 0.3.13: TCSD up and running.
TCSD TCS Accepted OpenContext operation from localhost
TCSD TCS Accepted GetCapability operation from localhost
TCSD TCS Accepted GetCapability operation from localhost
TCSD TCS Accepted GetCapability operation from localhost
TCSD TCS Accepted CloseContext operation from localhost

I know that, I don't work with the development of the TrouSers and I wouldn't like to bother anyone with these problems.
I just would like to help the development, improve it and I wouldn't like more people facing the same problem. It is an excellent project. Because of that I did this analyze and also I created a patch that solve these problems.
I don't know if this patch follow the development standard of the TrouSers (for example: branch name and name of the file). I just want to show with this file where are the problems.

I would like to thanks if someone could analyze that and make some comments regarding what I did whether is correct or wrong. However, I just want to help.

1 Attachments


  • Hon Ching(Vicky) Lo

    Thank you for your patch and detailed descriptions! The patch definitely works. However, I would have to reject it simply because the patches submitted for the bugs 176-179 fixed the same problems.

  • Hon Ching(Vicky) Lo

    • status: open --> closed-rejected
    • assigned_to: Vicky Lo

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks