Hi Brian,
As I understand it, the PSA FF-M specifies that all iovec mappings are automatically unmapped after the service completes, so it is not strictly required to call the unmap functions. It is useful to call psa_unmap_outvec() because it updates the caller's psa_outvec with the number of bytes written, but psa_unmap_invec() only makes a note that the invec was unmapped in the TF-M implementation, so indeed calling it is skipped to save some unnecessary cycles.
I think the API is there for compliance with the PSA FF-M spec, and the PSA FF-M has it because in some implementations it could be useful if mapping iovecs is associated with some kind of resource usage, then unmapping mid-service could reduce the resource usage.
Kind regards, Jamie
From: Quach, Brian via TF-M tf-m@lists.trustedfirmware.org Sent: Monday, April 29, 2024 9:40 PM To: tf-m@lists.trustedfirmware.org Subject: [TF-M] psa_unmap_invec
Hi,
I see that tfm_crypto_call_srv() unmaps output vectors if PSA_FRAMEWORK_HAS_MM_IOVEC == 1, but I never see psa_unmap_invec called. This doesn't seem to be required from a functional standpoint but I was wondering if psa_unmap_invec() was purposely skipped to save some unnecessary execution time. Is psa_unmap_invec() only implemented for testing purposes?
Regards,
Brian Quach SimpleLink MCU Texas Instruments Inc. 12500 TI Blvd, MS F-4000 Dallas, TX 75243 214-479-4076