1 /* Copyright (c) 2001, Matej Pfajfar.
2 * Copyright (c) 2001-2004, Roger Dingledine.
3 * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
4 * Copyright (c) 2007-2021, The Tor Project, Inc. */
5 /* See LICENSE for licensing information */
10 * \brief Common functions for cryptographic routines.
13 #ifndef TOR_CRYPTO_UTIL_H
14 #define TOR_CRYPTO_UTIL_H
16 #include "lib/cc/torint.h"
17 #include "lib/malloc/malloc.h"
19 /** OpenSSL-based utility functions. */
20 void memwipe(void *mem
, uint8_t byte
, size_t sz
);
22 void tor_str_wipe_and_free_(char *str
);
24 * Securely all memory in <b>str</b>, then free it.
26 * As tor_free(), tolerates null pointers, and sets <b>str</b> to NULL.
28 #define tor_str_wipe_and_free(str) \
29 FREE_AND_NULL(char, tor_str_wipe_and_free_, (str))
31 #endif /* !defined(TOR_CRYPTO_UTIL_H) */