This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 2/5] Add explicit_bzero()


On Mar 18 11:49, Sebastian Huber wrote:
> This function is used by LibreSSL and OpenSSH and is provided by the
> OpenBSD libc.
> [...]
> +#include <string.h>
> +
> +/*
> + * explicit_bzero - don't let the compiler optimize away bzero
> + */
> +void
> +explicit_bzero(void *p, size_t n)
> +{
> +	bzero(p, n);
> +}

The OpenSSH version looks a bit different:

  /*
   * Indirect bzero through a volatile pointer to hopefully avoid
   * dead-store optimisation eliminating the call.
   */
  static void (* volatile ssh_bzero)(void *, size_t) = bzero;

  void
  explicit_bzero(void *p, size_t n)
  {
	  ssh_bzero(p, n);
  }

Is that something we should do, too, or is that paranoia at its
finest only?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]