Skip to content

Commit

Permalink
Fix warnings about deprecated mbedtls API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
mikebrady committed Feb 2, 2019
1 parent cb9a307 commit cf03983
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
6 changes: 3 additions & 3 deletions metadata_hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -228,9 +228,9 @@ char *metadata_write_image_file(const char *buf, int len) {

#ifdef CONFIG_MBEDTLS
mbedtls_md5_context tctx;
mbedtls_md5_starts(&tctx);
mbedtls_md5_update(&tctx, (const unsigned char *)buf, len);
mbedtls_md5_finish(&tctx, img_md5);
mbedtls_md5_starts_ret(&tctx);
mbedtls_md5_update_ret(&tctx, (const unsigned char *)buf, len);
mbedtls_md5_finish_ret(&tctx, img_md5);
#endif

#ifdef CONFIG_POLARSSL
Expand Down
2 changes: 1 addition & 1 deletion player.c
Original file line number Diff line number Diff line change
Expand Up @@ -2622,7 +2622,7 @@ void player_volume_without_notification(double airplay_volume, rtsp_conn_info *c
}

} else {
int32_t max_db, min_db;
int32_t max_db =0, min_db = 0;
switch (volume_mode) {
case vol_hw_only:
max_db = hw_max_db;
Expand Down
38 changes: 19 additions & 19 deletions rtsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2039,18 +2039,18 @@ static int rtsp_auth(char **nonce, rtsp_message *req, rtsp_message *resp) {

#ifdef CONFIG_MBEDTLS
mbedtls_md5_context tctx;
mbedtls_md5_starts(&tctx);
mbedtls_md5_update(&tctx, (const unsigned char *)username, strlen(username));
mbedtls_md5_update(&tctx, (unsigned char *)":", 1);
mbedtls_md5_update(&tctx, (const unsigned char *)realm, strlen(realm));
mbedtls_md5_update(&tctx, (unsigned char *)":", 1);
mbedtls_md5_update(&tctx, (const unsigned char *)config.password, strlen(config.password));
mbedtls_md5_finish(&tctx, digest_urp);
mbedtls_md5_starts(&tctx);
mbedtls_md5_update(&tctx, (const unsigned char *)req->method, strlen(req->method));
mbedtls_md5_update(&tctx, (unsigned char *)":", 1);
mbedtls_md5_update(&tctx, (const unsigned char *)uri, strlen(uri));
mbedtls_md5_finish(&tctx, digest_mu);
mbedtls_md5_starts_ret(&tctx);
mbedtls_md5_update_ret(&tctx, (const unsigned char *)username, strlen(username));
mbedtls_md5_update_ret(&tctx, (unsigned char *)":", 1);
mbedtls_md5_update_ret(&tctx, (const unsigned char *)realm, strlen(realm));
mbedtls_md5_update_ret(&tctx, (unsigned char *)":", 1);
mbedtls_md5_update_ret(&tctx, (const unsigned char *)config.password, strlen(config.password));
mbedtls_md5_finish_ret(&tctx, digest_urp);
mbedtls_md5_starts_ret(&tctx);
mbedtls_md5_update_ret(&tctx, (const unsigned char *)req->method, strlen(req->method));
mbedtls_md5_update_ret(&tctx, (unsigned char *)":", 1);
mbedtls_md5_update_ret(&tctx, (const unsigned char *)uri, strlen(uri));
mbedtls_md5_finish_ret(&tctx, digest_mu);
#endif

#ifdef CONFIG_POLARSSL
Expand Down Expand Up @@ -2089,15 +2089,15 @@ static int rtsp_auth(char **nonce, rtsp_message *req, rtsp_message *resp) {
#endif

#ifdef CONFIG_MBEDTLS
mbedtls_md5_starts(&tctx);
mbedtls_md5_update(&tctx, buf, 32);
mbedtls_md5_update(&tctx, (unsigned char *)":", 1);
mbedtls_md5_update(&tctx, (const unsigned char *)*nonce, strlen(*nonce));
mbedtls_md5_update(&tctx, (unsigned char *)":", 1);
mbedtls_md5_starts_ret(&tctx);
mbedtls_md5_update_ret(&tctx, buf, 32);
mbedtls_md5_update_ret(&tctx, (unsigned char *)":", 1);
mbedtls_md5_update_ret(&tctx, (const unsigned char *)*nonce, strlen(*nonce));
mbedtls_md5_update_ret(&tctx, (unsigned char *)":", 1);
for (i = 0; i < 16; i++)
snprintf((char *)buf + 2 * i, 3, "%02x", digest_mu[i]);
mbedtls_md5_update(&tctx, buf, 32);
mbedtls_md5_finish(&tctx, digest_total);
mbedtls_md5_update_ret(&tctx, buf, 32);
mbedtls_md5_finish_ret(&tctx, digest_total);
#endif

#ifdef CONFIG_POLARSSL
Expand Down
6 changes: 3 additions & 3 deletions shairport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1610,9 +1610,9 @@ int main(int argc, char **argv) {

#ifdef CONFIG_MBEDTLS
mbedtls_md5_context tctx;
mbedtls_md5_starts(&tctx);
mbedtls_md5_update(&tctx, (unsigned char *)config.service_name, strlen(config.service_name));
mbedtls_md5_finish(&tctx, ap_md5);
mbedtls_md5_starts_ret(&tctx);
mbedtls_md5_update_ret(&tctx, (unsigned char *)config.service_name, strlen(config.service_name));
mbedtls_md5_finish_ret(&tctx, ap_md5);
#endif

#ifdef CONFIG_POLARSSL
Expand Down

0 comments on commit cf03983

Please sign in to comment.