named-data-iot / ndn-lite

A lightweight NDN protocol stack with high-level application support including security bootstrapping, access control, trust management, etc.
https://ndn-lite.named-data.net
GNU Lesser General Public License v3.0
44 stars 16 forks source link

ndn_gen_encrypted_payload used_size differs from ndn_probe_encrypted_payload_length #79

Open yoursunny opened 4 years ago

yoursunny commented 4 years ago

In ndn_gen_encrypted_payload, the used_size output parameter is calculated as:

https://github.com/named-data-iot/ndn-lite/blob/d60a114a4c4e8422577ab8ae3817f79eed948254/encode/encrypted-payload.c#L38-L42

However, ndn_probe_encrypted_payload_length calculates its result differently:

https://github.com/named-data-iot/ndn-lite/blob/d60a114a4c4e8422577ab8ae3817f79eed948254/encode/encrypted-payload.c#L28-L30

They differ in + NDN_AES_BLOCK_SIZE on the last line. Please explain why there's this difference.

tianyuan129 commented 4 years ago

I don't know the detail of this piece @Zhiyi-Zhang . But I suppose ndn_gen_encrypted_payload doesn't calculate used_size correctly.