Browse Source

clear stack variables, suggested by djm

OPENBSD_5_6
tedu 10 years ago
parent
commit
edb424679c
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      src/lib/libc/crypt/bcrypt.c

+ 4
- 1
src/lib/libc/crypt/bcrypt.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: bcrypt.c,v 1.34 2014/03/23 23:25:05 tedu Exp $ */
/* $OpenBSD: bcrypt.c,v 1.35 2014/03/23 23:27:52 tedu Exp $ */
/* /*
* Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> * Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
@ -218,6 +218,7 @@ bcrypt_newhash(const char *pass, int log_rounds, char *hash, size_t hashlen)
if (bcrypt_hashpass(pass, salt, hash, hashlen) != 0) if (bcrypt_hashpass(pass, salt, hash, hashlen) != 0)
return -1; return -1;
explicit_bzero(salt, sizeof(salt));
return 0; return 0;
} }
@ -231,6 +232,8 @@ bcrypt_checkpass(const char *pass, const char *goodhash)
if (strlen(hash) != strlen(goodhash) || if (strlen(hash) != strlen(goodhash) ||
timingsafe_bcmp(hash, goodhash, strlen(goodhash)) != 0) timingsafe_bcmp(hash, goodhash, strlen(goodhash)) != 0)
return -1; return -1;
explicit_bzero(hash, sizeof(hash));
return 0; return 0;
} }


Loading…
Cancel
Save