diff options
-rw-r--r-- | src/utils/debug.cpp | 35 | ||||
-rw-r--r-- | src/utils/debug.h | 29 | ||||
-rw-r--r-- | src/utils/info.txt | 1 |
3 files changed, 65 insertions, 0 deletions
diff --git a/src/utils/debug.cpp b/src/utils/debug.cpp new file mode 100644 index 000000000..6ba1924ee --- /dev/null +++ b/src/utils/debug.cpp @@ -0,0 +1,35 @@ +/** +* Internal-use debugging functions for Botan +* (C) 2009 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#include <botan/internal/debug.h> +#include <cstdio> + +namespace Botan { + +namespace Debug { + +void print_vec(const std::string& name, + const byte array[], + size_t array_len) + { + std::printf("%s = ", name.c_str()); + for(size_t i = 0; i != array_len; ++i) + std::printf("%02X", array[i]); + std::printf("\n"); + } + +void print_vec(const std::string& name, + const MemoryRegion<byte>& vec) + { + print_vec(name, &vec[0], vec.size()); + } + +} + +} + +#endif diff --git a/src/utils/debug.h b/src/utils/debug.h new file mode 100644 index 000000000..ee93d5ea0 --- /dev/null +++ b/src/utils/debug.h @@ -0,0 +1,29 @@ +/** +* Internal-use debugging functions for Botan +* (C) 2009 Jack Lloyd +* +* Distributed under the terms of the Botan license +*/ + +#ifndef BOTAN_DEBUG_H__ +#define BOTAN_DEBUG_H__ + +#include <botan/secmem.h> + +namespace Botan { + +namespace Debug { + +void print_vec(const std::string& name, + const byte array[], + size_t array_len); + +void print_vec(const std::string& name, + const MemoryRegion<byte>& vec); + + +} + +} + +#endif diff --git a/src/utils/info.txt b/src/utils/info.txt index 93ece2e78..c71e2af84 100644 --- a/src/utils/info.txt +++ b/src/utils/info.txt @@ -15,6 +15,7 @@ version.cpp <header:internal> bit_ops.h +debug.h mlock.h prefetch.h rounding.h |