Return to pts_comp_evidence.h CVS log | Up to [ELWIX - Embedded LightWeight unIX -] / embedaddon / strongswan / src / libimcv / pts / components |
1.1 misho 1: /* 2: * Copyright (C) 2011 Sansar Choinyambuu, Andreas Steffen 3: * HSR Hochschule fuer Technik Rapperswil 4: * 5: * This program is free software; you can redistribute it and/or modify it 6: * under the terms of the GNU General Public License as published by the 7: * Free Software Foundation; either version 2 of the License, or (at your 8: * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. 9: * 10: * This program is distributed in the hope that it will be useful, but 11: * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13: * for more details. 14: */ 15: 16: /** 17: * @defgroup pts_comp_evidence pts_comp_evidence 18: * @{ @ingroup pts 19: */ 20: 21: #ifndef PTS_COMP_EVIDENCE_H_ 22: #define PTS_COMP_EVIDENCE_H_ 23: 24: typedef struct pts_comp_evidence_t pts_comp_evidence_t; 25: typedef enum pts_pcr_transform_t pts_pcr_transform_t; 26: typedef enum pts_comp_evid_validation_t pts_comp_evid_validation_t; 27: 28: #include "pts/pts_meas_algo.h" 29: #include "pts/components/pts_comp_func_name.h" 30: 31: #include <library.h> 32: 33: /** 34: * PTS PCR Transformations 35: */ 36: enum pts_pcr_transform_t { 37: /** No Transformation */ 38: PTS_PCR_TRANSFORM_NO = 0, 39: /** Hash Value matched PCR size */ 40: PTS_PCR_TRANSFORM_MATCH = 1, 41: /** Hash value shorter than PCR size */ 42: PTS_PCR_TRANSFORM_SHORT = 2, 43: /** Hash value longer than PCR size */ 44: PTS_PCR_TRANSFORM_LONG = 3, 45: }; 46: 47: /** 48: * PTS Component Evidence Validation Result Flags 49: */ 50: enum pts_comp_evid_validation_t { 51: /** No Validation was attempted */ 52: PTS_COMP_EVID_VALIDATION_NONE = 0x00, 53: /** Attempted validation, unable to verify */ 54: PTS_COMP_EVID_VALIDATION_UNABLE = 0x20, 55: /** Attempted validation, verification failed */ 56: PTS_COMP_EVID_VALIDATION_FAILED = 0x40, 57: /** Attempted validation, verification passed */ 58: PTS_COMP_EVID_VALIDATION_PASSED = 0x60, 59: }; 60: 61: /** 62: * PTS Functional Component Interface 63: */ 64: struct pts_comp_evidence_t { 65: 66: /** 67: * Gets the Component Functional Name and Sub-Component Depth 68: * 69: * @param depth Sub-Component Depth 70: * @result Component Functional Name 71: */ 72: pts_comp_func_name_t* (*get_comp_func_name)(pts_comp_evidence_t *this, 73: uint32_t *depth); 74: 75: /** 76: * Gets the PCR the measurement was extended into 77: * 78: * @result PCR the measurement was extended into 79: */ 80: uint32_t (*get_extended_pcr)(pts_comp_evidence_t *this); 81: 82: /** 83: * Gets the measurement and the algorithms used 84: * 85: * @param extended_pcr PCR the measurement was extended into 86: * @param algo Measurement hash algorithm 87: * @param transform Transformation used for PCR extension 88: * @param measurement_time Time the measurement was taken 89: * @result Measurement hash value 90: */ 91: chunk_t (*get_measurement)(pts_comp_evidence_t *this, 92: uint32_t *extended_pcr, 93: pts_meas_algorithms_t *algo, 94: pts_pcr_transform_t *transform, 95: time_t *measurement_time); 96: 97: /** 98: * Gets the PCR information if available 99: * 100: * @param pcr_before PCR value before extension 101: * @param pcr_after PCR value after extension 102: * @result TRUE if PCR information is available 103: */ 104: bool (*get_pcr_info)(pts_comp_evidence_t *this, chunk_t *pcr_before, 105: chunk_t *pcr_after); 106: 107: /** 108: * Sets PCR information if available 109: * 110: * @param pcr_before PCR value before extension 111: * @param pcr_after PCR value after extension 112: */ 113: void (*set_pcr_info)(pts_comp_evidence_t *this, chunk_t pcr_before, 114: chunk_t pcr_after); 115: 116: /** 117: * Gets Validation Result if available 118: * 119: * @param uri Verification Policy URI 120: * @return validation Validation Result 121: */ 122: pts_comp_evid_validation_t (*get_validation)(pts_comp_evidence_t *this, 123: char **uri); 124: 125: /** 126: * Sets Validation Result if available 127: * 128: * @param validation Validation Result 129: * @param uri Verification Policy URI 130: */ 131: void (*set_validation)(pts_comp_evidence_t *this, 132: pts_comp_evid_validation_t validation, char* uri); 133: 134: /** 135: * Destroys a pts_comp_evidence_t object. 136: */ 137: void (*destroy)(pts_comp_evidence_t *this); 138: 139: }; 140: 141: /** 142: * Creates a pts_comp_evidence_t object 143: * 144: * @param name Component Functional Name 145: * @param depth Sub-component depth 146: * @param extended_pcr PCR the measurement was extended into 147: * @param algo Measurement hash algorithm 148: * @param transform Transformation used for PCR extension 149: * @param measurement_time Time the measurement was taken, 0 if unknown 150: * @param measurement Measurement hash value 151: */ 152: pts_comp_evidence_t* pts_comp_evidence_create(pts_comp_func_name_t *name, 153: uint32_t depth, 154: uint32_t extended_pcr, 155: pts_meas_algorithms_t algo, 156: pts_pcr_transform_t transform, 157: time_t measurement_time, 158: chunk_t measurement); 159: 160: /** 161: * Determine transform to fit measurement hash into PCR register 162: * 163: * @param algo Measurement hash algorithm 164: * @param pcr_len Length of the PCR registers in bytes 165: * @return PCR transform type 166: */ 167: pts_pcr_transform_t pts_meas_algo_to_pcr_transform(pts_meas_algorithms_t algo, 168: size_t pcr_len); 169: 170: #endif /** PTS_COMP_EVIDENCE_H_ @}*/