<div dir="ltr">Hi Susmit<div><br></div><div>You are not supposed to modify MAX_NDN_PACKET_SIZE constant. It's used internally by the library. Modifying it can cause unintended consequences and void your warranty.</div><div><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
My next suspect would be ndn-cxx's Encoder, which can preallocate up<br>
to MAX_NDN_PACKET_SIZE bytes. However, that shouldn't normally happen,<br>
because before encoding we estimate the final packet size and then ask<br>
the Encoder to allocate only what's needed.<br></blockquote><div><br></div><div>Correct. KeyChain::sign method allocates a big buffer to encode the Data before signing, and then appends the signature. TPM needs the Data's wire encoding before it could sign the Data, which isn't possible with an estimator. After the signature is created, it's faster to append it to the existing buffer than to re-encode (or copy) the Data into a new snugly-sized buffer.</div><div><a href="https://github.com/named-data/ndn-cxx/blob/5d0b0106dfc7675f9048976d4dd4ea00e46e6c39/src/security/v2/key-chain.cpp#L438">https://github.com/named-data/ndn-cxx/blob/5d0b0106dfc7675f9048976d4dd4ea00e46e6c39/src/security/v2/key-chain.cpp#L438</a></div><div><br></div><div>Yours, Junxiao</div></div></div></div></div>