diff options
author | kettenis <> | 2014-07-16 14:26:47 +0000 |
---|---|---|
committer | kettenis <> | 2014-07-16 14:26:47 +0000 |
commit | 8facaecdb2eae4335d0820015add5b7dc8bcb069 (patch) | |
tree | 900209ebd39f6216e320317aee06b19e4b1d016d /src | |
parent | d84a1e27564a0d13e29f3604bed61eac16d66068 (diff) | |
download | openbsd-8facaecdb2eae4335d0820015add5b7dc8bcb069.tar.gz openbsd-8facaecdb2eae4335d0820015add5b7dc8bcb069.tar.bz2 openbsd-8facaecdb2eae4335d0820015add5b7dc8bcb069.zip |
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@
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/arc4random/getentropy_linux.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/crypto/getentropy_linux.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/libcrypto/arc4random/getentropy_linux.c b/src/lib/libcrypto/arc4random/getentropy_linux.c index 40ea8a14ad..d5d36da1c5 100644 --- a/src/lib/libcrypto/arc4random/getentropy_linux.c +++ b/src/lib/libcrypto/arc4random/getentropy_linux.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: getentropy_linux.c,v 1.24 2014/07/13 13:37:38 deraadt Exp $ */ | 1 | /* $OpenBSD: getentropy_linux.c,v 1.25 2014/07/16 14:26:47 kettenis Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> | 4 | * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> |
@@ -486,6 +486,7 @@ getentropy_fallback(void *buf, size_t len) | |||
486 | 486 | ||
487 | HD(cnt); | 487 | HD(cnt); |
488 | } | 488 | } |
489 | #ifdef HAVE_GETAUXVAL | ||
489 | #ifdef AT_RANDOM | 490 | #ifdef AT_RANDOM |
490 | /* Not as random as you think but we take what we are given */ | 491 | /* Not as random as you think but we take what we are given */ |
491 | p = (char *) getauxval(AT_RANDOM); | 492 | p = (char *) getauxval(AT_RANDOM); |
@@ -502,6 +503,7 @@ getentropy_fallback(void *buf, size_t len) | |||
502 | if (p) | 503 | if (p) |
503 | HD(p); | 504 | HD(p); |
504 | #endif | 505 | #endif |
506 | #endif | ||
505 | 507 | ||
506 | SHA512_Final(results, &ctx); | 508 | SHA512_Final(results, &ctx); |
507 | memcpy((char *)buf + i, results, min(sizeof(results), len - i)); | 509 | memcpy((char *)buf + i, results, min(sizeof(results), len - i)); |
diff --git a/src/lib/libcrypto/crypto/getentropy_linux.c b/src/lib/libcrypto/crypto/getentropy_linux.c index 40ea8a14ad..d5d36da1c5 100644 --- a/src/lib/libcrypto/crypto/getentropy_linux.c +++ b/src/lib/libcrypto/crypto/getentropy_linux.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: getentropy_linux.c,v 1.24 2014/07/13 13:37:38 deraadt Exp $ */ | 1 | /* $OpenBSD: getentropy_linux.c,v 1.25 2014/07/16 14:26:47 kettenis Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> | 4 | * Copyright (c) 2014 Theo de Raadt <deraadt@openbsd.org> |
@@ -486,6 +486,7 @@ getentropy_fallback(void *buf, size_t len) | |||
486 | 486 | ||
487 | HD(cnt); | 487 | HD(cnt); |
488 | } | 488 | } |
489 | #ifdef HAVE_GETAUXVAL | ||
489 | #ifdef AT_RANDOM | 490 | #ifdef AT_RANDOM |
490 | /* Not as random as you think but we take what we are given */ | 491 | /* Not as random as you think but we take what we are given */ |
491 | p = (char *) getauxval(AT_RANDOM); | 492 | p = (char *) getauxval(AT_RANDOM); |
@@ -502,6 +503,7 @@ getentropy_fallback(void *buf, size_t len) | |||
502 | if (p) | 503 | if (p) |
503 | HD(p); | 504 | HD(p); |
504 | #endif | 505 | #endif |
506 | #endif | ||
505 | 507 | ||
506 | SHA512_Final(results, &ctx); | 508 | SHA512_Final(results, &ctx); |
507 | memcpy((char *)buf + i, results, min(sizeof(results), len - i)); | 509 | memcpy((char *)buf + i, results, min(sizeof(results), len - i)); |