Home | History | Annotate | Line # | Download | only in tspi
      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
      8  *
      9  */
     10 
     11 #include <stdlib.h>
     12 #include <stdio.h>
     13 #include <string.h>
     14 
     15 #include "trousers/tss.h"
     16 #include "trousers_types.h"
     17 #include "spi_utils.h"
     18 #include "capabilities.h"
     19 #include "tsplog.h"
     20 #include "obj.h"
     21 
     22 TSS_RESULT
     23 Tspi_PcrComposite_SetPcrValue(TSS_HPCRS hPcrComposite,	/* in */
     24 			      UINT32 ulPcrIndex,	/* in */
     25 			      UINT32 ulPcrValueLength,	/* in */
     26 			      BYTE * rgbPcrValue)	/* in */
     27 {
     28 	if (ulPcrValueLength == 0 || rgbPcrValue == NULL)
     29 		return TSPERR(TSS_E_BAD_PARAMETER);
     30 
     31 	if (ulPcrValueLength != TCPA_SHA1_160_HASH_LEN)
     32 		return TSPERR(TSS_E_BAD_PARAMETER);
     33 
     34 	return obj_pcrs_set_value(hPcrComposite, ulPcrIndex, ulPcrValueLength, rgbPcrValue);
     35 }
     36 
     37 TSS_RESULT
     38 Tspi_PcrComposite_GetPcrValue(TSS_HPCRS hPcrComposite,		/* in */
     39 			      UINT32 ulPcrIndex,		/* in */
     40 			      UINT32 * pulPcrValueLength,	/* out */
     41 			      BYTE ** prgbPcrValue)		/* out */
     42 {
     43 	if (pulPcrValueLength == NULL || prgbPcrValue == NULL)
     44 		return TSPERR(TSS_E_BAD_PARAMETER);
     45 
     46 	return obj_pcrs_get_value(hPcrComposite, ulPcrIndex, pulPcrValueLength,
     47 					prgbPcrValue);
     48 
     49 }
     50 
     51 TSS_RESULT
     52 Tspi_PcrComposite_SelectPcrIndex(TSS_HPCRS hPcrComposite,	/* in */
     53 				 UINT32 ulPcrIndex)		/* in */
     54 {
     55 	return obj_pcrs_select_index(hPcrComposite, ulPcrIndex);
     56 }
     57