summaryrefslogtreecommitdiff
path: root/src/tspi/tspi_pcr_comp.c
blob: e475ee2e3f48e4802286b3ddd4497ea4d0d98c33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56

/*
 * Licensed Materials - Property of IBM
 *
 * trousers - An open source TCG Software Stack
 *
 * (C) Copyright International Business Machines Corp. 2004
 *
 */

#include <stdlib.h>
#include <stdio.h>
#include <string.h>

#include "trousers/tss.h"
#include "trousers_types.h"
#include "spi_utils.h"
#include "capabilities.h"
#include "tsplog.h"
#include "obj.h"

TSS_RESULT
Tspi_PcrComposite_SetPcrValue(TSS_HPCRS hPcrComposite,	/* in */
			      UINT32 ulPcrIndex,	/* in */
			      UINT32 ulPcrValueLength,	/* in */
			      BYTE * rgbPcrValue)	/* in */
{
	if (ulPcrValueLength == 0 || rgbPcrValue == NULL)
		return TSPERR(TSS_E_BAD_PARAMETER);

	if (ulPcrValueLength != TCPA_SHA1_160_HASH_LEN)
		return TSPERR(TSS_E_BAD_PARAMETER);

	return obj_pcrs_set_value(hPcrComposite, ulPcrIndex, ulPcrValueLength, rgbPcrValue);
}

TSS_RESULT
Tspi_PcrComposite_GetPcrValue(TSS_HPCRS hPcrComposite,		/* in */
			      UINT32 ulPcrIndex,		/* in */
			      UINT32 * pulPcrValueLength,	/* out */
			      BYTE ** prgbPcrValue)		/* out */
{
	if (pulPcrValueLength == NULL || prgbPcrValue == NULL)
		return TSPERR(TSS_E_BAD_PARAMETER);

	return obj_pcrs_get_value(hPcrComposite, ulPcrIndex, pulPcrValueLength,
					prgbPcrValue);

}

TSS_RESULT
Tspi_PcrComposite_SelectPcrIndex(TSS_HPCRS hPcrComposite,	/* in */
				 UINT32 ulPcrIndex)		/* in */
{
	return obj_pcrs_select_index(hPcrComposite, ulPcrIndex);
}