X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=crypt%2Fsha256-crypt.c;h=639726c22ca159857a585f0dba8d36499cd35276;hb=2b778ceb4010c28d70de9b8eab20e8d88eed586b;hp=d90e291aa76a08d2ab4c6c4552618a8b51c8078e;hpb=b168057aaacf1d149246d0eb3e84332492d35063;p=thirdparty%2Fglibc.git diff --git a/crypt/sha256-crypt.c b/crypt/sha256-crypt.c index d90e291aa76..639726c22ca 100644 --- a/crypt/sha256-crypt.c +++ b/crypt/sha256-crypt.c @@ -1,5 +1,5 @@ /* One way encryption based on SHA256 sum. - Copyright (C) 2007-2015 Free Software Foundation, Inc. + Copyright (C) 2007-2021 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 2007. @@ -15,7 +15,7 @@ You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see - . */ + . */ #include #include @@ -99,11 +99,7 @@ extern char *__sha256_crypt (const char *key, const char *salt); char * -__sha256_crypt_r (key, salt, buffer, buflen) - const char *key; - const char *salt; - char *buffer; - int buflen; +__sha256_crypt_r (const char *key, const char *salt, char *buffer, int buflen) { unsigned char alt_result[32] __attribute__ ((__aligned__ (__alignof__ (uint32_t)))); @@ -323,8 +319,8 @@ __sha256_crypt_r (key, salt, buffer, buflen) if (rounds_custom) { - int n = snprintf (cp, MAX (0, buflen), "%s%zu$", - sha256_rounds_prefix, rounds); + int n = __snprintf (cp, MAX (0, buflen), "%s%zu$", + sha256_rounds_prefix, rounds); cp += n; buflen -= n; } @@ -375,16 +371,16 @@ __sha256_crypt_r (key, salt, buffer, buflen) #ifndef USE_NSS __sha256_init_ctx (&ctx); __sha256_finish_ctx (&ctx, alt_result); - memset (&ctx, '\0', sizeof (ctx)); - memset (&alt_ctx, '\0', sizeof (alt_ctx)); + explicit_bzero (&ctx, sizeof (ctx)); + explicit_bzero (&alt_ctx, sizeof (alt_ctx)); #endif - memset (temp_result, '\0', sizeof (temp_result)); - memset (p_bytes, '\0', key_len); - memset (s_bytes, '\0', salt_len); + explicit_bzero (temp_result, sizeof (temp_result)); + explicit_bzero (p_bytes, key_len); + explicit_bzero (s_bytes, salt_len); if (copied_key != NULL) - memset (copied_key, '\0', key_len); + explicit_bzero (copied_key, key_len); if (copied_salt != NULL) - memset (copied_salt, '\0', salt_len); + explicit_bzero (copied_salt, salt_len); free (free_key); free (free_pbytes);