Browse Source

Only call getauxval(3) if HAVE_GETAUXVAL is defined. Fixes build on older

Linux (such as Ubuntu 12.04LTS) that don't have it yet.  Seems the AT_XXX
defines are pulled in by <link.h> now.
ok beck@
OPENBSD_5_6
kettenis 10 years ago
parent
commit
2c152452b6
2 changed files with 6 additions and 2 deletions
  1. +3
    -1
      src/lib/libcrypto/arc4random/getentropy_linux.c
  2. +3
    -1
      src/lib/libcrypto/crypto/getentropy_linux.c

+ 3
- 1
src/lib/libcrypto/arc4random/getentropy_linux.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_linux.c,v 1.24 2014/07/13 13:37:38 deraadt Exp $ */
/* $OpenBSD: getentropy_linux.c,v 1.25 2014/07/16 14:26:47 kettenis Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -486,6 +486,7 @@ getentropy_fallback(void *buf, size_t len)
HD(cnt); HD(cnt);
} }
#ifdef HAVE_GETAUXVAL
#ifdef AT_RANDOM #ifdef AT_RANDOM
/* Not as random as you think but we take what we are given */ /* Not as random as you think but we take what we are given */
p = (char *) getauxval(AT_RANDOM); p = (char *) getauxval(AT_RANDOM);
@ -501,6 +502,7 @@ getentropy_fallback(void *buf, size_t len)
p = (char *) getauxval(AT_BASE); p = (char *) getauxval(AT_BASE);
if (p) if (p)
HD(p); HD(p);
#endif
#endif #endif
SHA512_Final(results, &ctx); SHA512_Final(results, &ctx);


+ 3
- 1
src/lib/libcrypto/crypto/getentropy_linux.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: getentropy_linux.c,v 1.24 2014/07/13 13:37:38 deraadt Exp $ */
/* $OpenBSD: getentropy_linux.c,v 1.25 2014/07/16 14:26:47 kettenis Exp $ */
/* /*
* Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org>
@ -486,6 +486,7 @@ getentropy_fallback(void *buf, size_t len)
HD(cnt); HD(cnt);
} }
#ifdef HAVE_GETAUXVAL
#ifdef AT_RANDOM #ifdef AT_RANDOM
/* Not as random as you think but we take what we are given */ /* Not as random as you think but we take what we are given */
p = (char *) getauxval(AT_RANDOM); p = (char *) getauxval(AT_RANDOM);
@ -501,6 +502,7 @@ getentropy_fallback(void *buf, size_t len)
p = (char *) getauxval(AT_BASE); p = (char *) getauxval(AT_BASE);
if (p) if (p)
HD(p); HD(p);
#endif
#endif #endif
SHA512_Final(results, &ctx); SHA512_Final(results, &ctx);


Loading…
Cancel
Save