diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-02-04 13:17:00 -0800 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-02-04 13:17:00 -0800 |
| commit | 3587aa1ea7573198168422be55511b16470fb33f (patch) | |
| tree | 645853d1cd6cd9d98218d28455efa981d5f6ccf5 /node/Capability.hpp | |
| parent | beb642faa58bb3c2c283a068e6de942bfad2c314 (diff) | |
| download | infinitytier-3587aa1ea7573198168422be55511b16470fb33f.tar.gz infinitytier-3587aa1ea7573198168422be55511b16470fb33f.zip | |
Add and send certificates of representation to tell people what our valid upstreams are. These are not used yet but will be needed for future privacy modes, etc. Also some cleanup.
Diffstat (limited to 'node/Capability.hpp')
| -rw-r--r-- | node/Capability.hpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/node/Capability.hpp b/node/Capability.hpp index 2c829ee5..ddbfd9ee 100644 --- a/node/Capability.hpp +++ b/node/Capability.hpp @@ -414,7 +414,14 @@ public: throw std::runtime_error("unterminated custody chain"); _custody[i].to = to; _custody[i].from.setTo(b.field(p,ZT_ADDRESS_LENGTH),ZT_ADDRESS_LENGTH); p += ZT_ADDRESS_LENGTH; - memcpy(_custody[i].signature.data,b.field(p,ZT_C25519_SIGNATURE_LEN),ZT_C25519_SIGNATURE_LEN); p += ZT_C25519_SIGNATURE_LEN; + if (b[p++] == 1) { + if (b.template at<uint16_t>(p) != ZT_C25519_SIGNATURE_LEN) + throw std::runtime_error("invalid signature"); + p += 2; + memcpy(_custody[i].signature.data,b.field(p,ZT_C25519_SIGNATURE_LEN),ZT_C25519_SIGNATURE_LEN); p += ZT_C25519_SIGNATURE_LEN; + } else { + p += 2 + b.template at<uint16_t>(p); + } } p += 2 + b.template at<uint16_t>(p); |
