diff options
author | Tom Smeding <hallo@tomsmeding.nl> | 2016-10-27 18:15:49 +0200 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2016-10-28 00:22:14 +0200 |
commit | e844beecc86dafca3e49b2ab2986c118e38ef1a4 (patch) | |
tree | 133b58cc27895727e7efdfef0ba84a0038239a22 | |
parent | 7cca53ede2ee4900fce30334fb561a24d1b5d2de (diff) |
Add double cast comment
-rw-r--r-- | envelope.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/envelope.cpp b/envelope.cpp index abf6e8f..0c995bd 100644 --- a/envelope.cpp +++ b/envelope.cpp @@ -59,6 +59,7 @@ namespace Envelope{ string decrypt(const string &data,const RSA::Key &privkey){ if(data.size()<2)throw invalid_argument("Envelope data length invalid"); + //This double cast is necessary because of sign extension. int encrkeylen=((uint16_t)(uint8_t)data[data.size()-2]<<8)+(uint8_t)data.back(); assert(encrkeylen<(1<<16)); if((int)data.size()<encrkeylen+2)throw invalid_argument("Envelope key format invalid"); |