Skip to content

Commit

Permalink
Fix a warning false positive from clang 10.
Browse files Browse the repository at this point in the history
blf_enc() takes a number of 64-bit blocks to encrypt, but using
sizeof(uint64_t) in the calculation triggers a warning from clang
10 because the actual data type is uint32_t.  Pass BCRYPT_WORDS / 2
for the number of blocks like libc bcrypt(3) does.  OK kettenis@
  • Loading branch information
millert committed Jul 9, 2020
1 parent f7b49d5 commit 04a2240
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions sys/lib/libsa/bcrypt_pbkdf.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* $OpenBSD: bcrypt_pbkdf.c,v 1.1 2016/09/10 18:26:28 jsing Exp $ */
/* $OpenBSD: bcrypt_pbkdf.c,v 1.2 2020/07/09 19:17:19 millert Exp $ */
/*
* Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
*
Expand Down Expand Up @@ -76,7 +76,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++) {
Expand Down

0 comments on commit 04a2240

Please sign in to comment.