mirror of
https://github.com/Dasharo/edk2.git
synced 2026-06-13 10:16:24 -07:00
1d82490f1d
AllocateZeroPool() can't be used after ExitBootServices() and that's what happened without this change when OS was trying to update "dbx" variable. It requires use of authenticated variables therefore PKCS 7 and this particular file of BaseCryptLibMbedTls thus causing firmware to crash. There was no calloc() so added it as a form of an API to hide the fact that memory is managed differently in different phases. Using calloc()/free() outside of runtime (RT) phase causes trouble, so non-RT modules will continue to rely on MemoryAllocationLib through redirection in MbedTlsCrtLib while RT modules will use a heap invoked by MbedTlsCrtRuntimeLib. While at it, fixed memory leaks in WrapPkcs7Data() and Pkcs7GetSigners(). Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>