~ubuntu-branches/ubuntu/hardy/trousers/hardy-proposed

« back to all changes in this revision

Viewing changes to src/tspi/rpc/tcstp/rpc_context.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-01-23 22:03:00 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080123220300-fhtqja3c0oq0gp6z
Tags: 0.3.1-4
* Added patch from Aaron M. Ucko <ucko@debian.org> to allow trousers to
  build successfully on amd64, and presumably also other 64-bit
  architectures (Closes: #457400).
* Including udev rule for /dev/tpm from William Lima
  <wlima.amadeus@gmail.com> as suggested by David Smith <dds@google.com>
  (Closes: #459682).
* Added lintian overrides.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/*
 
3
 * Licensed Materials - Property of IBM
 
4
 *
 
5
 * trousers - An open source TCG Software Stack
 
6
 *
 
7
 * (C) Copyright International Business Machines Corp. 2004-2006
 
8
 *
 
9
 */
 
10
 
 
11
#include <stdlib.h>
 
12
#include <stdio.h>
 
13
#include <string.h>
 
14
#include <assert.h>
 
15
 
 
16
#include "trousers/tss.h"
 
17
#include "trousers/trousers.h"
 
18
#include "trousers_types.h"
 
19
#include "spi_utils.h"
 
20
#include "tsplog.h"
 
21
#include "hosttable.h"
 
22
#include "tcsd_wrap.h"
 
23
#include "rpc_tcstp_tsp.h"
 
24
 
 
25
 
 
26
TSS_RESULT
 
27
RPC_OpenContext_TP(struct host_table_entry* hte,
 
28
                       UINT32*                  tpm_version,
 
29
                       TCS_CONTEXT_HANDLE*      tcsContext)
 
30
{
 
31
        TSS_RESULT result;
 
32
 
 
33
        initData(&hte->comm, 0);
 
34
        hte->comm.hdr.u.ordinal = TCSD_ORD_OPENCONTEXT;
 
35
        result = sendTCSDPacket(hte);
 
36
 
 
37
        if (result == TSS_SUCCESS)
 
38
                result = hte->comm.hdr.u.result;
 
39
 
 
40
        if (result == TSS_SUCCESS) {
 
41
                if (getData(TCSD_PACKET_TYPE_UINT32, 0, tcsContext, 0, &hte->comm))
 
42
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
43
 
 
44
                LogDebugFn("Received TCS Context: 0x%x", *tcsContext);
 
45
 
 
46
                if (getData(TCSD_PACKET_TYPE_UINT32, 1, tpm_version, 0, &hte->comm))
 
47
                        return TSPERR(TSS_E_INTERNAL_ERROR);
 
48
        }
 
49
 
 
50
        return result;
 
51
}
 
52
 
 
53
TSS_RESULT
 
54
RPC_CloseContext_TP(struct host_table_entry *hte)
 
55
{
 
56
        TSS_RESULT result;
 
57
 
 
58
        initData(&hte->comm, 1);
 
59
        hte->comm.hdr.u.ordinal = TCSD_ORD_CLOSECONTEXT;
 
60
        LogDebugFn("TCS Context: 0x%x", hte->tcsContext);
 
61
 
 
62
        if (setData(TCSD_PACKET_TYPE_UINT32, 0, &hte->tcsContext, 0, &hte->comm))
 
63
                return TSPERR(TSS_E_INTERNAL_ERROR);
 
64
 
 
65
        result = sendTCSDPacket(hte);
 
66
 
 
67
        if (result == TSS_SUCCESS)
 
68
                result = hte->comm.hdr.u.result;
 
69
 
 
70
        return result;
 
71
}
 
72
 
 
73
TSS_RESULT
 
74
RPC_FreeMemory_TP(struct host_table_entry *hte,
 
75
                  BYTE * pMemory)               /*  in */
 
76
{
 
77
        free(pMemory);
 
78
 
 
79
        return TSS_SUCCESS;
 
80
}