mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-07 22:29:19 +00:00
10_ZWave.pm: security cleanup (Forum #38587)
git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@9773 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
3e104e8550
commit
c9e6a86cc0
@ -626,6 +626,10 @@ ZWave_Cmd($$@)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($cfgReq) {
|
||||||
|
$type="get";
|
||||||
|
}
|
||||||
|
|
||||||
my $id = $hash->{nodeIdHex};
|
my $id = $hash->{nodeIdHex};
|
||||||
my $isMc = ($id =~ m/(....)/);
|
my $isMc = ($id =~ m/(....)/);
|
||||||
if(!$isMc) {
|
if(!$isMc) {
|
||||||
@ -753,10 +757,9 @@ ZWave_Cmd($$@)
|
|||||||
#check message here for needed encryption (SECURITY)
|
#check message here for needed encryption (SECURITY)
|
||||||
if(ZWave_secIsSecureClass($hash, $cc_cmd)) {
|
if(ZWave_secIsSecureClass($hash, $cc_cmd)) {
|
||||||
ZWave_secStart($hash);
|
ZWave_secStart($hash);
|
||||||
my $interceptedMSG = $cc_cmd . $payload;
|
|
||||||
# message stored in reading, will be processed when nonce arrives
|
# message stored in reading, will be processed when nonce arrives
|
||||||
my $cmd2 = "$type $name $cmd ".join(" ", @a);
|
my $cmd2 = "$type $name $cmd ".join(" ", @a);
|
||||||
ZWave_secPutMsg($hash, $interceptedMSG, $cmd2);
|
ZWave_secPutMsg($hash, $cc_cmd . $payload, $cmd2);
|
||||||
return ZWave_Cmd("get", $hash, $name, "secNonce");
|
return ZWave_Cmd("get", $hash, $name, "secNonce");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -916,7 +919,6 @@ Zwave_meterGet($)
|
|||||||
return("argument must be one of: 0 to 6","");
|
return("argument must be one of: 0 to 6","");
|
||||||
} else {
|
} else {
|
||||||
$scale = $scale << 3;
|
$scale = $scale << 3;
|
||||||
#~ Log 1, "cmd" .sprintf('01%02x', $scale);
|
|
||||||
return("",sprintf('01%02x', $scale));
|
return("",sprintf('01%02x', $scale));
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2005,7 +2007,6 @@ ZWave_secNonceReceived($$)
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
setReadingsVal($hash, "received_nonce", $r_nonce_hex, TimeNow());
|
|
||||||
|
|
||||||
# If a nonce is received during secure_Include, send the networkkey...
|
# If a nonce is received during secure_Include, send the networkkey...
|
||||||
if ($hash->{secStatus} && ($hash->{secStatus} == 2)) {
|
if ($hash->{secStatus} && ($hash->{secStatus} == 2)) {
|
||||||
@ -2223,7 +2224,7 @@ ZWave_secDecrypt($$$)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
readingsSingleUpdate($hash, "send_nonce", undef, 0);
|
delete $hash->{READINGS}{send_nonce};
|
||||||
|
|
||||||
# encrypted message format:
|
# encrypted message format:
|
||||||
# data= bcb328fe5d924a402b2901fc2699cc3bcacd30e0
|
# data= bcb328fe5d924a402b2901fc2699cc3bcacd30e0
|
||||||
@ -2233,7 +2234,6 @@ ZWave_secDecrypt($$$)
|
|||||||
# 2699cc3bcacd30e0 = 8 byte authentification code
|
# 2699cc3bcacd30e0 = 8 byte authentification code
|
||||||
if ($data !~ m/^(................)(.*)(..)(................)$/) {
|
if ($data !~ m/^(................)(.*)(..)(................)$/) {
|
||||||
Log3 $name, 1, "$name: Error, wrong format of encrypted msg";
|
Log3 $name, 1, "$name: Error, wrong format of encrypted msg";
|
||||||
#return (undef, undef);
|
|
||||||
ZWave_secEnd($hash);
|
ZWave_secEnd($hash);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user