summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2020-08-02 18:35:49 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2020-08-02 18:35:49 +0000
commit606c42fab66b9737263f5c7b7eac438d6e8d397c (patch)
tree126a866062de8d27fca004dce1fdea809ebfb8f2
parent7805c61096c4fab12e899bde74e7313b411e588c (diff)
Squelch warning by using idiom from libc bcrypt(3)
Clang 10 warns about the expression sizeof(cdata) / sizeof(uint64_t) as cdata is an array of uint32_t and it expects that the intent of this is to compute the number of array elements. Use BCRYPT_WORDS / 2 instead. Same diff as millert's commit sys/lib/libsa/bcrypt_pbkdf.c -r1.2, which was ok kettenis. deraadt confirms that this satisfies clang 10.
-rw-r--r--lib/libutil/bcrypt_pbkdf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libutil/bcrypt_pbkdf.c b/lib/libutil/bcrypt_pbkdf.c
index 507bdc986ae..79eeddd867e 100644
--- a/lib/libutil/bcrypt_pbkdf.c
+++ b/lib/libutil/bcrypt_pbkdf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcrypt_pbkdf.c,v 1.15 2019/11/21 16:13:39 tedu Exp $ */
+/* $OpenBSD: bcrypt_pbkdf.c,v 1.16 2020/08/02 18:35:48 tb Exp $ */
/*
* Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
*
@@ -78,7 +78,7 @@ bcrypt_hash(uint8_t *sha2pass, uint8_t *sha2salt, uint8_t *out)
cdata[i] = Blowfish_stream2word(ciphertext, sizeof(ciphertext),
&j);
for (i = 0; i < 64; i++)
- blf_enc(&state, cdata, sizeof(cdata) / sizeof(uint64_t));
+ blf_enc(&state, cdata, BCRYPT_WORDS / 2);
/* copy out */
for (i = 0; i < BCRYPT_WORDS; i++) {