~ubuntu-branches/ubuntu/jaunty/trousers/jaunty

« back to all changes in this revision

Viewing changes to src/tcs/tcsi_bind.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
 
 
12
#include <stdlib.h>
 
13
#include <stdio.h>
 
14
#include <string.h>
 
15
#include <inttypes.h>
 
16
 
 
17
#include "trousers/tss.h"
 
18
#include "trousers_types.h"
 
19
#include "tcs_tsp.h"
 
20
#include "tcsps.h"
 
21
#include "tcs_utils.h"
 
22
#include "tcs_int_literals.h"
 
23
#include "capabilities.h"
 
24
#include "tcslog.h"
 
25
#include "req_mgr.h"
 
26
#include "tcsd_wrap.h"
 
27
#include "tcsd.h"
 
28
 
 
29
 
 
30
TSS_RESULT
 
31
TCSP_UnBind_Internal(TCS_CONTEXT_HANDLE hContext,       /* in */
 
32
                     TCS_KEY_HANDLE keyHandle,  /* in */
 
33
                     UINT32 inDataSize, /* in */
 
34
                     BYTE * inData,     /* in */
 
35
                     TPM_AUTH * privAuth,       /* in, out */
 
36
                     UINT32 * outDataSize,      /* out */
 
37
                     BYTE ** outData)   /* out */
 
38
{
 
39
        UINT32 paramSize;
 
40
        TSS_RESULT result;
 
41
        UINT64 offset = 0;
 
42
        TCPA_KEY_HANDLE keySlot;
 
43
        BYTE txBlob[TSS_TPM_TXBLOB_SIZE];
 
44
 
 
45
        LogDebug("Entering TCSI_UnBind");
 
46
        if ((result = ctx_verify_context(hContext)))
 
47
                goto done;
 
48
 
 
49
        if (privAuth != NULL) {
 
50
                LogDebug("Auth Used");
 
51
                if ((result = auth_mgr_check(hContext, &privAuth->AuthHandle)))
 
52
                        goto done;
 
53
        } else {
 
54
                LogDebug("No Auth");
 
55
        }
 
56
 
 
57
        LogDebugFn("calling ensureKeyIsLoaded for TCS handle 0x%x", keyHandle);
 
58
        if ((result = ensureKeyIsLoaded(hContext, keyHandle, &keySlot)))
 
59
                goto done;
 
60
 
 
61
        if ((result = tpm_rqu_build(TPM_ORD_UnBind, &offset, txBlob, keySlot, inDataSize, inData,
 
62
                                    privAuth, NULL)))
 
63
                return result;
 
64
 
 
65
        if ((result = req_mgr_submit_req(txBlob)))
 
66
                goto done;
 
67
 
 
68
        result = UnloadBlob_Header(txBlob, &paramSize);
 
69
        if (!result) {
 
70
                result = tpm_rsp_parse(TPM_ORD_UnBind, txBlob, paramSize, outDataSize, outData,
 
71
                                       privAuth);
 
72
        }
 
73
 
 
74
done:
 
75
        auth_mgr_release_auth(privAuth, NULL, hContext);
 
76
        return result;
 
77
}
 
78