Browse Source

Merge 49801cda65 into 5f3b7f25d0

pull/1656/merge
Wessel 20 hours ago
committed by GitHub
parent
commit
4580c6015d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 3
      src/Utils.cpp

3
src/Utils.cpp

@ -1,5 +1,6 @@
#include "Utils.h"
#include <AES.h>
#include <Crypto.h>
#include <SHA256.h>
#ifdef ARDUINO
@ -81,7 +82,7 @@ int Utils::MACThenDecrypt(const uint8_t* shared_secret, uint8_t* dest, const uin
sha.update(src + CIPHER_MAC_SIZE, src_len - CIPHER_MAC_SIZE);
sha.finalizeHMAC(shared_secret, PUB_KEY_SIZE, hmac, CIPHER_MAC_SIZE);
}
if (memcmp(hmac, src, CIPHER_MAC_SIZE) == 0) {
if (secure_compare(hmac, src, CIPHER_MAC_SIZE)) {
return decrypt(shared_secret, dest, src + CIPHER_MAC_SIZE, src_len - CIPHER_MAC_SIZE);
}
return 0; // invalid HMAC

Loading…
Cancel
Save