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

AES input padding is missing #47

Closed Zhiyi-Zhang closed 5 years ago

Zhiyi-Zhang commented 5 years ago

Current NDN-Lite backend is using Tinycrypt to do AES encryption. However, Tinycrypt does not provide padding when the input plaintext length % 16 != 0, and lead to errors when using AES APIs. To fix this problem, we need to provide padding function by ourselves. Let's use PKCS#7 padding for AES, that is, pad the last block with n bytes all with value n.

tianyuan129 commented 5 years ago

After commit 0d5ac00df1afaf0e1781c18c887e3e417293e3eb, we now support PKCS#7 padding.