Skip to content

Commit

Permalink
Bug fix in extended armor.
Browse files Browse the repository at this point in the history
  • Loading branch information
adamierymenko committed Sep 27, 2024
1 parent 96ba107 commit 1e679cc
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
3 changes: 1 addition & 2 deletions node/Metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions node/Metrics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifndef METRICS_H_
#define METRICS_H_

#include <prometheus/gauge.h>
#include <prometheus/histogram.h>
#include <prometheus/simpleapi.h>

Expand Down
4 changes: 3 additions & 1 deletion node/Packet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);

Expand Down
1 change: 1 addition & 0 deletions node/Peer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "Switch.hpp"
#include "Trace.hpp"
#include "Utils.hpp"
#include "Switch.hpp"

namespace ZeroTier {

Expand Down

0 comments on commit 1e679cc

Please sign in to comment.