static upper size limit for PA-TNC messages
authorAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 12 Jul 2012 10:49:49 +0000 (12:49 +0200)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Thu, 12 Jul 2012 19:26:18 +0000 (21:26 +0200)
27 files changed:
src/libimcv/ietf/ietf_attr_pa_tnc_error.c
src/libimcv/ietf/ietf_attr_port_filter.c
src/libimcv/ietf/ietf_attr_product_info.c
src/libimcv/imc/imc_agent.c
src/libimcv/imv/imv_agent.c
src/libimcv/ita/ita_attr_command.c
src/libimcv/ita/ita_attr_dummy.c
src/libimcv/pa_tnc/pa_tnc_msg.c
src/libimcv/pa_tnc/pa_tnc_msg.h
src/libimcv/plugins/imv_test/imv_test.c
src/libpts/tcg/tcg_pts_attr_aik.c
src/libpts/tcg/tcg_pts_attr_dh_nonce_finish.c
src/libpts/tcg/tcg_pts_attr_dh_nonce_params_req.c
src/libpts/tcg/tcg_pts_attr_dh_nonce_params_resp.c
src/libpts/tcg/tcg_pts_attr_file_meas.c
src/libpts/tcg/tcg_pts_attr_gen_attest_evid.c
src/libpts/tcg/tcg_pts_attr_get_aik.c
src/libpts/tcg/tcg_pts_attr_get_tpm_version_info.c
src/libpts/tcg/tcg_pts_attr_meas_algo.c
src/libpts/tcg/tcg_pts_attr_proto_caps.c
src/libpts/tcg/tcg_pts_attr_req_file_meas.c
src/libpts/tcg/tcg_pts_attr_req_file_meta.c
src/libpts/tcg/tcg_pts_attr_req_func_comp_evid.c
src/libpts/tcg/tcg_pts_attr_simple_comp_evid.c
src/libpts/tcg/tcg_pts_attr_simple_evid_final.c
src/libpts/tcg/tcg_pts_attr_tpm_version_info.c
src/libpts/tcg/tcg_pts_attr_unix_file_meta.c

