diff options
author | Sansar Choinyambuu <schoinya@hsr.ch> | 2011-08-08 13:34:13 +0200 |
---|---|---|
committer | Andreas Steffen <andreas.steffen@strongswan.org> | 2011-09-08 12:08:09 +0200 |
commit | 1f3f3021d549c69e41a72d1c3cf2eb0ae51a3621 (patch) | |
tree | cf58cc95a5c3c9a4a9f48ea169f1a2a234c1f43a | |
parent | 793d31279b16064401ec4205d4fd04c1fa35cae6 (diff) | |
download | strongswan-1f3f3021d549c69e41a72d1c3cf2eb0ae51a3621.tar.bz2 strongswan-1f3f3021d549c69e41a72d1c3cf2eb0ae51a3621.tar.xz |
Debugged TCG PTS attributes implementations
-rw-r--r-- | src/libimcv/Makefile.am | 3 | ||||
-rw-r--r-- | src/libimcv/tcg/tcg_pts_attr_aik.c | 41 | ||||
-rw-r--r-- | src/libimcv/tcg/tcg_pts_attr_aik.h | 2 | ||||
-rw-r--r-- | src/libimcv/tcg/tcg_pts_attr_get_aik.c | 7 | ||||
-rw-r--r-- | src/libimcv/tcg/tcg_pts_attr_get_tpm_version_info.c | 9 | ||||
-rw-r--r-- | src/libimcv/tcg/tcg_pts_attr_meas_algo.c | 17 | ||||
-rw-r--r-- | src/libimcv/tcg/tcg_pts_attr_meas_algo_selection.c | 27 | ||||
-rw-r--r-- | src/libimcv/tcg/tcg_pts_attr_meas_algo_selection.h | 2 | ||||
-rw-r--r-- | src/libimcv/tcg/tcg_pts_attr_proto_caps.c | 19 | ||||
-rw-r--r-- | src/libimcv/tcg/tcg_pts_attr_req_proto_caps.c | 19 | ||||
-rw-r--r-- | src/libimcv/tcg/tcg_pts_attr_tpm_version_info.c | 17 |
11 files changed, 87 insertions, 76 deletions
diff --git a/src/libimcv/Makefile.am b/src/libimcv/Makefile.am index 56379db64..7d2fe9aba 100644 --- a/src/libimcv/Makefile.am +++ b/src/libimcv/Makefile.am @@ -24,6 +24,9 @@ libimcv_la_SOURCES = \ tcg/tcg_pts_attr_tpm_version_info.h tcg/tcg_pts_attr_tpm_version_info.c \ tcg/tcg_pts_attr_get_aik.h tcg/tcg_pts_attr_get_aik.c \ tcg/tcg_pts_attr_aik.h tcg/tcg_pts_attr_aik.c + +CFLAGS = -Wall -Werror + SUBDIRS = . if USE_IMC_TEST diff --git a/src/libimcv/tcg/tcg_pts_attr_aik.c b/src/libimcv/tcg/tcg_pts_attr_aik.c index abd9215ef..501e058a0 100644 --- a/src/libimcv/tcg/tcg_pts_attr_aik.c +++ b/src/libimcv/tcg/tcg_pts_attr_aik.c @@ -39,12 +39,12 @@ typedef struct private_tcg_pts_attr_aik_t private_tcg_pts_attr_aik_t; #define PTS_AIK_SIZE 4 /** - * Private data of an private_tcg_pts_attr_aik_t object. + * Private data of an tcg_pts_attr_aik_t object. */ struct private_tcg_pts_attr_aik_t { /** - * Public members of private_tcg_pts_attr_tpm_version_info_t + * Public members of tcg_pts_attr_aik_t */ tcg_pts_attr_aik_t public; @@ -126,7 +126,7 @@ METHOD(pa_tnc_attr_t, build, void, } METHOD(pa_tnc_attr_t, process, status_t, - private_tcg_pts_attr_aik_t *this) + private_tcg_pts_attr_aik_t *this, u_int32_t *offset) { bio_reader_t *reader; u_int8_t flags; @@ -134,6 +134,7 @@ METHOD(pa_tnc_attr_t, process, status_t, if (this->value.len < PTS_AIK_SIZE) { DBG1(DBG_TNC, "insufficient data for Attestation Identity Key"); + *offset = 0; return FAILED; } reader = bio_reader_create(this->value); @@ -141,7 +142,7 @@ METHOD(pa_tnc_attr_t, process, status_t, reader->read_uint8(reader, &flags); if(flags) this->naked_pub_aik = true; - reader->read_data (reader, sizeof(this->value - 1), &this->aik); + reader->read_data (reader, sizeof(this->value) - 1, &this->aik); this->aik = chunk_clone(this->aik); reader->destroy(reader); @@ -156,16 +157,16 @@ METHOD(pa_tnc_attr_t, destroy, void, free(this); } -METHOD(pa_tnc_attr_t, get_naked_flag, bool, +METHOD(tcg_pts_attr_aik_t, get_naked_flag, bool, private_tcg_pts_attr_aik_t *this) { return this->naked_pub_aik; } -METHOD(pa_tnc_attr_t, set_naked_flag,void, - private_tcg_pts_attr_aik_t *this, bool naked) +METHOD(tcg_pts_attr_aik_t, set_naked_flag, void, + private_tcg_pts_attr_aik_t *this, bool naked_pub_aik) { - this->naked_pub_aik = naked; + this->naked_pub_aik = naked_pub_aik; } METHOD(tcg_pts_attr_aik_t, get_aik, chunk_t, @@ -178,13 +179,13 @@ METHOD(tcg_pts_attr_aik_t, set_aik, void, private_tcg_pts_attr_aik_t *this, chunk_t aik) { - return this->aik = aik; + this->aik = aik; } /** * Described in header. */ -pa_tnc_attr_t *tcg_pts_attr_tpm_version_info_create(bool naked_pub_aik, chunk_t aik) +pa_tnc_attr_t *tcg_pts_attr_aik_create(bool naked_pub_aik, chunk_t aik) { private_tcg_pts_attr_aik_t *this; @@ -200,14 +201,14 @@ pa_tnc_attr_t *tcg_pts_attr_tpm_version_info_create(bool naked_pub_aik, chunk_t .process = _process, .destroy = _destroy, }, - .get_naked_flag = get_naked_flag, - .set_naked_flag = set_naked_flag, - .get_aik = get_aik, - .set_aik = set_aik, + .get_naked_flag = _get_naked_flag, + .set_naked_flag = _set_naked_flag, + .get_aik = _get_aik, + .set_aik = _set_aik, }, .vendor_id = PEN_TCG, .type = TCG_PTS_AIK, - .naked_pub_aik = naked_pub_aik; + .naked_pub_aik = naked_pub_aik, .aik = aik, ); @@ -218,7 +219,7 @@ pa_tnc_attr_t *tcg_pts_attr_tpm_version_info_create(bool naked_pub_aik, chunk_t /** * Described in header. */ -pa_tnc_attr_t *tcg_pts_attr_tpm_version_info_create_from_data(chunk_t data) +pa_tnc_attr_t *tcg_pts_attr_aik_create_from_data(chunk_t data) { private_tcg_pts_attr_aik_t *this; @@ -234,10 +235,10 @@ pa_tnc_attr_t *tcg_pts_attr_tpm_version_info_create_from_data(chunk_t data) .process = _process, .destroy = _destroy, }, - .get_naked_flag = get_naked_flag, - .set_naked_flag = set_naked_flag, - .get_aik = get_aik, - .set_aik = set_aik, + .get_naked_flag = _get_naked_flag, + .set_naked_flag = _set_naked_flag, + .get_aik = _get_aik, + .set_aik = _set_aik, }, .vendor_id = PEN_TCG, .type = TCG_PTS_AIK, diff --git a/src/libimcv/tcg/tcg_pts_attr_aik.h b/src/libimcv/tcg/tcg_pts_attr_aik.h index a139580b4..a417e8dc8 100644 --- a/src/libimcv/tcg/tcg_pts_attr_aik.h +++ b/src/libimcv/tcg/tcg_pts_attr_aik.h @@ -50,7 +50,7 @@ struct tcg_pts_attr_aik_t { * @param naked flag */ void (*set_naked_flag)(tcg_pts_attr_aik_t *this, - bool naked); + bool naked_pub_aik); /** * Get AIK diff --git a/src/libimcv/tcg/tcg_pts_attr_get_aik.c b/src/libimcv/tcg/tcg_pts_attr_get_aik.c index 6539d62dc..1de386ec6 100644 --- a/src/libimcv/tcg/tcg_pts_attr_get_aik.c +++ b/src/libimcv/tcg/tcg_pts_attr_get_aik.c @@ -38,12 +38,12 @@ typedef struct private_tcg_pts_attr_get_aik_t private_tcg_pts_attr_get_aik_t; #define PTS_GET_AIK_RESERVED 0x00 /** - * Private data of an private_tcg_pts_attr_get_aik_t object. + * Private data of an tcg_pts_attr_get_aik_t object. */ struct private_tcg_pts_attr_get_aik_t { /** - * Public members of private_tcg_pts_attr_get_aik_t + * Public members of tcg_pts_attr_get_aik_t */ tcg_pts_attr_get_aik_t public; @@ -111,7 +111,7 @@ METHOD(pa_tnc_attr_t, build, void, } METHOD(pa_tnc_attr_t, process, status_t, - private_tcg_pts_attr_get_aik_t *this) + private_tcg_pts_attr_get_aik_t *this, u_int32_t *offset) { bio_reader_t *reader; u_int32_t reserved; @@ -119,6 +119,7 @@ METHOD(pa_tnc_attr_t, process, status_t, if (this->value.len < PTS_GET_AIK_SIZE) { DBG1(DBG_TNC, "insufficient data for Get AIK"); + *offset = 0; return FAILED; } reader = bio_reader_create(this->value); diff --git a/src/libimcv/tcg/tcg_pts_attr_get_tpm_version_info.c b/src/libimcv/tcg/tcg_pts_attr_get_tpm_version_info.c index 5fbd91831..56cf34bed 100644 --- a/src/libimcv/tcg/tcg_pts_attr_get_tpm_version_info.c +++ b/src/libimcv/tcg/tcg_pts_attr_get_tpm_version_info.c @@ -38,12 +38,12 @@ typedef struct private_tcg_pts_attr_get_tpm_version_info_t private_tcg_pts_attr_ #define PTS_GET_TPM_VER_INFO_RESERVED 0x00 /** - * Private data of an private_tcg_pts_attr_get_tpm_version_info_t object. + * Private data of an tcg_pts_attr_get_tpm_version_info_t object. */ struct private_tcg_pts_attr_get_tpm_version_info_t { /** - * Public members of private_tcg_pts_attr_req_proto_caps_t + * Public members of tcg_pts_attr_get_tpm_version_info_t */ tcg_pts_attr_get_tpm_version_info_t public; @@ -111,7 +111,7 @@ METHOD(pa_tnc_attr_t, build, void, } METHOD(pa_tnc_attr_t, process, status_t, - private_tcg_pts_attr_get_tpm_version_info_t *this) + private_tcg_pts_attr_get_tpm_version_info_t *this, u_int32_t *offset) { bio_reader_t *reader; u_int32_t reserved; @@ -119,13 +119,14 @@ METHOD(pa_tnc_attr_t, process, status_t, if (this->value.len < PTS_GET_TPM_VER_INFO_SIZE) { DBG1(DBG_TNC, "insufficient data for Get TPM Version Information"); + *offset = 0; return FAILED; } reader = bio_reader_create(this->value); reader->read_uint32 (reader, &reserved); reader->destroy(reader); - return SUCCESS; + return SUCCESS; } METHOD(pa_tnc_attr_t, destroy, void, diff --git a/src/libimcv/tcg/tcg_pts_attr_meas_algo.c b/src/libimcv/tcg/tcg_pts_attr_meas_algo.c index 1eb52d85d..2f2fdb2c4 100644 --- a/src/libimcv/tcg/tcg_pts_attr_meas_algo.c +++ b/src/libimcv/tcg/tcg_pts_attr_meas_algo.c @@ -50,12 +50,12 @@ typedef struct private_tcg_pts_attr_meas_algo_t private_tcg_pts_attr_meas_algo_t #define PTS_MEAS_ALGO_RESERVED 0x00 /** - * Private data of an private_tcg_pts_attr_req_proto_caps_t object. + * Private data of an tcg_pts_attr_meas_algo_t object. */ struct private_tcg_pts_attr_meas_algo_t { /** - * Public members of private_tcg_pts_attr_meas_algo_t + * Public members of tcg_pts_attr_meas_algo_t */ tcg_pts_attr_meas_algo_t public; @@ -136,7 +136,7 @@ METHOD(pa_tnc_attr_t, build, void, } METHOD(pa_tnc_attr_t, process, status_t, - private_tcg_pts_attr_meas_algo_t *this) + private_tcg_pts_attr_meas_algo_t *this, u_int32_t *offset) { bio_reader_t *reader; u_int16_t reserved; @@ -145,6 +145,7 @@ METHOD(pa_tnc_attr_t, process, status_t, if (this->value.len < PTS_MEAS_ALGO_SIZE) { DBG1(DBG_TNC, "insufficient data for PTS Measurement Algorithm"); + *offset = 0; return FAILED; } reader = bio_reader_create(this->value); @@ -177,7 +178,7 @@ METHOD(tcg_pts_attr_meas_algo_t, set_algorithms, void, private_tcg_pts_attr_meas_algo_t *this, pts_attr_meas_algorithms_t algorithms) { - return this->algorithms = algorithms; + this->algorithms = algorithms; } /** @@ -199,8 +200,8 @@ pa_tnc_attr_t *tcg_pts_attr_meas_algo_create(pts_attr_meas_algorithms_t algorith .process = _process, .destroy = _destroy, }, - .get_algorithms = get_algorithms, - .set_algorithms = set_algorithms, + .get_algorithms = _get_algorithms, + .set_algorithms = _set_algorithms, }, .vendor_id = PEN_TCG, .type = TCG_PTS_MEAS_ALGO, @@ -230,8 +231,8 @@ pa_tnc_attr_t *tcg_pts_attr_meas_algo_create_from_data(chunk_t data) .process = _process, .destroy = _destroy, }, - .get_algorithms = get_algorithms, - .set_algorithms = set_algorithms, + .get_algorithms = _get_algorithms, + .set_algorithms = _set_algorithms, }, .vendor_id = PEN_TCG, .type = TCG_PTS_MEAS_ALGO, diff --git a/src/libimcv/tcg/tcg_pts_attr_meas_algo_selection.c b/src/libimcv/tcg/tcg_pts_attr_meas_algo_selection.c index 589596135..9788d1b21 100644 --- a/src/libimcv/tcg/tcg_pts_attr_meas_algo_selection.c +++ b/src/libimcv/tcg/tcg_pts_attr_meas_algo_selection.c @@ -50,12 +50,12 @@ typedef struct private_tcg_pts_attr_meas_algo_selection_t private_tcg_pts_attr_m #define PTS_MEAS_ALGO_SEL_RESERVED 0x00 /** - * Private data of an private_tcg_pts_attr_meas_algo_selection_t object. + * Private data of an tcg_pts_attr_meas_algo_selection_t object. */ struct private_tcg_pts_attr_meas_algo_selection_t { /** - * Public members of private_tcg_pts_attr_meas_algo_t + * Public members of tcg_pts_attr_meas_algo_selection_t */ tcg_pts_attr_meas_algo_selection_t public; @@ -136,7 +136,7 @@ METHOD(pa_tnc_attr_t, build, void, } METHOD(pa_tnc_attr_t, process, status_t, - private_tcg_pts_attr_meas_algo_selection_t *this) + private_tcg_pts_attr_meas_algo_selection_t *this, u_int32_t *offset) { bio_reader_t *reader; u_int16_t reserved; @@ -145,6 +145,7 @@ METHOD(pa_tnc_attr_t, process, status_t, if (this->value.len < PTS_MEAS_ALGO_SEL_SIZE) { DBG1(DBG_TNC, "insufficient data for PTS Measurement Algorithm Selection"); + *offset = 0; return FAILED; } reader = bio_reader_create(this->value); @@ -167,23 +168,23 @@ METHOD(pa_tnc_attr_t, destroy, void, free(this); } -METHOD(tcg_pts_attr_meas_algo_t, get_algorithm, pts_attr_meas_algorithms_t, +METHOD(tcg_pts_attr_meas_algo_selection_t, get_algorithm, pts_attr_meas_algorithms_t, private_tcg_pts_attr_meas_algo_selection_t *this) { - return this->algorithms; + return this->algorithm; } -METHOD(tcg_pts_attr_meas_algo_t, set_algorithm, void, +METHOD(tcg_pts_attr_meas_algo_selection_t, set_algorithm, void, private_tcg_pts_attr_meas_algo_selection_t *this, pts_attr_meas_algorithms_t algorithm) { - return this->algorithm = algorithm; + this->algorithm = algorithm; } /** * Described in header. */ -pa_tnc_attr_t *tcg_pts_attr_meas_algo_create(pts_attr_meas_algorithms_t algorithm) +pa_tnc_attr_t *tcg_pts_attr_meas_algo_selection_create(pts_attr_meas_algorithms_t algorithm) { private_tcg_pts_attr_meas_algo_selection_t *this; @@ -199,8 +200,8 @@ pa_tnc_attr_t *tcg_pts_attr_meas_algo_create(pts_attr_meas_algorithms_t algorith .process = _process, .destroy = _destroy, }, - .get_algorithm = get_algorithm, - .set_algorithm = set_algorithm, + .get_algorithm = _get_algorithm, + .set_algorithm = _set_algorithm, }, .vendor_id = PEN_TCG, .type = TCG_PTS_MEAS_ALGO_SELECTION, @@ -214,7 +215,7 @@ pa_tnc_attr_t *tcg_pts_attr_meas_algo_create(pts_attr_meas_algorithms_t algorith /** * Described in header. */ -pa_tnc_attr_t *tcg_pts_attr_meas_algo_create_from_data(chunk_t data) +pa_tnc_attr_t *tcg_pts_attr_meas_algo_selection_create_from_data(chunk_t data) { private_tcg_pts_attr_meas_algo_selection_t *this; @@ -230,8 +231,8 @@ pa_tnc_attr_t *tcg_pts_attr_meas_algo_create_from_data(chunk_t data) .process = _process, .destroy = _destroy, }, - .get_algorithm = get_algorithm, - .set_algorithm = set_algorithm, + .get_algorithm = _get_algorithm, + .set_algorithm = _set_algorithm, }, .vendor_id = PEN_TCG, .type = TCG_PTS_MEAS_ALGO_SELECTION, diff --git a/src/libimcv/tcg/tcg_pts_attr_meas_algo_selection.h b/src/libimcv/tcg/tcg_pts_attr_meas_algo_selection.h index 081e451b3..48434e31b 100644 --- a/src/libimcv/tcg/tcg_pts_attr_meas_algo_selection.h +++ b/src/libimcv/tcg/tcg_pts_attr_meas_algo_selection.h @@ -63,7 +63,7 @@ struct tcg_pts_attr_meas_algo_selection_t { * @param flags A Selected Measurement Algorithm */ void (*set_algorithm)(tcg_pts_attr_meas_algo_selection_t *this, - pts_attr_meas_algorithms_t algorithms); + pts_attr_meas_algorithms_t algorithm); }; diff --git a/src/libimcv/tcg/tcg_pts_attr_proto_caps.c b/src/libimcv/tcg/tcg_pts_attr_proto_caps.c index 1a7107658..cee10f2a0 100644 --- a/src/libimcv/tcg/tcg_pts_attr_proto_caps.c +++ b/src/libimcv/tcg/tcg_pts_attr_proto_caps.c @@ -38,12 +38,12 @@ typedef struct private_tcg_pts_attr_proto_caps_t private_tcg_pts_attr_proto_caps #define PTS_PROTO_CAPS_RESERVED 0x00 /** - * Private data of an private_tcg_pts_attr_proto_caps_t object. + * Private data of an tcg_pts_attr_proto_caps_t object. */ struct private_tcg_pts_attr_proto_caps_t { /** - * Public members of private_tcg_pts_attr_proto_caps_t + * Public members of tcg_pts_attr_proto_caps_t */ tcg_pts_attr_proto_caps_t public; @@ -126,15 +126,16 @@ METHOD(pa_tnc_attr_t, build, void, } METHOD(pa_tnc_attr_t, process, status_t, - private_tcg_pts_attr_proto_caps_t *this) + private_tcg_pts_attr_proto_caps_t *this, u_int32_t *offset) { bio_reader_t *reader; - u_int24_t reserved; + u_int32_t reserved; u_int8_t flags; if (this->value.len < PTS_PROTO_CAPS_SIZE) { DBG1(DBG_TNC, "insufficient data for PTS Protocol Capabilities"); + *offset = 0; return FAILED; } reader = bio_reader_create(this->value); @@ -169,7 +170,7 @@ METHOD(tcg_pts_attr_proto_caps_t, set_flags, void, private_tcg_pts_attr_proto_caps_t *this, pts_attr_proto_caps_flag_t flags) { - return this->flags = flags; + this->flags = flags; } /** @@ -191,8 +192,8 @@ pa_tnc_attr_t *tcg_pts_attr_proto_caps_create(pts_attr_proto_caps_flag_t flags) .process = _process, .destroy = _destroy, }, - .get_flags = get_flags, - .set_flags = set_flags, + .get_flags = _get_flags, + .set_flags = _set_flags, }, .vendor_id = PEN_TCG, .type = TCG_PTS_PROTO_CAPS, @@ -222,8 +223,8 @@ pa_tnc_attr_t *tcg_pts_attr_proto_caps_create_from_data(chunk_t data) .process = _process, .destroy = _destroy, }, - .get_flags = get_flags, - .set_flags = set_flags, + .get_flags = _get_flags, + .set_flags = _set_flags, }, .vendor_id = PEN_TCG, .type = TCG_PTS_PROTO_CAPS, diff --git a/src/libimcv/tcg/tcg_pts_attr_req_proto_caps.c b/src/libimcv/tcg/tcg_pts_attr_req_proto_caps.c index 60bce6233..834d5a3cb 100644 --- a/src/libimcv/tcg/tcg_pts_attr_req_proto_caps.c +++ b/src/libimcv/tcg/tcg_pts_attr_req_proto_caps.c @@ -38,12 +38,12 @@ typedef struct private_tcg_pts_attr_req_proto_caps_t private_tcg_pts_attr_req_pr #define PTS_PROTO_CAPS_RESERVED 0x00 /** - * Private data of an private_tcg_pts_attr_req_proto_caps_t object. + * Private data of an tcg_pts_attr_req_proto_caps_t object. */ struct private_tcg_pts_attr_req_proto_caps_t { /** - * Public members of private_tcg_pts_attr_req_proto_caps_t + * Public members of tcg_pts_attr_req_proto_caps_t */ tcg_pts_attr_req_proto_caps_t public; @@ -126,15 +126,16 @@ METHOD(pa_tnc_attr_t, build, void, } METHOD(pa_tnc_attr_t, process, status_t, - private_tcg_pts_attr_req_proto_caps_t *this) + private_tcg_pts_attr_req_proto_caps_t *this, u_int32_t *offset) { bio_reader_t *reader; - u_int24_t reserved; + u_int32_t reserved; u_int8_t flags; if (this->value.len < PTS_PROTO_CAPS_SIZE) { DBG1(DBG_TNC, "insufficient data for Request PTS Protocol Capabilities"); + *offset = 0; return FAILED; } reader = bio_reader_create(this->value); @@ -169,7 +170,7 @@ METHOD(tcg_pts_attr_req_proto_caps_t, set_flags, void, private_tcg_pts_attr_req_proto_caps_t *this, pts_attr_req_proto_caps_flag_t flags) { - return this->flags = flags; + this->flags = flags; } /** @@ -191,8 +192,8 @@ pa_tnc_attr_t *tcg_pts_attr_req_proto_caps_create(pts_attr_req_proto_caps_flag_t .process = _process, .destroy = _destroy, }, - .get_flags = get_flags, - .set_flags = set_flags, + .get_flags = _get_flags, + .set_flags = _set_flags, }, .vendor_id = PEN_TCG, .type = TCG_PTS_REQ_PROTO_CAPS, @@ -222,8 +223,8 @@ pa_tnc_attr_t *tcg_pts_attr_req_proto_caps_create_from_data(chunk_t data) .process = _process, .destroy = _destroy, }, - .get_flags = get_flags, - .set_flags = set_flags, + .get_flags = _get_flags, + .set_flags = _set_flags, }, .vendor_id = PEN_TCG, .type = TCG_PTS_REQ_PROTO_CAPS, diff --git a/src/libimcv/tcg/tcg_pts_attr_tpm_version_info.c b/src/libimcv/tcg/tcg_pts_attr_tpm_version_info.c index ad9f8debe..d3fa335d3 100644 --- a/src/libimcv/tcg/tcg_pts_attr_tpm_version_info.c +++ b/src/libimcv/tcg/tcg_pts_attr_tpm_version_info.c @@ -38,12 +38,12 @@ typedef struct private_tcg_pts_attr_tpm_version_info_t private_tcg_pts_attr_tpm_ #define PTS_TPM_VER_INFO_SIZE 4 /** - * Private data of an private_tcg_pts_attr_tpm_version_info_t object. + * Private data of an tcg_pts_attr_tpm_version_info_t object. */ struct private_tcg_pts_attr_tpm_version_info_t { /** - * Public members of private_tcg_pts_attr_tpm_version_info_t + * Public members of tcg_pts_attr_tpm_version_info_t */ tcg_pts_attr_tpm_version_info_t public; @@ -116,13 +116,14 @@ METHOD(pa_tnc_attr_t, build, void, } METHOD(pa_tnc_attr_t, process, status_t, - private_tcg_pts_attr_tpm_version_info_t *this) + private_tcg_pts_attr_tpm_version_info_t *this, u_int32_t *offset) { bio_reader_t *reader; if (this->value.len < PTS_TPM_VER_INFO_SIZE) { DBG1(DBG_TNC, "insufficient data for TPM Version Information"); + *offset = 0; return FAILED; } reader = bio_reader_create(this->value); @@ -151,7 +152,7 @@ METHOD(tcg_pts_attr_tpm_version_info_t, set_tpm_version_info, void, private_tcg_pts_attr_tpm_version_info_t *this, chunk_t tpm_version_info) { - return this->tpm_version_info = tpm_version_info; + this->tpm_version_info = tpm_version_info; } /** @@ -173,8 +174,8 @@ pa_tnc_attr_t *tcg_pts_attr_tpm_version_info_create(chunk_t tpm_version_info) .process = _process, .destroy = _destroy, }, - .get_tpm_version_info = get_tpm_version_info, - .set_tpm_version_info = set_tpm_version_info, + .get_tpm_version_info = _get_tpm_version_info, + .set_tpm_version_info = _set_tpm_version_info, }, .vendor_id = PEN_TCG, .type = TCG_PTS_TPM_VERSION_INFO, @@ -204,8 +205,8 @@ pa_tnc_attr_t *tcg_pts_attr_tpm_version_info_create_from_data(chunk_t data) .process = _process, .destroy = _destroy, }, - .get_tpm_version_info = get_tpm_version_info, - .set_tpm_version_info = set_tpm_version_info, + .get_tpm_version_info = _get_tpm_version_info, + .set_tpm_version_info = _set_tpm_version_info, }, .vendor_id = PEN_TCG, .type = TCG_PTS_TPM_VERSION_INFO, |