diff options
author | Guy Harris <guy@alum.mit.edu> | 2015-05-09 16:35:45 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2015-05-09 23:36:11 +0000 |
commit | acf7985f7377806e23d7ec9daa14a3a6886a51c7 (patch) | |
tree | 3c46c8ceb05fc7feee052c138c437f83f5381a53 /asn1/snmp | |
parent | bb89e7724220098e7b7fba5d31daf0d916b2d553 (diff) |
Define the SHA-1 digest length in wsutil/sha1.h and use it.
Hopefully that'll make it a little easier to make sure that we're not
overflowing arrays.
Change-Id: I770df045ef9a45fd486c1271ea424b3334bb39d2
Reviewed-on: https://code.wireshark.org/review/8370
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'asn1/snmp')
-rw-r--r-- | asn1/snmp/packet-snmp-template.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/asn1/snmp/packet-snmp-template.c b/asn1/snmp/packet-snmp-template.c index eb676407db..e5e6352465 100644 --- a/asn1/snmp/packet-snmp-template.c +++ b/asn1/snmp/packet-snmp-template.c @@ -114,7 +114,7 @@ static void snmp_usm_password_to_key_sha1(const guint8 *password, guint password static snmp_usm_auth_model_t model_md5 = {snmp_usm_password_to_key_md5, snmp_usm_auth_md5, 16}; -static snmp_usm_auth_model_t model_sha1 = {snmp_usm_password_to_key_sha1, snmp_usm_auth_sha1, 20}; +static snmp_usm_auth_model_t model_sha1 = {snmp_usm_password_to_key_sha1, snmp_usm_auth_sha1, SHA1_DIGEST_LEN}; static const value_string auth_types[] = { {0,"MD5"}, @@ -1636,7 +1636,7 @@ snmp_usm_auth_sha1(snmp_usm_params_t* p _U_, guint8** calc_auth_p, guint* calc_a msg[i] = '\0'; } - calc_auth = (guint8*)wmem_alloc(wmem_packet_scope(), 20); + calc_auth = (guint8*)wmem_alloc(wmem_packet_scope(), SHA1_DIGEST_LEN); sha1_hmac(key, key_len, msg, msg_len, calc_auth); @@ -2251,9 +2251,9 @@ snmp_usm_password_to_key_sha1(const guint8 *password, guint passwordlen, /*****************************************************/ sha1_starts(&SH); - sha1_update(&SH, key, 20); + sha1_update(&SH, key, SHA1_DIGEST_LEN); sha1_update(&SH, engineID, engineLength); - sha1_update(&SH, key, 20); + sha1_update(&SH, key, SHA1_DIGEST_LEN); sha1_finish(&SH, key); return; } |