mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-18 20:47:53 +00:00
Bug fix in extended armor.
This commit is contained in:
parent
96ba1079b2
commit
1e679cc94d
@ -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 {
|
||||
|
@ -12,6 +12,7 @@
|
||||
#ifndef METRICS_H_
|
||||
#define METRICS_H_
|
||||
|
||||
#include <prometheus/gauge.h>
|
||||
#include <prometheus/histogram.h>
|
||||
#include <prometheus/simpleapi.h>
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "Switch.hpp"
|
||||
#include "Trace.hpp"
|
||||
#include "Utils.hpp"
|
||||
#include "Switch.hpp"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user