diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2012-11-25 14:36:20 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2012-11-25 14:36:20 +0000 |
commit | c3649a2def02c41d837ae1f79dda729ccb91e677 (patch) | |
tree | bea46dff212fdef977fe9094a70a939e8cc21885 /src/tspi/tspi_pcr_comp.c | |
download | trousers-upstream/0.3.9.tar.gz |
Imported Upstream version 0.3.9upstream/0.3.9upstream
Diffstat (limited to 'src/tspi/tspi_pcr_comp.c')
-rw-r--r-- | src/tspi/tspi_pcr_comp.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/tspi/tspi_pcr_comp.c b/src/tspi/tspi_pcr_comp.c new file mode 100644 index 0000000..e475ee2 --- /dev/null +++ b/src/tspi/tspi_pcr_comp.c @@ -0,0 +1,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); +} |