Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ndn_gen_encrypted_payload used_size differs from ndn_probe_encrypted_payload_length #79

Open
yoursunny opened this issue Sep 18, 2020 · 1 comment
Assignees

Comments

@yoursunny
Copy link
Contributor

In ndn_gen_encrypted_payload, the used_size output parameter is calculated as:

*used_size = 0;
// probe the length of result
*used_size += encoder_probe_block_size(TLV_AC_AES_IV, NDN_AES_BLOCK_SIZE);
*used_size += encoder_probe_block_size(TLV_AC_KEYID, 4);
*used_size += encoder_probe_block_size(TLV_AC_ENCRYPTED_PAYLOAD, ndn_aes_probe_padding_size(input_size));

However, ndn_probe_encrypted_payload_length calculates its result differently:

return encoder_probe_block_size(TLV_AC_AES_IV, NDN_AES_BLOCK_SIZE)
+ encoder_probe_block_size(TLV_AC_KEYID, 4)
+ encoder_probe_block_size(TLV_AC_ENCRYPTED_PAYLOAD, ndn_aes_probe_padding_size(input_size) + NDN_AES_BLOCK_SIZE);

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

@tianyuan129
Copy link
Member

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

@tianyuan129 tianyuan129 self-assigned this Sep 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants