summaryrefslogtreecommitdiff
path: root/lib/libutil/bcrypt_pbkdf.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-08 00:30:08 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-01-08 00:30:08 +0000
commit200b730369f4e91a32d265c7ea83f53084bb0a74 (patch)
treefe14c30cbeb4780e75fa743f1748c13348a96779 /lib/libutil/bcrypt_pbkdf.c
parent03f5568dd7b80cb82e0f0380c49c5eb40f27c15b (diff)
declare a local version of MIN(), call it MINIMUM()
Diffstat (limited to 'lib/libutil/bcrypt_pbkdf.c')
-rw-r--r--lib/libutil/bcrypt_pbkdf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libutil/bcrypt_pbkdf.c b/lib/libutil/bcrypt_pbkdf.c
index 106f7eb73f0..3fdeaff9914 100644
--- a/lib/libutil/bcrypt_pbkdf.c
+++ b/lib/libutil/bcrypt_pbkdf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcrypt_pbkdf.c,v 1.11 2015/01/07 21:34:23 deraadt Exp $ */
+/* $OpenBSD: bcrypt_pbkdf.c,v 1.12 2015/01/08 00:30:07 deraadt Exp $ */
/*
* Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
*
@@ -24,6 +24,8 @@
#include <string.h>
#include <util.h>
+#define MINIMUM(a,b) (((a) < (b)) ? (a) : (b))
+
/*
* pkcs #5 pbkdf2 implementation using the "bcrypt" hash
*
@@ -149,7 +151,7 @@ bcrypt_pbkdf(const char *pass, size_t passlen, const uint8_t *salt, size_t saltl
/*
* pbkdf2 deviation: output the key material non-linearly.
*/
- amt = MIN(amt, keylen);
+ amt = MINIMUM(amt, keylen);
for (i = 0; i < amt; i++) {
size_t dest = i * stride + (count - 1);
if (dest >= origkeylen)