instead of cloning use extract_buf() method
authorAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 4 Mar 2013 22:21:21 +0000 (23:21 +0100)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 4 Mar 2013 22:21:21 +0000 (23:21 +0100)
34 files changed:
src/libcharon/plugins/tnccs_20/batch/pb_tnc_batch.c
src/libimcv/ietf/ietf_attr_assess_result.c
src/libimcv/ietf/ietf_attr_attr_request.c
src/libimcv/ietf/ietf_attr_default_pwd_enabled.c
src/libimcv/ietf/ietf_attr_fwd_enabled.c
src/libimcv/ietf/ietf_attr_installed_packages.c
src/libimcv/ietf/ietf_attr_numeric_version.c
src/libimcv/ietf/ietf_attr_op_status.c
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/ietf/ietf_attr_remediation_instr.c
src/libimcv/ietf/ietf_attr_string_version.c
src/libimcv/ita/ita_attr_get_settings.c
src/libimcv/ita/ita_attr_settings.c
src/libimcv/pa_tnc/pa_tnc_msg.c
src/libpts/pts/pts.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 b1f6d1e..d87e0cc 100644 (file)
@@ -201,7 +201,7 @@ METHOD(pb_tnc_batch_t, build, void,
        }
        enumerator->destroy(enumerator);
 
-       this->encoding = chunk_clone(writer->get_buf(writer));
+       this->encoding = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 1c0d6b0..55226e3 100644 (file)
@@ -106,7 +106,7 @@ METHOD(pa_tnc_attr_t, build, void,
 
        writer = bio_writer_create(ASSESS_RESULT_SIZE);
        writer->write_uint32(writer, this->result);
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index c93c927..5dc4870 100644 (file)
@@ -125,7 +125,7 @@ METHOD(pa_tnc_attr_t, build, void,
        }
        enumerator->destroy(enumerator);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 2022f45..2c6b3d5 100644 (file)
@@ -106,7 +106,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer = bio_writer_create(DEFAULT_PWD_ENABLED_SIZE);
        writer->write_uint32(writer, this->status);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 911ee5b..a906b22 100644 (file)
@@ -106,7 +106,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer = bio_writer_create(FORWARDING_ENABLED_SIZE);
        writer->write_uint32(writer, this->fwd_status);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 72a3c13..462805e 100644 (file)
@@ -144,7 +144,7 @@ METHOD(pa_tnc_attr_t, build, void,
        }
        enumerator->destroy(enumerator);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 7972054..7392564 100644 (file)
@@ -137,7 +137,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer->write_uint16(writer, this->service_pack_major);
        writer->write_uint16(writer, this->service_pack_minor);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index d9610b2..2353068 100644 (file)
@@ -153,7 +153,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer->write_uint16(writer, 0x0000);
        writer->write_data  (writer, chunk_create(last_use, 20));
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index cc3ec28..5f20f89 100644 (file)
@@ -206,7 +206,7 @@ METHOD(pa_tnc_attr_t, build, void,
                                break;
                }
        }
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 8b8da3a..1d516a5 100644 (file)
@@ -130,7 +130,7 @@ METHOD(pa_tnc_attr_t, build, void,
        }
        enumerator->destroy(enumerator);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 115f001..a107c27 100644 (file)
@@ -119,7 +119,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer->write_uint16(writer, this->product_id);
        writer->write_data  (writer, this->product_name);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index d28631e..5d85e5d 100644 (file)
@@ -154,7 +154,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer->write_uint32(writer, this->parameters_type.type);
        writer->write_data  (writer, this->parameters);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 8f4129e..68adde6 100644 (file)
@@ -123,7 +123,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer->write_data8(writer, this->build);
        writer->write_data8(writer, this->config);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 8016b76..0695af3 100644 (file)
@@ -128,7 +128,7 @@ METHOD(pa_tnc_attr_t, build, void,
        }
        enumerator->destroy(enumerator);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 7941cf6..9ce253d 100644 (file)
@@ -157,7 +157,7 @@ METHOD(pa_tnc_attr_t, build, void,
        }
        enumerator->destroy(enumerator);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index d3aceee..140463b 100644 (file)
