summaryrefslogtreecommitdiff
path: root/include/device_proto.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/device_proto.h')
-rw-r--r--include/device_proto.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/device_proto.h b/include/device_proto.h
index 78abe38..f28b5b9 100644
--- a/include/device_proto.h
+++ b/include/device_proto.h
@@ -161,7 +161,13 @@ class Transaction : semantics::non_constructible {
return outp.crc;
}
- static response_payload run(device::Device &dev,
+ template <typename T>
+ static void clear_packet(T &st){
+ bzero(&st, sizeof(st));
+ }
+
+
+ static response_payload run(device::Device &dev,
const command_payload &payload) {
using namespace ::nitrokey::device;
using namespace ::nitrokey::log;
@@ -208,6 +214,8 @@ class Transaction : semantics::non_constructible {
std::this_thread::sleep_for(dev.get_retry_timeout());
continue;
}
+ clear_packet(outp);
+
if (status <= 0)
throw std::runtime_error(
std::string("Device error while executing command ") +