Ticket #7419: tor_explicit_bzero.diff

File tor_explicit_bzero.diff, 884 bytes (added by logan, 4 years ago)
  • configure.ac

    diff --git a/configure.ac b/configure.ac
    index a47cee6..49c3ebb 100644
    a b AC_CHECK_FUNCS( 
    381381        backtrace_symbols_fd \
    382382        clock_gettime \
    383383        eventfd \
     384        explicit_bzero \
    384385        timingsafe_memcmp \
    385386        flock \
    386387        ftime \
  • src/common/crypto.c

    diff --git a/src/common/crypto.c b/src/common/crypto.c
    index bcb06e0..ffeebb2 100644
    a b memwipe(void *mem, uint8_t byte, size_t sz) 
    29702970   * ...or maybe not.  In practice, there are pure-asm implementations of
    29712971   * OPENSSL_cleanse() on most platforms, which ought to do the job.
    29722972   **/
     2973
     2974#ifdef HAVE_EXPLICIT_BZERO
     2975  explicit_bzero(mem, sz);
     2976#else
    29732977  OPENSSL_cleanse(mem, sz);
     2978#endif
    29742979  /* Just in case some caller of memwipe() is relying on getting a buffer
    29752980   * filled with a particular value, fill the buffer.
    29762981   *