From 92f5da84126c3ccd9178f54885f36c04a3b378db Mon Sep 17 00:00:00 2001 From: Dirk Ziegelmeier Date: Thu, 7 Apr 2016 06:58:58 +0200 Subject: [PATCH] two minor fixes in snmpv3_mbedtls.c --- src/apps/snmp/snmpv3_mbedtls.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/apps/snmp/snmpv3_mbedtls.c b/src/apps/snmp/snmpv3_mbedtls.c index 5cbeccdf..10894edd 100644 --- a/src/apps/snmp/snmpv3_mbedtls.c +++ b/src/apps/snmp/snmpv3_mbedtls.c @@ -129,7 +129,7 @@ snmpv3_crypt(struct snmp_pbuf_stream* stream, u16_t length, if(mbedtls_cipher_setup(&ctx, cipher_info) != 0) { return ERR_ARG; } - if(mbedtls_cipher_setkey(&ctx, key, 12*8, (mode == SNMP_V3_PRIV_MODE_ENCRYPT)? MBEDTLS_ENCRYPT : MBEDTLS_DECRYPT) != 0) { + if(mbedtls_cipher_setkey(&ctx, key, 8*8, (mode == SNMP_V3_PRIV_MODE_ENCRYPT)? MBEDTLS_ENCRYPT : MBEDTLS_DECRYPT) != 0) { goto error; } @@ -157,7 +157,7 @@ snmpv3_crypt(struct snmp_pbuf_stream* stream, u16_t length, snmp_pbuf_stream_writebuf(&write_stream, out_bytes, out_len); } - } else if (algo == SNMP_V3_PRIV_ALGO_AES && mode == SNMP_V3_PRIV_MODE_ENCRYPT) { + } else if (algo == SNMP_V3_PRIV_ALGO_AES) { u8_t iv_local[16]; cipher_info = mbedtls_cipher_info_from_type(MBEDTLS_CIPHER_AES_128_CFB128);