@@ -194,7 +194,7 @@ METHOD(pa_tnc_msg_t, build, bool,
        enumerator->destroy(enumerator);
 
        free(this->encoding.ptr);
-       this->encoding = chunk_clone(writer->get_buf(writer));
+       this->encoding = writer->extract_buf(writer);
        writer->destroy(writer);
 
        return TRUE;
index 84a9961..f646d67 100644 (file)
@@ -1043,7 +1043,7 @@ METHOD(pts_t, get_quote_info, bool,
        }
 
        /* TPM Quote Info */
-       *out_quote_info = chunk_clone(writer->get_buf(writer));
+       *out_quote_info = writer->extract_buf(writer);
        DBG3(DBG_PTS, "constructed TPM Quote Info: %B", out_quote_info);
 
        writer->destroy(writer);
index d5bbdc9..17a8db5 100644 (file)
@@ -123,9 +123,9 @@ METHOD(pa_tnc_attr_t, build, void,
        writer = bio_writer_create(PTS_AIK_SIZE);
        writer->write_uint8(writer, flags);
        writer->write_data (writer, aik_blob);
-       this->value = chunk_clone(writer->get_buf(writer));
-       free(aik_blob.ptr);
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
+       free(aik_blob.ptr);
 }
 
 METHOD(pa_tnc_attr_t, process, status_t,
index 4d72812..6119b49 100644 (file)
@@ -128,7 +128,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer->write_data  (writer, this->initiator_value);
        writer->write_data  (writer, this->initiator_nonce);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 7796dba..7761b97 100644 (file)
@@ -117,7 +117,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer->write_uint8 (writer, this->min_nonce_len);
        writer->write_uint16(writer, this->dh_groups);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 1e82e70..eb0d0e5 100644 (file)
@@ -136,7 +136,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer->write_data  (writer, this->responder_nonce);
        writer->write_data  (writer, this->responder_value);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 1daac70..b9095f5 100644 (file)
@@ -154,7 +154,7 @@ METHOD(pa_tnc_attr_t, build, void,
                writer->write_uint16(writer, 0);
        }
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 9103e06..f263747 100644 (file)
@@ -106,7 +106,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer = bio_writer_create(PTS_GEN_ATTEST_EVID_SIZE);
        writer->write_uint32 (writer, PTS_GEN_ATTEST_EVID_RESERVED);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 6f35f54..cf944d2 100644 (file)
@@ -103,7 +103,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer = bio_writer_create(PTS_GET_AIK_SIZE);
        writer->write_uint32 (writer, PTS_GET_AIK_RESERVED);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 4dd64e3..647c426 100644 (file)
@@ -106,7 +106,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer = bio_writer_create(PTS_GET_TPM_VER_INFO_SIZE);
        writer->write_uint32 (writer, PTS_GET_TPM_VER_INFO_RESERVED);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index abef45b..a4dac90 100644 (file)
@@ -109,7 +109,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer = bio_writer_create(PTS_MEAS_ALGO_SIZE);
        writer->write_uint16(writer, PTS_MEAS_ALGO_RESERVED);
        writer->write_uint16(writer, this->algorithms);
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 3608832..6473ea8 100644 (file)
@@ -110,7 +110,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer->write_uint16(writer, PTS_PROTO_CAPS_RESERVED);
        writer->write_uint16(writer, this->flags);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 8b4bfe5..f0bc7cf 100644 (file)
@@ -143,7 +143,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer->write_uint16(writer, this->request_id);
        writer->write_uint32(writer, this->delimiter);
        writer->write_data  (writer, pathname);
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index ff55814..e475cd3 100644 (file)
@@ -136,7 +136,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer->write_uint16(writer, PTS_REQ_FILE_META_RESERVED);
 
        writer->write_data  (writer, pathname);
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 8bb43ae..5249fa2 100644 (file)
@@ -183,7 +183,7 @@ METHOD(pa_tnc_attr_t, build, void,
        }
        enumerator->destroy(enumerator);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index c659443..40f380a 100644 (file)
@@ -242,7 +242,7 @@ METHOD(pa_tnc_attr_t, build, void,
 
        writer->write_data(writer, measurement);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 8c76651..baadd94 100644 (file)
@@ -194,7 +194,7 @@ METHOD(pa_tnc_attr_t, build, void,
                writer->write_data (writer, this->evid_sig);
        }
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 5143e16..b776cb6 100644 (file)
@@ -110,7 +110,7 @@ METHOD(pa_tnc_attr_t, build, void,
        writer = bio_writer_create(PTS_TPM_VER_INFO_SIZE);
        writer->write_data(writer, this->tpm_version_info);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }
 
index 56686d8..f96371b 100644 (file)
@@ -166,7 +166,7 @@ METHOD(pa_tnc_attr_t, build, void,
        }
        enumerator->destroy(enumerator);
 
-       this->value = chunk_clone(writer->get_buf(writer));
+       this->value = writer->extract_buf(writer);
        writer->destroy(writer);
 }