diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-10-02 09:08:31 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-10-02 09:08:31 -0700 |
commit | e8c5495b61ebde115ee133e8c85933191bd0cd61 (patch) | |
tree | e8f80f74b77bb1dc83b0fd5fd0d86ebc72c9cd86 /node/Utils.cpp | |
parent | 28646eee0a81a5555fbfa504b66a5b11be4f3fb7 (diff) | |
download | infinitytier-e8c5495b61ebde115ee133e8c85933191bd0cd61.tar.gz infinitytier-e8c5495b61ebde115ee133e8c85933191bd0cd61.zip |
Yes, zero my secret key data. Yes I really, really mean it.
Diffstat (limited to 'node/Utils.cpp')
-rw-r--r-- | node/Utils.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/node/Utils.cpp b/node/Utils.cpp index 80406c3f..f0a03f2c 100644 --- a/node/Utils.cpp +++ b/node/Utils.cpp @@ -78,6 +78,22 @@ bool Utils::redirectUnixOutputs(const char *stdoutPath,const char *stderrPath) } #endif // __UNIX_LIKE__ +static void _Utils_doBurn(char *ptr,unsigned int len) +{ + for(unsigned int i=0;i<len;++i) + ptr[i] = (char)0; +} +void (*volatile _Utils_doBurn_ptr)(char *,unsigned int) = _Utils_doBurn; +void Utils::burn(void *ptr,unsigned int len) + throw() +{ + // Ridiculous hack: call _doBurn() via a volatile function pointer to + // hold down compiler optimizers and beat them mercilessly until they + // cry and mumble something about never eliding secure memory zeroing + // again. + (_Utils_doBurn_ptr)((char *)ptr,len); +} + std::map<std::string,bool> Utils::listDirectory(const char *path) { std::map<std::string,bool> r; |