summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/arc4random/getentropy_osx.c
diff options
context:
space:
mode:
authorderaadt <>2020-05-17 14:44:20 +0000
committerderaadt <>2020-05-17 14:44:20 +0000
commit032a35a73bdeb0ea0007bfc5219e6c96db991681 (patch)
treef1c45f2a3256214176ebde26c9d04964fae745f8 /src/lib/libcrypto/arc4random/getentropy_osx.c
parentce127c177d706b882344b219271b26080aea2efe (diff)
downloadopenbsd-032a35a73bdeb0ea0007bfc5219e6c96db991681.tar.gz
openbsd-032a35a73bdeb0ea0007bfc5219e6c96db991681.tar.bz2
openbsd-032a35a73bdeb0ea0007bfc5219e6c96db991681.zip
As done everywhere else, use a local version of MINIMUM() and avoid
conflict against a potential define min() from some other scope.
Diffstat (limited to 'src/lib/libcrypto/arc4random/getentropy_osx.c')
-rw-r--r--src/lib/libcrypto/arc4random/getentropy_osx.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/arc4random/getentropy_osx.c b/src/lib/libcrypto/arc4random/getentropy_osx.c
index 26dcc824de..5d4067bb8e 100644
--- a/src/lib/libcrypto/arc4random/getentropy_osx.c
+++ b/src/lib/libcrypto/arc4random/getentropy_osx.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: getentropy_osx.c,v 1.12 2018/11/20 08:04:28 deraadt Exp $ */ 1/* $OpenBSD: getentropy_osx.c,v 1.13 2020/05/17 14:44:20 deraadt 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>
@@ -66,7 +66,7 @@
66#define SHA512_DIGEST_LENGTH CC_SHA512_DIGEST_LENGTH 66#define SHA512_DIGEST_LENGTH CC_SHA512_DIGEST_LENGTH
67 67
68#define REPEAT 5 68#define REPEAT 5
69#define min(a, b) (((a) < (b)) ? (a) : (b)) 69#define MINIMUM(a, b) (((a) < (b)) ? (a) : (b))
70 70
71#define HX(a, b) \ 71#define HX(a, b) \
72 do { \ 72 do { \
@@ -407,8 +407,8 @@ getentropy_fallback(void *buf, size_t len)
407 } 407 }
408 408
409 SHA512_Final(results, &ctx); 409 SHA512_Final(results, &ctx);
410 memcpy((char *)buf + i, results, min(sizeof(results), len - i)); 410 memcpy((char *)buf + i, results, MINIMUM(sizeof(results), len - i));
411 i += min(sizeof(results), len - i); 411 i += MINIMUM(sizeof(results), len - i);
412 } 412 }
413 explicit_bzero(&ctx, sizeof ctx); 413 explicit_bzero(&ctx, sizeof ctx);
414 explicit_bzero(results, sizeof results); 414 explicit_bzero(results, sizeof results);