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

« back to all changes in this revision

Viewing changes to src/tspi/tspi_hash.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
 
 
16
#include "trousers/tss.h"
 
17
#include "trousers/trousers.h"
 
18
#include "trousers_types.h"
 
19
#include "spi_utils.h"
 
20
#include "capabilities.h"
 
21
#include "tsplog.h"
 
22
#include "obj.h"
 
23
 
 
24
 
 
25
TSS_RESULT
 
26
Tspi_Hash_SetHashValue(TSS_HHASH hHash,                 /* in */
 
27
                       UINT32 ulHashValueLength,        /* in */
 
28
                       BYTE * rgbHashValue)             /* in */
 
29
{
 
30
        if (ulHashValueLength == 0 || rgbHashValue == NULL)
 
31
                return TSPERR(TSS_E_BAD_PARAMETER);
 
32
 
 
33
        return obj_hash_set_value(hHash, ulHashValueLength, rgbHashValue);
 
34
}
 
35
 
 
36
TSS_RESULT
 
37
Tspi_Hash_GetHashValue(TSS_HHASH hHash,                 /* in */
 
38
                       UINT32 * pulHashValueLength,     /* out */
 
39
                       BYTE ** prgbHashValue)           /* out */
 
40
{
 
41
        if (pulHashValueLength == NULL || prgbHashValue == NULL)
 
42
                return TSPERR(TSS_E_BAD_PARAMETER);
 
43
 
 
44
        return obj_hash_get_value(hHash, pulHashValueLength, prgbHashValue);
 
45
}
 
46
 
 
47
TSS_RESULT
 
48
Tspi_Hash_UpdateHashValue(TSS_HHASH hHash,      /* in */
 
49
                          UINT32 ulDataLength,  /* in */
 
50
                          BYTE *rgbData)        /* in */
 
51
{
 
52
        if (rgbData == NULL && ulDataLength != 0)
 
53
                return TSPERR(TSS_E_BAD_PARAMETER);
 
54
 
 
55
        if (ulDataLength == 0)
 
56
                return TSS_SUCCESS;
 
57
 
 
58
        return obj_hash_update_value(hHash, ulDataLength, rgbData);
 
59
}