Move value collection into its own function
Move value collection into its own function

No behavior change.

ARMmbed/mbedtls,Mbed-TLS/mbedtls,NXPmicro/mbedtls,Mbed-TLS/mbedtls,NXPmicro/mbedtls,Mbed-TLS/mbedtls,ARMmbed/mbedtls,NXPmicro/mbedtls,ARMmbed/mbedtls,Mbed-TLS/mbedtls,NXPmicro/mbedtls,ARMmbed/mbedtls