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

« back to all changes in this revision

Viewing changes to src/tspi/tspi_counter.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-2007
 
8
 *
 
9
 */
 
10
 
 
11
#include <stdlib.h>
 
12
#include <stdio.h>
 
13
#include <string.h>
 
14
 
 
15
#include "trousers/tss.h"
 
16
#include "trousers/trousers.h"
 
17
#include "trousers_types.h"
 
18
#include "spi_utils.h"
 
19
#include "capabilities.h"
 
20
#include "tsplog.h"
 
21
#include "obj.h"
 
22
 
 
23
 
 
24
TSS_RESULT
 
25
Tspi_TPM_ReadCounter(TSS_HTPM hTPM,             /* in */
 
26
                     UINT32*  counterValue)     /* out */
 
27
{
 
28
        TSS_HCONTEXT tspContext;
 
29
        TCPA_RESULT result;
 
30
        TSS_COUNTER_ID counterID;
 
31
        TPM_COUNTER_VALUE counter_value;
 
32
 
 
33
        if (counterValue == NULL)
 
34
                return TSPERR(TSS_E_BAD_PARAMETER);
 
35
 
 
36
        if ((result = obj_tpm_get_tsp_context(hTPM, &tspContext)))
 
37
                return result;
 
38
 
 
39
        if ((result = obj_tpm_get_current_counter(hTPM, &counterID)))
 
40
                return result;
 
41
 
 
42
        if ((result = TCS_API(tspContext)->ReadCounter(tspContext, counterID, &counter_value)))
 
43
                return result;
 
44
 
 
45
        *counterValue = counter_value.counter;
 
46
 
 
47
        return TSS_SUCCESS;
 
48
}