diff options
author | 2014-01-31 16:56:32 +0000 | |
---|---|---|
committer | 2014-01-31 16:56:32 +0000 | |
commit | ba958d377676376b5606baf3bb98dd6da0a58e79 (patch) | |
tree | 61a70940ce764b07ed8e8f8ddd15fb53d3e894a1 /lib/libutil | |
parent | replace most bzero with explicit_bzero, except a few that cna be memset (diff) | |
download | wireguard-openbsd-ba958d377676376b5606baf3bb98dd6da0a58e79.tar.xz wireguard-openbsd-ba958d377676376b5606baf3bb98dd6da0a58e79.zip |
explicit_bzero where useful
Diffstat (limited to 'lib/libutil')
-rw-r--r-- | lib/libutil/bcrypt_pbkdf.c | 12 | ||||
-rw-r--r-- | lib/libutil/pkcs5_pbkdf2.c | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/libutil/bcrypt_pbkdf.c b/lib/libutil/bcrypt_pbkdf.c index a3dc2775056..22725e69788 100644 --- a/lib/libutil/bcrypt_pbkdf.c +++ b/lib/libutil/bcrypt_pbkdf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bcrypt_pbkdf.c,v 1.5 2013/12/22 03:29:07 tedu Exp $ */ +/* $OpenBSD: bcrypt_pbkdf.c,v 1.6 2014/01/31 16:56:32 tedu Exp $ */ /* * Copyright (c) 2013 Ted Unangst <tedu@openbsd.org> * @@ -87,9 +87,9 @@ bcrypt_hash(uint8_t *sha2pass, uint8_t *sha2salt, uint8_t *out) } /* zap */ - memset(ciphertext, 0, sizeof(ciphertext)); - memset(cdata, 0, sizeof(cdata)); - memset(&state, 0, sizeof(state)); + explicit_bzero(ciphertext, sizeof(ciphertext)); + explicit_bzero(cdata, sizeof(cdata)); + explicit_bzero(&state, sizeof(state)); } int @@ -155,8 +155,8 @@ bcrypt_pbkdf(const char *pass, size_t passlen, const uint8_t *salt, size_t saltl } /* zap */ - memset(&ctx, 0, sizeof(ctx)); - memset(out, 0, sizeof(out)); + explicit_bzero(&ctx, sizeof(ctx)); + explicit_bzero(out, sizeof(out)); return 0; } diff --git a/lib/libutil/pkcs5_pbkdf2.c b/lib/libutil/pkcs5_pbkdf2.c index f7207650ee2..2d07ea03906 100644 --- a/lib/libutil/pkcs5_pbkdf2.c +++ b/lib/libutil/pkcs5_pbkdf2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pkcs5_pbkdf2.c,v 1.5 2014/01/18 07:12:04 jsing Exp $ */ +/* $OpenBSD: pkcs5_pbkdf2.c,v 1.6 2014/01/31 16:56:32 tedu Exp $ */ /*- * Copyright (c) 2008 Damien Bergamini <damien.bergamini@free.fr> @@ -111,11 +111,11 @@ pkcs5_pbkdf2(const char *pass, size_t pass_len, const uint8_t *salt, key += r; key_len -= r; }; - bzero(asalt, salt_len + 4); + explicit_bzero(asalt, salt_len + 4); free(asalt); - bzero(d1, sizeof(d1)); - bzero(d2, sizeof(d2)); - bzero(obuf, sizeof(obuf)); + explicit_bzero(d1, sizeof(d1)); + explicit_bzero(d2, sizeof(d2)); + explicit_bzero(obuf, sizeof(obuf)); return 0; } |