aboutsummaryrefslogtreecommitdiffstats
path: root/src/crypto
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2011-11-13 23:19:19 +0200
committerJouni Malinen <j@w1.fi>2011-11-13 23:19:19 +0200
commit911e10eac6563b86ef5f8d2ecb82574c29f8e4ae (patch)
tree06e25139cc773b12da9606eed18414012cbe945f /src/crypto
parent16cc7a43043c7aedb2196d3b5a94e9ea44b7a781 (diff)
downloadexternal_wpa_supplicant_8_ti-911e10eac6563b86ef5f8d2ecb82574c29f8e4ae.zip
external_wpa_supplicant_8_ti-911e10eac6563b86ef5f8d2ecb82574c29f8e4ae.tar.gz
external_wpa_supplicant_8_ti-911e10eac6563b86ef5f8d2ecb82574c29f8e4ae.tar.bz2
Make crypto_hash_init() easier for static analyzers
Avoid zero-length memset at the end of the buffer. This is not really needed, but it makes the code a bit easier for static analyzers. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/crypto_internal.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/crypto/crypto_internal.c b/src/crypto/crypto_internal.c
index 8fdba65..955cd55 100644
--- a/src/crypto/crypto_internal.c
+++ b/src/crypto/crypto_internal.c
@@ -63,7 +63,8 @@ struct crypto_hash * crypto_hash_init(enum crypto_hash_alg alg, const u8 *key,
ctx->key_len = key_len;
os_memcpy(k_pad, key, key_len);
- os_memset(k_pad + key_len, 0, sizeof(k_pad) - key_len);
+ if (key_len < sizeof(k_pad))
+ os_memset(k_pad + key_len, 0, sizeof(k_pad) - key_len);
for (i = 0; i < sizeof(k_pad); i++)
k_pad[i] ^= 0x36;
MD5Init(&ctx->u.md5);