How to implement access control for Automotive Embedded Systems using mbedTLS?
As stated in the comments we can't / won't advise on whether PolarSSL is suitable to perform the operations required.



However, for your needs $N_1=N_2=N_3=32$ sounds like a reasonable choice, giving you a solid 256-bit security and no need to worry about truncation and the alike.

As for $f_1$, HMAC-SHA256 sounds like the obvious choice, also giving you $N_3=32$. You'd input the secret data as a key and the challenge and the fixed bytes as a message and you're good.

Finally for $f_2$, this needs to be the same choice as $f_1$ paired with a simple constant time comparison.

I can't promise anything, but all of this functionality is required for any TLS implementation right now, so if the low-level primitives are provided you can use the library.