Browse Source

fix a colossal cockup due to pointer/array confusion.

code isn't used yet, thankfully.
first observed by djm running regress. ok deraadt djm
OPENBSD_5_4 OPENBSD_5_4_BASE
tedu 11 years ago
parent
commit
c86cc50f44
1 changed files with 6 additions and 7 deletions
  1. +6
    -7
      src/lib/libutil/bcrypt_pbkdf.c

+ 6
- 7
src/lib/libutil/bcrypt_pbkdf.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: bcrypt_pbkdf.c,v 1.3 2013/06/04 15:55:50 tedu Exp $ */
/* $OpenBSD: bcrypt_pbkdf.c,v 1.4 2013/07/29 00:55:53 tedu Exp $ */
/* /*
* Copyright (c) 2013 Ted Unangst <tedu@openbsd.org> * Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
* *
@ -52,8 +52,7 @@
#define BCRYPT_HASHSIZE (BCRYPT_BLOCKS * 4) #define BCRYPT_HASHSIZE (BCRYPT_BLOCKS * 4)
static void static void
bcrypt_hash(uint8_t sha2pass[SHA512_DIGEST_LENGTH],
uint8_t sha2salt[SHA512_DIGEST_LENGTH], uint8_t out[BCRYPT_HASHSIZE])
bcrypt_hash(uint8_t *sha2pass, uint8_t *sha2salt, uint8_t *out)
{ {
blf_ctx state; blf_ctx state;
uint8_t ciphertext[BCRYPT_HASHSIZE] = uint8_t ciphertext[BCRYPT_HASHSIZE] =
@ -61,14 +60,14 @@ bcrypt_hash(uint8_t sha2pass[SHA512_DIGEST_LENGTH],
uint32_t cdata[BCRYPT_BLOCKS]; uint32_t cdata[BCRYPT_BLOCKS];
int i; int i;
uint16_t j; uint16_t j;
size_t shalen = SHA512_DIGEST_LENGTH;
/* key expansion */ /* key expansion */
Blowfish_initstate(&state); Blowfish_initstate(&state);
Blowfish_expandstate(&state, sha2salt, sizeof(sha2salt), sha2pass,
sizeof(sha2pass));
Blowfish_expandstate(&state, sha2salt, shalen, sha2pass, shalen);
for (i = 0; i < 64; i++) { for (i = 0; i < 64; i++) {
Blowfish_expand0state(&state, sha2salt, sizeof(sha2salt));
Blowfish_expand0state(&state, sha2pass, sizeof(sha2pass));
Blowfish_expand0state(&state, sha2salt, shalen);
Blowfish_expand0state(&state, sha2pass, shalen);
} }
/* encryption */ /* encryption */


Loading…
Cancel
Save