tls: fix openssl/mbedtls use of app_wrk index