aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/misc
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2013-10-18 11:32:25 +0200
committerMicael Karlberg <[email protected]>2013-10-21 12:50:41 +0200
commit300803837926d0bb28829f313fad07f757188d41 (patch)
tree9fdc1833b7e45b44fa3d50e48f17dcc74636336c /lib/snmp/src/misc
parenta803a95c00f89932d2cfd7a7b424aad05fa276b8 (diff)
downloadotp-300803837926d0bb28829f313fad07f757188d41.tar.gz
otp-300803837926d0bb28829f313fad07f757188d41.tar.bz2
otp-300803837926d0bb28829f313fad07f757188d41.zip
[snmp/manager] Incorrect use of EngineBoots and EngineTime when encrypting
When performing the AES encryption, invalid values for the EngineBoots and EngineTime was used. The values of the local agent was used, which would have produced some values if an agent was actually running. If not it would have caused a crash. OTP-11413
Diffstat (limited to 'lib/snmp/src/misc')
-rw-r--r--lib/snmp/src/misc/snmp_usm.erl8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/snmp/src/misc/snmp_usm.erl b/lib/snmp/src/misc/snmp_usm.erl
index 0c57f535cd..32198deb8b 100644
--- a/lib/snmp/src/misc/snmp_usm.erl
+++ b/lib/snmp/src/misc/snmp_usm.erl
@@ -16,6 +16,8 @@
%%
%% %CopyrightEnd%
%%
+%% AES: RFC 3826
+%%
-module(snmp_usm).
@@ -24,7 +26,7 @@
-export([passwd2localized_key/3, localize_key/3]).
-export([auth_in/4, auth_out/4, set_msg_auth_params/3]).
-export([des_encrypt/3, des_decrypt/3]).
--export([aes_encrypt/3, aes_decrypt/5]).
+-export([aes_encrypt/5, aes_decrypt/5]).
-define(SNMP_USE_V3, true).
@@ -241,11 +243,9 @@ des_decrypt(PrivKey, BadMsgPrivParams, EncData) ->
throw({error, {bad_msgPrivParams, PrivKey, BadMsgPrivParams, EncData}}).
-aes_encrypt(PrivKey, Data, SaltFun) ->
+aes_encrypt(PrivKey, Data, SaltFun, EngineBoots, EngineTime) ->
AesKey = PrivKey,
Salt = SaltFun(),
- EngineBoots = snmp_framework_mib:get_engine_boots(),
- EngineTime = snmp_framework_mib:get_engine_time(),
IV = list_to_binary([?i32(EngineBoots), ?i32(EngineTime) | Salt]),
EncData = crypto:block_encrypt(?BLOCK_CIPHER_AES,
AesKey, IV, Data),