add version switch for new mbedtls api
@@ -210,8 +210,14 @@ int tls_client_get_id(uint8_t id[], size_t len, const char query[])
if (strchr(query, '.')) {
mbedtls_sha256_context ctx;
mbedtls_sha256_init(&ctx);
+
+#if (MBEDTLS_VERSION_MAJOR >= 0x02070000)
mbedtls_sha256_update_ret(&ctx, (uint8_t*) &query[0], strlen(query));
mbedtls_sha256_finish_ret(&ctx, hash);
+#else
+ mbedtls_sha256_update(&ctx, (uint8_t*) &query[0], strlen(query));
+ mbedtls_sha256_finish(&ctx, hash);
+#endif
memset(id, 0, len);
memcpy(id, hash, MIN(len, sizeof(hash)));
