Adds additional casts to calloc calls
Casts added to allow compilation of the library as C++
diff --git a/library/asn1parse.c b/library/asn1parse.c
index e59d250..ffa2f52 100644
--- a/library/asn1parse.c
+++ b/library/asn1parse.c
@@ -269,7 +269,8 @@
/* Allocate and assign next pointer */
if( *p < end )
{
- cur->next = mbedtls_calloc( 1, sizeof( mbedtls_asn1_sequence ) );
+ cur->next = (mbedtls_asn1_sequence*)mbedtls_calloc( 1,
+ sizeof( mbedtls_asn1_sequence ) );
if( cur->next == NULL )
return( MBEDTLS_ERR_ASN1_ALLOC_FAILED );
diff --git a/library/asn1write.c b/library/asn1write.c
index 00ed73c..027c858 100644
--- a/library/asn1write.c
+++ b/library/asn1write.c
@@ -312,7 +312,9 @@
{
// Add new entry if not present yet based on OID
//
- if( ( cur = mbedtls_calloc( 1, sizeof(mbedtls_asn1_named_data) ) ) == NULL )
+ cur = (mbedtls_asn1_named_data*)mbedtls_calloc( 1,
+ sizeof(mbedtls_asn1_named_data) );
+ if( cur == NULL )
return( NULL );
cur->oid.len = oid_len;
diff --git a/library/bignum.c b/library/bignum.c
index 4536a3b..4c99e04 100644
--- a/library/bignum.c
+++ b/library/bignum.c
@@ -120,7 +120,7 @@
if( X->n < nblimbs )
{
- if( ( p = mbedtls_calloc( nblimbs, ciL ) ) == NULL )
+ if( ( p = (mbedtls_mpi_uint*)mbedtls_calloc( nblimbs, ciL ) ) == NULL )
return( MBEDTLS_ERR_MPI_ALLOC_FAILED );
if( X->p != NULL )
@@ -158,7 +158,7 @@
if( i < nblimbs )
i = nblimbs;
- if( ( p = mbedtls_calloc( i, ciL ) ) == NULL )
+ if( ( p = (mbedtls_mpi_uint*)mbedtls_calloc( i, ciL ) ) == NULL )
return( MBEDTLS_ERR_MPI_ALLOC_FAILED );
if( X->p != NULL )