mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-05-01 16:30:12 +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.
|
* of this software will be governed by version 2.0 of the Apache License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <prometheus/histogram.h>
|
#include "Metrics.hpp"
|
||||||
#include <prometheus/simpleapi.h>
|
|
||||||
|
|
||||||
namespace prometheus {
|
namespace prometheus {
|
||||||
namespace simpleapi {
|
namespace simpleapi {
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#ifndef METRICS_H_
|
#ifndef METRICS_H_
|
||||||
#define METRICS_H_
|
#define METRICS_H_
|
||||||
|
|
||||||
|
#include <prometheus/gauge.h>
|
||||||
#include <prometheus/histogram.h>
|
#include <prometheus/histogram.h>
|
||||||
#include <prometheus/simpleapi.h>
|
#include <prometheus/simpleapi.h>
|
||||||
|
|
||||||
|
@ -1162,6 +1162,7 @@ void Packet::armor(const void* key, bool encryptPayload, bool extendedArmor, con
|
|||||||
AES::CTR aesCtr(cipher);
|
AES::CTR aesCtr(cipher);
|
||||||
aesCtr.init(data, 0, data + ZT_PACKET_IDX_EXTENDED_ARMOR_START);
|
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);
|
||||||
|
aesCtr.finish();
|
||||||
|
|
||||||
this->append(ephemeralKeyPair.pub.data, ZT_ECC_EPHEMERAL_PUBLIC_KEY_LEN);
|
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 cipher(ephemeralSymmetric);
|
||||||
AES::CTR aesCtr(cipher);
|
AES::CTR aesCtr(cipher);
|
||||||
aesCtr.init(data, 0, data + ZT_PACKET_IDX_EXTENDED_ARMOR_START);
|
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);
|
this->setSize(size() - ZT_ECC_EPHEMERAL_PUBLIC_KEY_LEN);
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "Switch.hpp"
|
#include "Switch.hpp"
|
||||||
#include "Trace.hpp"
|
#include "Trace.hpp"
|
||||||
#include "Utils.hpp"
|
#include "Utils.hpp"
|
||||||
|
#include "Switch.hpp"
|
||||||
|
|
||||||
namespace ZeroTier {
|
namespace ZeroTier {
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user