summaryrefslogtreecommitdiff
path: root/include/command.h
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-05-13 15:54:00 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-05-13 15:54:00 +0200
commit06c0deb7935a9390a67bc02d6c323e64c785a026 (patch)
treec8343c0e1d504b2ae7d1ff5a727084f78a015f7e /include/command.h
parentbe0d677aa2e7eb87a309dc3927c0917380892641 (diff)
parent3b5f40a19ca6c6fde55fcdab4ff0a9f91a46a051 (diff)
downloadlibnitrokey-06c0deb7935a9390a67bc02d6c323e64c785a026.tar.gz
libnitrokey-06c0deb7935a9390a67bc02d6c323e64c785a026.tar.bz2
Merge branch 'do_not_log_volatile_data'
Diffstat (limited to 'include/command.h')
-rw-r--r--include/command.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/include/command.h b/include/command.h
index fc374f7..3f711c0 100644
--- a/include/command.h
+++ b/include/command.h
@@ -4,6 +4,15 @@
#include "command_id.h"
#include "cxx_semantics.h"
+#define print_to_ss(x) ( ss << " " << (#x) <<":\t" << (x) << std::endl );
+#ifdef LOG_VOLATILE_DATA
+#define print_to_ss_volatile(x) print_to_ss(x);
+#else
+#define print_to_ss_volatile(x) ( ss << " " << (#x) <<":\t" << "***********" << std::endl );
+#endif
+#define hexdump_to_ss(x) (ss << #x":\n"\
+ << ::nitrokey::misc::hexdump((const char *) (&x), sizeof x, false));
+
namespace nitrokey {
namespace proto {
@@ -18,7 +27,6 @@ namespace nitrokey {
}
};
-#define print_to_ss(x) ( ss << " " << (#x) <<":\t" << (x) << std::endl );
namespace stick20{
enum class PasswordKind : uint8_t {
User = 'P',
@@ -37,7 +45,7 @@ namespace stick20{
std::string dissect() const {
std::stringstream ss;
print_to_ss( kind );
- print_to_ss(password);
+ print_to_ss_volatile(password);
return ss.str();
}
void set_kind_admin() {
@@ -79,6 +87,5 @@ namespace stick20{
}
}
}
-#undef print_to_ss
#endif