Fix MSVC 64-bit warnings
"conversion from size_t to int, possible loss of data"
diff --git a/include/mbedtls/x509_crt.h b/include/mbedtls/x509_crt.h
index 6831812..a168d76 100644
--- a/include/mbedtls/x509_crt.h
+++ b/include/mbedtls/x509_crt.h
@@ -161,7 +161,7 @@
typedef struct
{
mbedtls_x509_crt_verify_chain_item items[MBEDTLS_X509_MAX_VERIFY_CHAIN_SIZE];
- size_t len;
+ unsigned len;
} mbedtls_x509_crt_verify_chain;
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
diff --git a/library/x509_crt.c b/library/x509_crt.c
index 586ec83..b3fc6e4 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -1983,8 +1983,8 @@
mbedtls_x509_crt **r_parent,
int *r_signature_is_good,
int top,
- int path_cnt,
- int self_cnt,
+ unsigned path_cnt,
+ unsigned self_cnt,
mbedtls_x509_crt_restart_ctx *rs_ctx )
{
int ret;
@@ -2021,7 +2021,7 @@
/* +1 because stored max_pathlen is 1 higher that the actual value */
if( parent->max_pathlen > 0 &&
- parent->max_pathlen < 1 + path_cnt - self_cnt )
+ (size_t) parent->max_pathlen < 1 + path_cnt - self_cnt )
{
continue;
}
@@ -2103,8 +2103,8 @@
mbedtls_x509_crt **parent,
int *parent_is_trusted,
int *signature_is_good,
- int path_cnt,
- int self_cnt,
+ unsigned path_cnt,
+ unsigned self_cnt,
mbedtls_x509_crt_restart_ctx *rs_ctx )
{
int ret;
@@ -2246,7 +2246,7 @@
int parent_is_trusted;
int child_is_trusted;
int signature_is_good;
- int self_cnt;
+ unsigned self_cnt;
#if defined(MBEDTLS_ECDSA_C) && defined(MBEDTLS_ECP_RESTARTABLE)
/* resume if we had an operation in progress */
@@ -2445,7 +2445,7 @@
void *p_vrfy )
{
int ret;
- size_t i;
+ unsigned i;
uint32_t cur_flags;
const mbedtls_x509_crt_verify_chain_item *cur;
@@ -2455,7 +2455,7 @@
cur_flags = cur->flags;
if( NULL != f_vrfy )
- if( ( ret = f_vrfy( p_vrfy, cur->crt, i-1, &cur_flags ) ) != 0 )
+ if( ( ret = f_vrfy( p_vrfy, cur->crt, (int) i-1, &cur_flags ) ) != 0 )
return( ret );
*flags |= cur_flags;