index 6daee1a..479c47c 100644 (file)
@@ -192,6 +192,10 @@ METHOD(pa_tnc_attr_t, build, void,
 {
        bio_writer_t *writer;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        writer = bio_writer_create(PA_ERROR_HEADER_SIZE + PA_ERROR_MSG_INFO_SIZE);
        writer->write_uint8 (writer, PA_ERROR_RESERVED);
        writer->write_uint24(writer, this->error_vendor_id);
index b530196..ebf498c 100644 (file)
@@ -125,6 +125,10 @@ METHOD(pa_tnc_attr_t, build, void,
        enumerator_t *enumerator;
        port_entry_t *entry;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        writer = bio_writer_create(this->ports->get_count(this->ports) *
                                                           PORT_FILTER_ENTRY_SIZE);
 
index 5487935..703a8ab 100644 (file)
@@ -122,6 +122,10 @@ METHOD(pa_tnc_attr_t, build, void,
        bio_writer_t *writer;
        chunk_t product_name;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        product_name = chunk_create(this->product_name, strlen(this->product_name));
 
        writer = bio_writer_create(PRODUCT_INFO_MIN_SIZE);
index fcf8dac..844cae8 100644 (file)
@@ -48,6 +48,11 @@ struct private_imc_agent_t {
        TNC_MessageSubtype subtype;
 
        /**
+        * Maximum PA-TNC Message size
+        */
+       size_t max_msg_len;
+
+       /**
         * ID of IMC as assigned by TNCC
         */
        TNC_IMCID id;
@@ -461,6 +466,7 @@ METHOD(imc_agent_t, send_message, TNC_Result,
        pa_tnc_attr_t *attr;
        pa_tnc_msg_t *pa_tnc_msg;
        chunk_t msg;
+       enumerator_t *enumerator;
 
        state = find_connection(this, connection_id);
        if (!state)
@@ -470,36 +476,52 @@ METHOD(imc_agent_t, send_message, TNC_Result,
                return TNC_RESULT_FATAL;
        }
 
-       pa_tnc_msg = pa_tnc_msg_create();
-
-       while (attr_list->remove_first(attr_list, (void**)&attr) == SUCCESS)
+       while (attr_list->get_count(attr_list))
        {
-               pa_tnc_msg->add_attribute(pa_tnc_msg, attr);
-       }
-       pa_tnc_msg->build(pa_tnc_msg);
-       msg = pa_tnc_msg->get_encoding(pa_tnc_msg);
+               pa_tnc_msg = pa_tnc_msg_create(this->max_msg_len);
 
-       if (state->has_long(state) && this->send_message_long)
-       {
-               if (!src_imc_id)
+               enumerator = attr_list->create_enumerator(attr_list);
+               while (enumerator->enumerate(enumerator, &attr))
                {
-                       src_imc_id = this->id;
+                       if (!pa_tnc_msg->add_attribute(pa_tnc_msg, attr))
+                       {
+                               break;
+                       }
+                       attr_list->remove_at(attr_list, enumerator);
                }
-               msg_flags = excl ? TNC_MESSAGE_FLAGS_EXCLUSIVE : 0;
+               enumerator->destroy(enumerator);
 
-               result = this->send_message_long(src_imc_id, connection_id, msg_flags,
-                                                                                msg.ptr, msg.len, this->vendor_id,
-                                                                                this->subtype, dst_imv_id);
-       }
-       else if (this->send_message)
-       {
-               type = (this->vendor_id << 8) | this->subtype;
+               /* build and send the PA-TNC message via the IF-IMC interface */
+               pa_tnc_msg->build(pa_tnc_msg);
+               msg = pa_tnc_msg->get_encoding(pa_tnc_msg);
 
-               result = this->send_message(this->id, connection_id, msg.ptr, msg.len,
-                                                                       type);
-       }
-       pa_tnc_msg->destroy(pa_tnc_msg);
+               if (state->has_long(state) && this->send_message_long)
+               {
+                       if (!src_imc_id)
+                       {
+                               src_imc_id = this->id;
+                       }
+                       msg_flags = excl ? TNC_MESSAGE_FLAGS_EXCLUSIVE : 0;
+
+                       result = this->send_message_long(src_imc_id, connection_id,
+                                                               msg_flags, msg.ptr, msg.len, this->vendor_id,
+                                                               this->subtype, dst_imv_id);
+               }
+               else if (this->send_message)
+               {
+                       type = (this->vendor_id << 8) | this->subtype;
+
+                       result = this->send_message(this->id, connection_id, msg.ptr,
+                                                               msg.len, type);
+               }
 
+               pa_tnc_msg->destroy(pa_tnc_msg);
+
+               if (result != TNC_RESULT_SUCCESS)
+               {
+                       break;
+               }
+       }
        return result;
 }
 
@@ -549,7 +571,7 @@ METHOD(imc_agent_t, receive_message, TNC_Result,
                        break;
                case VERIFY_ERROR:
                        /* build error message */
-                       error_msg = pa_tnc_msg_create();
+                       error_msg = pa_tnc_msg_create(this->max_msg_len);
                        enumerator = pa_msg->create_error_enumerator(pa_msg);
                        while (enumerator->enumerate(enumerator, &error_attr))
                        {
@@ -693,6 +715,7 @@ imc_agent_t *imc_agent_create(const char *name,
                .name = name,
                .vendor_id = vendor_id,
                .subtype = subtype,
+               .max_msg_len = 65490,
                .id = id,
                .additional_ids = linked_list_create(),
                .connections = linked_list_create(),
index b67dcad..9f04421 100644 (file)
@@ -48,6 +48,11 @@ struct private_imv_agent_t {
        TNC_MessageSubtype subtype;
 
        /**
+        * Maximum PA-TNC Message size
+        */
+       size_t max_msg_len;
+
+       /**
         * ID of IMV as assigned by TNCS
         */
        TNC_IMVID id;
@@ -471,13 +476,14 @@ METHOD(imv_agent_t, send_message, TNC_Result,
        private_imv_agent_t *this, TNC_ConnectionID connection_id, bool excl,
        TNC_UInt32 src_imv_id, TNC_UInt32 dst_imc_id, linked_list_t *attr_list)
 {
-       TNC_Result result = TNC_RESULT_FATAL;
        TNC_MessageType type;
        TNC_UInt32 msg_flags;
+       TNC_Result result = TNC_RESULT_FATAL;
        imv_state_t *state;
        pa_tnc_attr_t *attr;
        pa_tnc_msg_t *pa_tnc_msg;
        chunk_t msg;
+       enumerator_t *enumerator;
 
        state = find_connection(this, connection_id);
        if (!state)
@@ -487,36 +493,53 @@ METHOD(imv_agent_t, send_message, TNC_Result,
                return TNC_RESULT_FATAL;
        }
 
-       pa_tnc_msg = pa_tnc_msg_create();
-
-       while (attr_list->remove_first(attr_list, (void**)&attr) == SUCCESS)
+       pa_tnc_msg = pa_tnc_msg_create(this->max_msg_len);
+       while (attr_list->get_count(attr_list))
        {
-               pa_tnc_msg->add_attribute(pa_tnc_msg, attr);
-       }
-       pa_tnc_msg->build(pa_tnc_msg);
-       msg = pa_tnc_msg->get_encoding(pa_tnc_msg);
+               pa_tnc_msg = pa_tnc_msg_create(this->max_msg_len);
 
-       if (state->has_long(state) && this->send_message_long)
-       {
-               if (!src_imv_id)
+               enumerator = attr_list->create_enumerator(attr_list);
+               while (enumerator->enumerate(enumerator, &attr))
                {
-                       src_imv_id = this->id;
+                       if (!pa_tnc_msg->add_attribute(pa_tnc_msg, attr))
+                       {
+                               break;
+                       }
+                       attr_list->remove_at(attr_list, enumerator);
                }
-               msg_flags = excl ? TNC_MESSAGE_FLAGS_EXCLUSIVE : 0;
+               enumerator->destroy(enumerator);
 
-               result = this->send_message_long(src_imv_id, connection_id, msg_flags,
-                                                                                msg.ptr, msg.len, this->vendor_id,
-                                                                                this->subtype, dst_imc_id);
-       }
-       else if (this->send_message)
-       {
-               type = (this->vendor_id << 8) | this->subtype;
+               /* build and send the PA-TNC message via the IF-IMV interface */
+               pa_tnc_msg->build(pa_tnc_msg);
+               msg = pa_tnc_msg->get_encoding(pa_tnc_msg);
 
-               result = this->send_message(this->id, connection_id, msg.ptr, msg.len,
-                                                                       type);
-       }
-       pa_tnc_msg->destroy(pa_tnc_msg);
+               if (state->has_long(state) && this->send_message_long)
+               {
+                       if (!src_imv_id)
+                       {
+                               src_imv_id = this->id;
+                       }
+                       msg_flags = excl ? TNC_MESSAGE_FLAGS_EXCLUSIVE : 0;
+
+                       result = this->send_message_long(src_imv_id, connection_id,
+                                                               msg_flags, msg.ptr, msg.len, this->vendor_id,
+                                                               this->subtype, dst_imc_id);
+               }
+               else if (this->send_message)
+               {
+                       type = (this->vendor_id << 8) | this->subtype;
+
+                       result = this->send_message(this->id, connection_id, msg.ptr,
+                                                               msg.len, type);
+               }
+
+               pa_tnc_msg->destroy(pa_tnc_msg);
 
+               if (result != TNC_RESULT_SUCCESS)
+               {
+                       break;
+               }
+       }
        return result;
 }
 
@@ -585,7 +608,7 @@ METHOD(imv_agent_t, receive_message, TNC_Result,
                        break;
                case VERIFY_ERROR:
                        /* build error message */
-                       error_msg = pa_tnc_msg_create();
+                       error_msg = pa_tnc_msg_create(this->max_msg_len);
                        enumerator = pa_msg->create_error_enumerator(pa_msg);
                        while (enumerator->enumerate(enumerator, &error_attr))
                        {
@@ -791,6 +814,7 @@ imv_agent_t *imv_agent_create(const char *name,
                .name = name,
                .vendor_id = vendor_id,
                .subtype = subtype,
+               .max_msg_len = 65490,
                .id = id,
                .additional_ids = linked_list_create(),
                .connections = linked_list_create(),
index 5c1577a..0518251 100644 (file)
@@ -95,6 +95,10 @@ METHOD(pa_tnc_attr_t, set_noskip_flag,void,
 METHOD(pa_tnc_attr_t, build, void,
        private_ita_attr_command_t *this)
 {
+       if (this->value.ptr)
+       {
+               return;
+       }
        this->value = chunk_create(this->command, strlen(this->command));
        this->value = chunk_clone(this->value);
 }
index da9d235..16ffe65 100644 (file)
@@ -95,6 +95,10 @@ METHOD(pa_tnc_attr_t, set_noskip_flag,void,
 METHOD(pa_tnc_attr_t, build, void,
        private_ita_attr_dummy_t *this)
 {
+       if (this->value.ptr)
+       {
+               return;
+       }
        this->value = chunk_alloc(this->size);
        memset(this->value.ptr, 0xdd, this->value.len);
 }
index b5df0a5..4c44693 100644 (file)
@@ -90,6 +90,16 @@ struct private_pa_tnc_msg_t {
        u_int32_t identifier;
 
        /**
+        * Current PA-TNC Message size
+        */
+       size_t msg_len;
+
+       /**
+        * Maximum PA-TNC Message size
+        */
+       size_t max_msg_len;
+
+       /**
         * Encoded message
         */
        chunk_t encoding;
@@ -101,10 +111,25 @@ METHOD(pa_tnc_msg_t, get_encoding, chunk_t,
        return this->encoding;
 }
 
-METHOD(pa_tnc_msg_t, add_attribute, void,
+METHOD(pa_tnc_msg_t, add_attribute, bool,
        private_pa_tnc_msg_t *this, pa_tnc_attr_t *attr)
 {
+       chunk_t attr_value;
+       size_t attr_len;
+
+       attr->build(attr);
+       attr_value = attr->get_value(attr);
+       attr_len = PA_TNC_ATTR_HEADER_SIZE + attr_value.len;
+
+       if (this->msg_len + attr_len > this->max_msg_len)
+       {
+               /* attribute just does not fit into this message */
+               return FALSE;
+       }
+       this->msg_len += attr_len;
+
        this->attributes->insert_last(this->attributes, attr);
+       return TRUE;
 }
 
 METHOD(pa_tnc_msg_t, build, void,
@@ -127,16 +152,15 @@ METHOD(pa_tnc_msg_t, build, void,
        DBG2(DBG_TNC, "creating PA-TNC message with ID 0x%08x", this->identifier);
 
        /* build message header */
-       writer = bio_writer_create(PA_TNC_HEADER_SIZE);
+       writer = bio_writer_create(this->msg_len);
        writer->write_uint8 (writer, PA_TNC_VERSION);
        writer->write_uint24(writer, PA_TNC_RESERVED);
        writer->write_uint32(writer, this->identifier);
 
-       /* build and append encoding of PA-TNC attributes */
+       /* append encoded value of PA-TNC attributes */
        enumerator = this->attributes->create_enumerator(this->attributes);
        while (enumerator->enumerate(enumerator, &attr))
        {
-               attr->build(attr);
                vendor_id = attr->get_vendor_id(attr);
                type = attr->get_type(attr);
                value = attr->get_value(attr);
@@ -292,7 +316,7 @@ METHOD(pa_tnc_msg_t, process, status_t,
                                                offset + PA_TNC_ATTR_HEADER_SIZE + attr_offset);
                        goto err;
                }
-               add_attribute(this, attr);
+               this->attributes->insert_last(this->attributes, attr);
                offset += length;
        }
 
@@ -394,7 +418,7 @@ METHOD(pa_tnc_msg_t, destroy, void,
 /**
  * See header
  */
-pa_tnc_msg_t *pa_tnc_msg_create_from_data(chunk_t data)
+pa_tnc_msg_t *pa_tnc_msg_create(size_t max_msg_len)
 {
        private_pa_tnc_msg_t *this;
 
@@ -409,9 +433,10 @@ pa_tnc_msg_t *pa_tnc_msg_create_from_data(chunk_t data)
                        .create_error_enumerator = _create_error_enumerator,
                        .destroy = _destroy,
                },
-               .encoding = chunk_clone(data),
                .attributes = linked_list_create(),
                .errors = linked_list_create(),
+               .msg_len = PA_TNC_HEADER_SIZE,
+               .max_msg_len = max_msg_len,
        );
 
        return &this->public;
@@ -420,8 +445,26 @@ pa_tnc_msg_t *pa_tnc_msg_create_from_data(chunk_t data)
 /**
  * See header
  */
-pa_tnc_msg_t *pa_tnc_msg_create(void)
+pa_tnc_msg_t *pa_tnc_msg_create_from_data(chunk_t data)
 {
-       return pa_tnc_msg_create_from_data(chunk_empty);
+       private_pa_tnc_msg_t *this;
+
+       INIT(this,
+               .public = {
+                       .get_encoding = _get_encoding,
+                       .add_attribute = _add_attribute,
+                       .build = _build,
+                       .process = _process,
+                       .process_ietf_std_errors = _process_ietf_std_errors,
+                       .create_attribute_enumerator = _create_attribute_enumerator,
+                       .create_error_enumerator = _create_error_enumerator,
+                       .destroy = _destroy,
+               },
+               .encoding = chunk_clone(data),
+               .attributes = linked_list_create(),
+               .errors = linked_list_create(),
+       );
+
+       return &this->public;
 }
 
index c3ce829..4857947 100644 (file)
@@ -46,8 +46,9 @@ struct pa_tnc_msg_t {
         * Add a PA-TNC attribute
         *
         * @param attr                          PA-TNC attribute to be addedd
+        * @return                                      TRUE if attribute fit into message and was added
         */
-       void (*add_attribute)(pa_tnc_msg_t *this, pa_tnc_attr_t* attr);
+       bool (*add_attribute)(pa_tnc_msg_t *this, pa_tnc_attr_t* attr);
 
        /**
         * Build the PA-TNC message
@@ -91,7 +92,7 @@ struct pa_tnc_msg_t {
 /**
  * Create an empty PA-TNC message
  */
-pa_tnc_msg_t* pa_tnc_msg_create(void);
+pa_tnc_msg_t* pa_tnc_msg_create(size_t max_msg_len);
 
 /**
  * Create an unprocessed PA-TNC message from received data
index c2295e1..b26a926 100644 (file)
@@ -108,7 +108,7 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
        enumerator_t *enumerator;
        TNC_Result result;
        int rounds;
-       bool fatal_error, retry = FALSE;
+       bool fatal_error, received_command = FALSE, retry = FALSE;
 
        if (!imv_test)
        {
@@ -154,6 +154,7 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
                        ita_attr_command_t *ita_attr;
                        char *command;
        
+                       received_command = TRUE;
                        ita_attr = (ita_attr_command_t*)attr;
                        command = ita_attr->get_command(ita_attr);
 
@@ -228,7 +229,9 @@ static TNC_Result receive_message(TNC_IMVID imv_id,
                return result;
        }
 
-       return imv_test->provide_recommendation(imv_test, connection_id);
+       return received_command ?
+                               imv_test->provide_recommendation(imv_test, connection_id) :
+                               TNC_RESULT_SUCCESS;
 }
 
 /**
index 9be3794..e8f60ca 100644 (file)
@@ -117,6 +117,10 @@ METHOD(pa_tnc_attr_t, build, void,
        cred_encoding_type_t encoding_type = CERT_ASN1_DER;
        chunk_t aik_blob;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        if (this->aik->get_type(this->aik) == CERT_TRUSTED_PUBKEY)
        {
                flags |= PTS_AIK_FLAGS_NAKED_KEY;
index dce98e8..0494f58 100644 (file)
@@ -128,6 +128,10 @@ METHOD(pa_tnc_attr_t, build, void,
 {
        bio_writer_t *writer;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        writer = bio_writer_create(PTS_DH_NONCE_FINISH_SIZE);
        writer->write_uint8 (writer, PTS_DH_NONCE_FINISH_RESERVED);
        writer->write_uint8 (writer, this->initiator_nonce.len);
index 36266fe..9fb1c3d 100644 (file)
@@ -119,6 +119,10 @@ METHOD(pa_tnc_attr_t, build, void,
 {
        bio_writer_t *writer;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        writer = bio_writer_create(PTS_DH_NONCE_PARAMS_REQ_SIZE);
        writer->write_uint8 (writer, PTS_DH_NONCE_PARAMS_REQ_RESERVED);
        writer->write_uint8 (writer, this->min_nonce_len);
index 09bfa3a..8df7f7a 100644 (file)
@@ -135,6 +135,10 @@ METHOD(pa_tnc_attr_t, build, void,
 {
        bio_writer_t *writer;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        writer = bio_writer_create(PTS_DH_NONCE_PARAMS_RESP_SIZE);
        writer->write_uint24(writer, PTS_DH_NONCE_PARAMS_RESP_RESERVED);
        writer->write_uint8 (writer, this->responder_nonce.len);
index 737da65..eba3607 100644 (file)
@@ -135,6 +135,10 @@ METHOD(pa_tnc_attr_t, build, void,
        chunk_t measurement;
        bool first = TRUE;
        
+       if (this->value.ptr)
+       {
+               return;
+       }
        number_of_files = this->measurements->get_file_count(this->measurements);
        request_id = this->measurements->get_request_id(this->measurements);
 
index 054285c..303ae59 100644 (file)
@@ -110,6 +110,10 @@ METHOD(pa_tnc_attr_t, build, void,
 {
        bio_writer_t *writer;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        writer = bio_writer_create(PTS_GEN_ATTEST_EVID_SIZE);
        writer->write_uint32 (writer, PTS_GEN_ATTEST_EVID_RESERVED);
 
index 1875375..c279fa5 100644 (file)
@@ -107,6 +107,10 @@ METHOD(pa_tnc_attr_t, build, void,
 {
        bio_writer_t *writer;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        writer = bio_writer_create(PTS_GET_AIK_SIZE);
        writer->write_uint32 (writer, PTS_GET_AIK_RESERVED);
 
index cb6834c..8f2fb42 100644 (file)
@@ -110,6 +110,10 @@ METHOD(pa_tnc_attr_t, build, void,
 {
        bio_writer_t *writer;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        writer = bio_writer_create(PTS_GET_TPM_VER_INFO_SIZE);
        writer->write_uint32 (writer, PTS_GET_TPM_VER_INFO_RESERVED);
 
index ed520e3..16982de 100644 (file)
@@ -113,6 +113,10 @@ METHOD(pa_tnc_attr_t, build, void,
 {
        bio_writer_t *writer;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        writer = bio_writer_create(PTS_MEAS_ALGO_SIZE);
        writer->write_uint16(writer, PTS_MEAS_ALGO_RESERVED);
        writer->write_uint16(writer, this->algorithms);
index 055c750..8d75a7c 100644 (file)
@@ -113,6 +113,10 @@ METHOD(pa_tnc_attr_t, build, void,
 {
        bio_writer_t *writer;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        writer = bio_writer_create(PTS_PROTO_CAPS_SIZE);
        writer->write_uint16(writer, PTS_PROTO_CAPS_RESERVED);
        writer->write_uint16(writer, this->flags);
index 17781f7..823a61a 100644 (file)
@@ -136,6 +136,10 @@ METHOD(pa_tnc_attr_t, build, void,
        chunk_t pathname;
        bio_writer_t *writer;
        
+       if (this->value.ptr)
+       {
+               return;
+       }
        if (this->directory_flag)
        {
                flags |= DIRECTORY_CONTENTS_FLAG;
index bef6b5d..847e468 100644 (file)
@@ -129,6 +129,10 @@ METHOD(pa_tnc_attr_t, build, void,
        chunk_t pathname;
        bio_writer_t *writer;
        
+       if (this->value.ptr)
+       {
+               return;
+       }
        if (this->directory_flag)
        {
                flags |= DIRECTORY_CONTENTS_FLAG;
index bfd108b..978bf10 100644 (file)
@@ -177,6 +177,10 @@ METHOD(pa_tnc_attr_t, build, void,
        enumerator_t *enumerator;
        entry_t *entry;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        writer = bio_writer_create(PTS_REQ_FUNC_COMP_EVID_SIZE);
 
        enumerator = this->list->create_enumerator(this->list);
index d2c197a..1e1f041 100644 (file)
@@ -195,6 +195,11 @@ METHOD(pa_tnc_attr_t, build, void,
        time_t measurement_time;
        chunk_t measurement, utc_time, pcr_before, pcr_after, policy_uri;
        
+       if (this->value.ptr)
+       {
+               return;
+       }
+
        /* Extract parameters from comp_evidence_t object */
        name         = this->evidence->get_comp_func_name(this->evidence,
                                                        &depth);
index 27720d5..f29dbf5 100644 (file)
@@ -169,6 +169,10 @@ METHOD(pa_tnc_attr_t, build, void,
        bio_writer_t *writer;
        u_int8_t flags;
        
+       if (this->value.ptr)
+       {
+               return;
+       }
        flags = this->flags & PTS_SIMPLE_EVID_FINAL_FLAG_MASK;
 
        if (this->has_evid_sig)
index 944a12c..ab08bc9 100644 (file)
@@ -114,6 +114,10 @@ METHOD(pa_tnc_attr_t, build, void,
 {
        bio_writer_t *writer;
 
+       if (this->value.ptr)
+       {
+               return;
+       }
        writer = bio_writer_create(PTS_TPM_VER_INFO_SIZE);
        writer->write_data(writer, this->tpm_version_info);
 
index a9f4a11..d1b1bce 100644 (file)
@@ -148,6 +148,10 @@ METHOD(pa_tnc_attr_t, build, void,
        pts_file_metadata_t *entry;
        u_int64_t number_of_files;
        
+       if (this->value.ptr)
+       {
+               return;
+       }
        number_of_files = this->metadata->get_file_count(this->metadata);
        writer = bio_writer_create(PTS_FILE_META_SIZE);