From 394754e9b281f6451a4eac351ce9c84912167a0d Mon Sep 17 00:00:00 2001 From: Szczepan Zalega Date: Mon, 8 Aug 2016 14:36:44 +0200 Subject: Clearing whole response packet instead of only payload part #20 Signed-off-by: Szczepan Zalega --- include/device_proto.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/include/device_proto.h b/include/device_proto.h index f0d26c0..40b2a22 100644 --- a/include/device_proto.h +++ b/include/device_proto.h @@ -133,22 +133,22 @@ struct EmptyPayload { std::string dissect() const { return std::string("Empty Payload."); } } __packed; -template +template class ClearingProxy{ public: - ClearingProxy(command_payload &p){ - payload = p; + ClearingProxy(command_packet &p){ + packet = p; bzero(&p, sizeof(p)); } ~ClearingProxy(){ - bzero(&payload, sizeof(payload)); + bzero(&packet, sizeof(packet)); } - command_payload & data(){ - return payload; + response_payload & data(){ + return packet.payload; } - command_payload payload; + command_packet packet; }; template @@ -185,7 +185,7 @@ class Transaction : semantics::non_constructible { } - static ClearingProxy run(device::Device &dev, + static ClearingProxy run(device::Device &dev, const command_payload &payload) { using namespace ::nitrokey::device; using namespace ::nitrokey::log; @@ -249,10 +249,10 @@ class Transaction : semantics::non_constructible { // See: DeviceResponse - return resp.payload; + return resp; } - static ClearingProxy run(device::Device &dev) { + static ClearingProxy run(device::Device &dev) { command_payload empty_payload; return run(dev, empty_payload); } -- cgit v1.2.3