aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/agent
diff options
context:
space:
mode:
authorIngela Anderton Andin <[email protected]>2013-05-28 09:22:12 +0200
committerIngela Anderton Andin <[email protected]>2013-05-28 09:22:12 +0200
commit7f5fa1b06671d31476e0fc0f28b878a6b5059b1b (patch)
treeeaaecc247d03c90cb46fc3f9f2f2c085f9c653c0 /lib/snmp/src/agent
parent58de241d5d8e4b0536389b317ecc6e7a2a570997 (diff)
parent6ec1399aa8e6f80d8423acc37027eeda4394e7ad (diff)
downloadotp-7f5fa1b06671d31476e0fc0f28b878a6b5059b1b.tar.gz
otp-7f5fa1b06671d31476e0fc0f28b878a6b5059b1b.tar.bz2
otp-7f5fa1b06671d31476e0fc0f28b878a6b5059b1b.zip
Merge branch 'ia/ssl/public_key/crypto/elliptic_curve/OTP-11009' into maint
* ia/ssl/public_key/crypto/elliptic_curve/OTP-11009: (21 commits) ssl: Do not advertise EC ciphers if crypto support is insufficient crypto: Ctify tests and test new API crypto: Allow integer as srp_private arguments according to docs ssl: Remove unused `srp_parameters` type spec crypto, public_key & ssl: Make more functions accept integer keys snmp: Remove use of deprecated crypto functions crypto,ssh, netconf, inets: binary_to_integer -> bytes_to_integer netconf: Remove use of deprecated crypto functions crypto: Documentation fixes from review crypto: Change argument order of crypto:next_iv/3 crypto,public_key,ssl: Change return value of crypto:generate_key(ecdh,..) ssl, public_key, crypto: crypto:algorithms/0 -> crypto:supports/0 ssl, public_key & inets: Remove use of deprecated crypto functions from test code ssl: Remove use of deprecated crypto functions public_key: Remove use of deprecated crypto functions dialyzer: Remove use of deprecated crypto functions ssh & crypto: Remove use of deprecated crypto functions from ssh Update primary bootstrap common_test: Replace use of deprecated crypto functions beam_lib, compile: Replace use of deprecated crypto functions ...
Diffstat (limited to 'lib/snmp/src/agent')
-rw-r--r--lib/snmp/src/agent/snmp_user_based_sm_mib.erl33
1 files changed, 18 insertions, 15 deletions
diff --git a/lib/snmp/src/agent/snmp_user_based_sm_mib.erl b/lib/snmp/src/agent/snmp_user_based_sm_mib.erl
index 3c4ba1af66..e675cf1b83 100644
--- a/lib/snmp/src/agent/snmp_user_based_sm_mib.erl
+++ b/lib/snmp/src/agent/snmp_user_based_sm_mib.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1999-2012. All Rights Reserved.
+%% Copyright Ericsson AB 1999-2013. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -214,12 +214,12 @@ check_user(User) ->
case element(?usmUserAuthProtocol, User) of
?usmNoAuthProtocol -> ok;
?usmHMACMD5AuthProtocol ->
- case is_crypto_supported(md5_mac_96) of
+ case is_crypto_supported(md5) of
true -> ok;
false -> exit({unsupported_crypto, md5_mac_96})
end;
?usmHMACSHAAuthProtocol ->
- case is_crypto_supported(sha_mac_96) of
+ case is_crypto_supported(sha) of
true -> ok;
false -> exit({unsupported_crypto, sha_mac_96})
end
@@ -227,14 +227,14 @@ check_user(User) ->
case element(?usmUserPrivProtocol, User) of
?usmNoPrivProtocol -> ok;
?usmDESPrivProtocol ->
- case is_crypto_supported(des_cbc_decrypt) of
+ case is_crypto_supported(des_cbc) of
true -> ok;
- false -> exit({unsupported_crypto, des_cbc_decrypt})
+ false -> exit({unsupported_crypto, des_cbc})
end;
?usmAesCfb128Protocol ->
- case is_crypto_supported(aes_cfb_128_decrypt) of
+ case is_crypto_supported(aes_cfb128) of
true -> ok;
- false -> exit({unsupported_crypto, aes_cfb_128_decrypt})
+ false -> exit({unsupported_crypto, aes_cfb128})
end
end.
@@ -874,13 +874,13 @@ validate_auth_protocol(RowIndex, Cols) ->
_ -> inconsistentValue(?usmUserAuthProtocol)
end;
?usmHMACMD5AuthProtocol ->
- case is_crypto_supported(md5_mac_96) of
+ case is_crypto_supported(md5) of
true -> ok;
false ->
wrongValue(?usmUserAuthProtocol)
end;
?usmHMACSHAAuthProtocol ->
- case is_crypto_supported(sha_mac_96) of
+ case is_crypto_supported(sha) of
true -> ok;
false ->
wrongValue(?usmUserAuthProtocol)
@@ -1008,7 +1008,7 @@ validate_priv_protocol(RowIndex, Cols) ->
?usmDESPrivProtocol ->
%% The 'catch' handles the case when 'crypto' is
%% not present in the system.
- case is_crypto_supported(des_cbc_decrypt) of
+ case is_crypto_supported(des_cbc) of
true ->
case get_auth_proto(RowIndex, Cols) of
?usmNoAuthProtocol ->
@@ -1022,7 +1022,7 @@ validate_priv_protocol(RowIndex, Cols) ->
?usmAesCfb128Protocol ->
%% The 'catch' handles the case when 'crypto' is
%% not present in the system.
- case is_crypto_supported(aes_cfb_128_decrypt) of
+ case is_crypto_supported(aes_cfb128) of
true ->
case get_auth_proto(RowIndex, Cols) of
?usmNoAuthProtocol ->
@@ -1164,7 +1164,7 @@ mk_key_change(Hash, OldKey, NewKey) ->
%% case in the standard where Random is pre-defined.
mk_key_change(Alg, OldKey, NewKey, KeyLen, Random) ->
%% OldKey and Random is of length KeyLen...
- Digest = lists:sublist(binary_to_list(crypto:Alg(OldKey++Random)), KeyLen),
+ Digest = lists:sublist(binary_to_list(crypto:hash(Alg, OldKey++Random)), KeyLen),
%% ... and so is Digest
Delta = snmp_misc:str_xor(Digest, NewKey),
Random ++ Delta.
@@ -1181,7 +1181,7 @@ extract_new_key(Hash, OldKey, KeyChange) ->
sha -> sha
end,
{Random, Delta} = split(KeyLen, KeyChange, []),
- Digest = lists:sublist(binary_to_list(crypto:Alg(OldKey++Random)), KeyLen),
+ Digest = lists:sublist(binary_to_list(crypto:hash(Alg, OldKey++Random)), KeyLen),
NewKey = snmp_misc:str_xor(Digest, Delta),
NewKey.
@@ -1219,10 +1219,13 @@ split(N, [H | T], FirstRev) when N > 0 ->
split(N-1, T, [H | FirstRev]).
-is_crypto_supported(Func) ->
+is_crypto_supported(Algo) ->
%% The 'catch' handles the case when 'crypto' is
%% not present in the system (or not started).
- case catch lists:member(Func, crypto:info()) of
+ Supported = crypto:supports(),
+ Hashs = proplists:get_value(hashs, Supported),
+ Ciphers = proplists:get_value(ciphers, Supported),
+ case catch lists:member(Algo, Hashs ++ Ciphers) of
true -> true;
_ -> false
end.