tor

The Tor anonymity network
git clone https://git.dasho.dev/tor.git
Log | Files | Refs | README | LICENSE

crypto_util.h (867B)


      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 */
      6 
      7 /**
      8 * \file crypto_util.h
      9 *
     10 * \brief Common functions for cryptographic routines.
     11 **/
     12 
     13 #ifndef TOR_CRYPTO_UTIL_H
     14 #define TOR_CRYPTO_UTIL_H
     15 
     16 #include "lib/cc/torint.h"
     17 #include "lib/malloc/malloc.h"
     18 
     19 /** OpenSSL-based utility functions. */
     20 void memwipe(void *mem, uint8_t byte, size_t sz);
     21 
     22 void tor_str_wipe_and_free_(char *str);
     23 /**
     24 * Securely all memory in <b>str</b>, then free it.
     25 *
     26 * As tor_free(), tolerates null pointers, and sets <b>str</b> to NULL.
     27 **/
     28 #define tor_str_wipe_and_free(str)                      \
     29  FREE_AND_NULL(char, tor_str_wipe_and_free_, (str))
     30 
     31 #endif /* !defined(TOR_CRYPTO_UTIL_H) */