Fix clang and gcc build, use cryptography to replace Cryptodome
diff --git a/src/ble/BleApplicationDelegate.h b/src/ble/BleApplicationDelegate.h
index c2f2111..e5d7690 100644
--- a/src/ble/BleApplicationDelegate.h
+++ b/src/ble/BleApplicationDelegate.h
@@ -36,6 +36,9 @@
class NL_DLL_EXPORT BleApplicationDelegate
{
public:
+ virtual ~BleApplicationDelegate() {
+ }
+
// Weave calls this function once it closes the last BLEEndPoint associated with a BLE given connection object.
// A call to this function means Weave no longer cares about the state of the given BLE connection.
// The application can use this callback to e.g. close the underlying BLE conection if it is no longer needed,
diff --git a/src/ble/BlePlatformDelegate.h b/src/ble/BlePlatformDelegate.h
index 4425cec..e79dd8e 100644
--- a/src/ble/BlePlatformDelegate.h
+++ b/src/ble/BlePlatformDelegate.h
@@ -40,6 +40,9 @@
class NL_DLL_EXPORT BlePlatformDelegate
{
public:
+ virtual ~BlePlatformDelegate() {
+ }
+
// Following APIs must be implemented by platform:
// Subscribe to updates and indications on the specfied characteristic
diff --git a/src/device-manager/python/WeaveDeviceManager-ScriptBinding.cpp b/src/device-manager/python/WeaveDeviceManager-ScriptBinding.cpp
index 7119252..9fcb97c 100644
--- a/src/device-manager/python/WeaveDeviceManager-ScriptBinding.cpp
+++ b/src/device-manager/python/WeaveDeviceManager-ScriptBinding.cpp
@@ -1373,7 +1373,7 @@
case nl::Weave::Binding::kEvent_DefaultCheck:
WeaveLogDetail(DeviceManager, "kEvent_DefaultCheck");
- // fall through
+ [[fallthrough]];
default:
nl::Weave::Binding::DefaultEventHandler(apAppState, aEvent, aInParam, aOutParam);
}
diff --git a/src/device-manager/python/weave-device-mgr.py b/src/device-manager/python/weave-device-mgr.py
index 809e08a..3c943a9 100755
--- a/src/device-manager/python/weave-device-mgr.py
+++ b/src/device-manager/python/weave-device-mgr.py
@@ -41,8 +41,8 @@
from copy import copy
from cmd import Cmd
-from Cryptodome.Hash import CMAC
-from Cryptodome.Cipher import AES
+from cryptography.hazmat.primitives import cmac
+from cryptography.hazmat.primitives.ciphers import algorithms
from six.moves import range
from six.moves import zip
@@ -148,9 +148,9 @@
def aes_cmac(key, message):
- cipher = CMAC.new(key, ciphermod=AES)
+ cipher = cmac.CMAC.new(algorithms.AES(key))
cipher.update(message)
- return cipher.digest()
+ return cipher.finalize()
#see RFC-4615
@@ -2602,3 +2602,4 @@
if __name__ == "__main__":
main()
+