programs_dh_client/server: Changed mdlen type to unsigned integer.

Signed-off-by: Minos Galanakis <minos.galanakis@arm.com>
This commit is contained in:
Minos Galanakis 2024-01-16 13:32:31 +00:00
parent 7c8448842d
commit db8915287e
2 changed files with 6 additions and 4 deletions

View file

@ -59,7 +59,8 @@ int main(void)
int ret = 1; int ret = 1;
int exit_code = MBEDTLS_EXIT_FAILURE; int exit_code = MBEDTLS_EXIT_FAILURE;
size_t n, buflen, mdlen; unsigned int mdlen;
size_t n, buflen;
mbedtls_net_context server_fd; mbedtls_net_context server_fd;
unsigned char *p, *end; unsigned char *p, *end;
@ -186,7 +187,7 @@ int main(void)
goto exit; goto exit;
} }
mdlen = mbedtls_md_get_size(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256)); mdlen = (unsigned int) mbedtls_md_get_size(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256));
if (mdlen == 0) { if (mdlen == 0) {
mbedtls_printf(" failed\n ! Invalid digest type\n\n"); mbedtls_printf(" failed\n ! Invalid digest type\n\n");
goto exit; goto exit;

View file

@ -51,7 +51,8 @@ int main(void)
int ret = 1; int ret = 1;
int exit_code = MBEDTLS_EXIT_FAILURE; int exit_code = MBEDTLS_EXIT_FAILURE;
size_t n, buflen, mdlen; unsigned int mdlen;
size_t n, buflen;
mbedtls_net_context listen_fd, client_fd; mbedtls_net_context listen_fd, client_fd;
unsigned char buf[2048]; unsigned char buf[2048];
@ -185,7 +186,7 @@ int main(void)
* 5. Sign the parameters and send them * 5. Sign the parameters and send them
*/ */
mdlen = mbedtls_md_get_size(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256)); mdlen = (unsigned int) mbedtls_md_get_size(mbedtls_md_info_from_type(MBEDTLS_MD_SHA256));
if (mdlen == 0) { if (mdlen == 0) {
mbedtls_printf(" failed\n ! Invalid digest type\n\n"); mbedtls_printf(" failed\n ! Invalid digest type\n\n");
goto exit; goto exit;