فهرست منبع

Bug fix in extended armor.

Adam Ierymenko 11 ماه پیش
والد
کامیت
1e679cc94d
4فایلهای تغییر یافته به همراه6 افزوده شده و 3 حذف شده
  1. 1 2
      node/Metrics.cpp
  2. 1 0
      node/Metrics.hpp
  3. 3 1
      node/Packet.cpp
  4. 1 0
      node/Peer.cpp

+ 1 - 2
node/Metrics.cpp

@@ -10,8 +10,7 @@
  * of this software will be governed by version 2.0 of the Apache License.
  */
 
-#include <prometheus/histogram.h>
-#include <prometheus/simpleapi.h>
+#include "Metrics.hpp"
 
 namespace prometheus {
 namespace simpleapi {

+ 1 - 0
node/Metrics.hpp

@@ -12,6 +12,7 @@
 #ifndef METRICS_H_
 #define METRICS_H_
 
+#include <prometheus/gauge.h>
 #include <prometheus/histogram.h>
 #include <prometheus/simpleapi.h>
 

+ 3 - 1
node/Packet.cpp

@@ -1162,6 +1162,7 @@ void Packet::armor(const void* key, bool encryptPayload, bool extendedArmor, con
         AES::CTR aesCtr(cipher);
         aesCtr.init(data, 0, data + ZT_PACKET_IDX_EXTENDED_ARMOR_START);
         aesCtr.crypt(data + ZT_PACKET_IDX_EXTENDED_ARMOR_START, size() - ZT_PACKET_IDX_EXTENDED_ARMOR_START);
+        aesCtr.finish();
 
         this->append(ephemeralKeyPair.pub.data, ZT_ECC_EPHEMERAL_PUBLIC_KEY_LEN);
     }
@@ -1184,7 +1185,8 @@ bool Packet::dearmor(const void* key, const AES aesKeys[2], const Identity& iden
         AES cipher(ephemeralSymmetric);
         AES::CTR aesCtr(cipher);
         aesCtr.init(data, 0, data + ZT_PACKET_IDX_EXTENDED_ARMOR_START);
-        aesCtr.crypt(data + ZT_PACKET_IDX_EXTENDED_ARMOR_START, size() - ZT_PACKET_IDX_EXTENDED_ARMOR_START);
+        aesCtr.crypt(data + ZT_PACKET_IDX_EXTENDED_ARMOR_START, (size() - ZT_PACKET_IDX_EXTENDED_ARMOR_START) - ZT_ECC_EPHEMERAL_PUBLIC_KEY_LEN);
+        aesCtr.finish();
 
         this->setSize(size() - ZT_ECC_EPHEMERAL_PUBLIC_KEY_LEN);
 

+ 1 - 0
node/Peer.cpp

@@ -25,6 +25,7 @@
 #include "Switch.hpp"
 #include "Trace.hpp"
 #include "Utils.hpp"
+#include "Switch.hpp"
 
 namespace ZeroTier {