mirror of
https://github.com/libretro/RetroArch
synced 2025-03-02 19:13:34 +00:00
(mbedtls) should now be CXX_BUILD compatible
This commit is contained in:
parent
3580db3ebe
commit
ae7353993a
23
deps/mbedtls/cipher.c
vendored
23
deps/mbedtls/cipher.c
vendored
@ -831,17 +831,20 @@ int mbedtls_cipher_auth_encrypt( mbedtls_cipher_context_t *ctx,
|
||||
if( MBEDTLS_MODE_GCM == ctx->cipher_info->mode )
|
||||
{
|
||||
*olen = ilen;
|
||||
return( mbedtls_gcm_crypt_and_tag( ctx->cipher_ctx, MBEDTLS_GCM_ENCRYPT, ilen,
|
||||
iv, iv_len, ad, ad_len, input, output,
|
||||
tag_len, tag ) );
|
||||
return( mbedtls_gcm_crypt_and_tag(
|
||||
(mbedtls_gcm_context*)ctx->cipher_ctx,
|
||||
MBEDTLS_GCM_ENCRYPT, ilen,
|
||||
iv, iv_len, ad, ad_len, input, output,
|
||||
tag_len, tag ) );
|
||||
}
|
||||
#endif /* MBEDTLS_GCM_C */
|
||||
#if defined(MBEDTLS_CCM_C)
|
||||
if( MBEDTLS_MODE_CCM == ctx->cipher_info->mode )
|
||||
{
|
||||
*olen = ilen;
|
||||
return( mbedtls_ccm_encrypt_and_tag( ctx->cipher_ctx, ilen,
|
||||
iv, iv_len, ad, ad_len, input, output,
|
||||
return( mbedtls_ccm_encrypt_and_tag(
|
||||
(mbedtls_ccm_context*)ctx->cipher_ctx, ilen,
|
||||
iv, iv_len, ad, ad_len, input, output,
|
||||
tag, tag_len ) );
|
||||
}
|
||||
#endif /* MBEDTLS_CCM_C */
|
||||
@ -865,9 +868,10 @@ int mbedtls_cipher_auth_decrypt( mbedtls_cipher_context_t *ctx,
|
||||
int ret;
|
||||
|
||||
*olen = ilen;
|
||||
ret = mbedtls_gcm_auth_decrypt( ctx->cipher_ctx, ilen,
|
||||
iv, iv_len, ad, ad_len,
|
||||
tag, tag_len, input, output );
|
||||
ret = mbedtls_gcm_auth_decrypt(
|
||||
(mbedtls_gcm_context*)ctx->cipher_ctx, ilen,
|
||||
iv, iv_len, ad, ad_len,
|
||||
tag, tag_len, input, output );
|
||||
|
||||
if( ret == MBEDTLS_ERR_GCM_AUTH_FAILED )
|
||||
ret = MBEDTLS_ERR_CIPHER_AUTH_FAILED;
|
||||
@ -881,7 +885,8 @@ int mbedtls_cipher_auth_decrypt( mbedtls_cipher_context_t *ctx,
|
||||
int ret;
|
||||
|
||||
*olen = ilen;
|
||||
ret = mbedtls_ccm_auth_decrypt( ctx->cipher_ctx, ilen,
|
||||
ret = mbedtls_ccm_auth_decrypt(
|
||||
(mbedtls_ccm_context*)ctx->cipher_ctx, ilen,
|
||||
iv, iv_len, ad, ad_len,
|
||||
input, output, tag, tag_len );
|
||||
|
||||
|
4
deps/mbedtls/net_sockets.c
vendored
4
deps/mbedtls/net_sockets.c
vendored
@ -323,7 +323,7 @@ int mbedtls_net_accept( mbedtls_net_context *bind_ctx,
|
||||
|
||||
/* Is this a TCP or UDP socket? */
|
||||
if( getsockopt( bind_ctx->fd, SOL_SOCKET, SO_TYPE,
|
||||
(void *) &type, &type_len ) != 0 ||
|
||||
(char *) &type, &type_len ) != 0 ||
|
||||
( type != SOCK_STREAM && type != SOCK_DGRAM ) )
|
||||
{
|
||||
return( MBEDTLS_ERR_NET_ACCEPT_FAILED );
|
||||
@ -488,7 +488,7 @@ int mbedtls_net_recv( void *ctx, unsigned char *buf, size_t len )
|
||||
|
||||
if( ret < 0 )
|
||||
{
|
||||
if( net_would_block( ctx ) != 0 )
|
||||
if( net_would_block((const mbedtls_net_context*)ctx ) != 0 )
|
||||
return( MBEDTLS_ERR_SSL_WANT_READ );
|
||||
|
||||
#if ( defined(_WIN32) || defined(_WIN32_WCE) ) && !defined(EFIX64) && \
|
||||
|
8
deps/mbedtls/pk_wrap.c
vendored
8
deps/mbedtls/pk_wrap.c
vendored
@ -219,7 +219,8 @@ static int eckey_verify_wrap( void *ctx, mbedtls_md_type_t md_alg,
|
||||
|
||||
mbedtls_ecdsa_init( &ecdsa );
|
||||
|
||||
if( ( ret = mbedtls_ecdsa_from_keypair( &ecdsa, ctx ) ) == 0 )
|
||||
if( ( ret = mbedtls_ecdsa_from_keypair( &ecdsa,
|
||||
(const mbedtls_ecp_keypair*)ctx ) ) == 0 )
|
||||
ret = ecdsa_verify_wrap( &ecdsa, md_alg, hash, hash_len, sig, sig_len );
|
||||
|
||||
mbedtls_ecdsa_free( &ecdsa );
|
||||
@ -237,7 +238,8 @@ static int eckey_sign_wrap( void *ctx, mbedtls_md_type_t md_alg,
|
||||
|
||||
mbedtls_ecdsa_init( &ecdsa );
|
||||
|
||||
if( ( ret = mbedtls_ecdsa_from_keypair( &ecdsa, ctx ) ) == 0 )
|
||||
if( ( ret = mbedtls_ecdsa_from_keypair( &ecdsa,
|
||||
(const mbedtls_ecp_keypair*)ctx ) ) == 0 )
|
||||
ret = ecdsa_sign_wrap( &ecdsa, md_alg, hash, hash_len, sig, sig_len,
|
||||
f_rng, p_rng );
|
||||
|
||||
@ -259,7 +261,7 @@ static void *eckey_alloc_wrap( void )
|
||||
void *ctx = calloc( 1, sizeof( mbedtls_ecp_keypair ) );
|
||||
|
||||
if( ctx != NULL )
|
||||
mbedtls_ecp_keypair_init( ctx );
|
||||
mbedtls_ecp_keypair_init((mbedtls_ecp_keypair*)ctx);
|
||||
|
||||
return( ctx );
|
||||
}
|
||||
|
2
deps/mbedtls/pkparse.c
vendored
2
deps/mbedtls/pkparse.c
vendored
@ -86,7 +86,7 @@ int mbedtls_pk_load_file( const char *path, unsigned char **buf, size_t *n )
|
||||
*n = (size_t) size;
|
||||
|
||||
if( *n + 1 == 0 ||
|
||||
( *buf = calloc( 1, *n + 1 ) ) == NULL )
|
||||
( *buf = (unsigned char*)calloc( 1, *n + 1 ) ) == NULL )
|
||||
{
|
||||
fclose( f );
|
||||
return( MBEDTLS_ERR_PK_ALLOC_FAILED );
|
||||
|
8
deps/mbedtls/rsa.c
vendored
8
deps/mbedtls/rsa.c
vendored
@ -1198,12 +1198,12 @@ int mbedtls_rsa_rsassa_pkcs1_v15_sign( mbedtls_rsa_context *ctx,
|
||||
* In order to prevent Lenstra's attack, make the signature in a
|
||||
* temporary buffer and check it before returning it.
|
||||
*/
|
||||
sig_try = calloc( 1, ctx->len );
|
||||
if( sig_try == NULL )
|
||||
sig_try = (unsigned char*)calloc( 1, ctx->len );
|
||||
if (!sig_try)
|
||||
return( MBEDTLS_ERR_MPI_ALLOC_FAILED );
|
||||
|
||||
verif = calloc( 1, ctx->len );
|
||||
if( verif == NULL )
|
||||
verif = (unsigned char*)calloc( 1, ctx->len );
|
||||
if (!verif)
|
||||
{
|
||||
free( sig_try );
|
||||
return( MBEDTLS_ERR_MPI_ALLOC_FAILED );
|
||||
|
11
deps/mbedtls/ssl_cache.c
vendored
11
deps/mbedtls/ssl_cache.c
vendored
@ -99,7 +99,7 @@ int mbedtls_ssl_cache_get( void *data, mbedtls_ssl_session *session )
|
||||
*/
|
||||
if( entry->peer_cert.p != NULL )
|
||||
{
|
||||
if( ( session->peer_cert = calloc( 1,
|
||||
if( ( session->peer_cert = (mbedtls_x509_crt*)calloc( 1,
|
||||
sizeof(mbedtls_x509_crt) ) ) == NULL )
|
||||
{
|
||||
ret = 1;
|
||||
@ -218,8 +218,10 @@ int mbedtls_ssl_cache_set( void *data, const mbedtls_ssl_session *session )
|
||||
/*
|
||||
* max_entries not reached, create new entry
|
||||
*/
|
||||
cur = calloc( 1, sizeof(mbedtls_ssl_cache_entry) );
|
||||
if( cur == NULL )
|
||||
cur = (mbedtls_ssl_cache_entry*)
|
||||
calloc( 1, sizeof(mbedtls_ssl_cache_entry) );
|
||||
|
||||
if (!cur)
|
||||
{
|
||||
ret = 1;
|
||||
goto exit;
|
||||
@ -253,7 +255,8 @@ int mbedtls_ssl_cache_set( void *data, const mbedtls_ssl_session *session )
|
||||
*/
|
||||
if( session->peer_cert != NULL )
|
||||
{
|
||||
cur->peer_cert.p = calloc( 1, session->peer_cert->raw.len );
|
||||
cur->peer_cert.p = (unsigned char*)
|
||||
calloc( 1, session->peer_cert->raw.len );
|
||||
if( cur->peer_cert.p == NULL )
|
||||
{
|
||||
ret = 1;
|
||||
|
4
deps/mbedtls/ssl_cli.c
vendored
4
deps/mbedtls/ssl_cli.c
vendored
@ -1338,7 +1338,7 @@ static int ssl_parse_hello_verify_request( mbedtls_ssl_context *ssl )
|
||||
|
||||
free( ssl->handshake->verify_cookie );
|
||||
|
||||
ssl->handshake->verify_cookie = calloc( 1, cookie_len );
|
||||
ssl->handshake->verify_cookie = (unsigned char*)calloc( 1, cookie_len );
|
||||
if( ssl->handshake->verify_cookie == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "alloc failed (%d bytes)", cookie_len ) );
|
||||
@ -3217,7 +3217,7 @@ static int ssl_parse_new_session_ticket( mbedtls_ssl_context *ssl )
|
||||
ssl->session_negotiate->ticket = NULL;
|
||||
ssl->session_negotiate->ticket_len = 0;
|
||||
|
||||
if( ( ticket = calloc( 1, ticket_len ) ) == NULL )
|
||||
if( ( ticket = (unsigned char*)calloc( 1, ticket_len ) ) == NULL )
|
||||
{
|
||||
MBEDTLS_SSL_DEBUG_MSG( 1, ( "ticket alloc failed" ) );
|
||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||
|
5
deps/mbedtls/ssl_srv.c
vendored
5
deps/mbedtls/ssl_srv.c
vendored
@ -60,7 +60,7 @@ int mbedtls_ssl_set_client_transport_id( mbedtls_ssl_context *ssl,
|
||||
|
||||
free( ssl->cli_id );
|
||||
|
||||
if( ( ssl->cli_id = calloc( 1, ilen ) ) == NULL )
|
||||
if( ( ssl->cli_id = (unsigned char*)calloc( 1, ilen ) ) == NULL )
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
|
||||
memcpy( ssl->cli_id, info, ilen );
|
||||
@ -264,7 +264,8 @@ static int ssl_parse_supported_elliptic_curves( mbedtls_ssl_context *ssl,
|
||||
if( our_size > MBEDTLS_ECP_DP_MAX )
|
||||
our_size = MBEDTLS_ECP_DP_MAX;
|
||||
|
||||
if( ( curves = calloc( our_size, sizeof( *curves ) ) ) == NULL )
|
||||
if( ( curves = (const mbedtls_ecp_curve_info**)
|
||||
calloc( our_size, sizeof( *curves ) ) ) == NULL )
|
||||
{
|
||||
mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL,
|
||||
MBEDTLS_SSL_ALERT_MSG_INTERNAL_ERROR );
|
||||
|
26
deps/mbedtls/ssl_ticket.c
vendored
26
deps/mbedtls/ssl_ticket.c
vendored
@ -234,7 +234,7 @@ static int ssl_load_session( mbedtls_ssl_session *session,
|
||||
if( p + cert_len > end )
|
||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||
|
||||
session->peer_cert = calloc( 1, sizeof( mbedtls_x509_crt ) );
|
||||
session->peer_cert = (mbedtls_x509_crt*)calloc( 1, sizeof( mbedtls_x509_crt ) );
|
||||
|
||||
if( session->peer_cert == NULL )
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
@ -281,14 +281,14 @@ int mbedtls_ssl_ticket_write( void *p_ticket,
|
||||
uint32_t *ticket_lifetime )
|
||||
{
|
||||
int ret;
|
||||
mbedtls_ssl_ticket_context *ctx = p_ticket;
|
||||
mbedtls_ssl_ticket_key *key;
|
||||
unsigned char *key_name = start;
|
||||
unsigned char *iv = start + 4;
|
||||
unsigned char *state_len_bytes = iv + 12;
|
||||
unsigned char *state = state_len_bytes + 2;
|
||||
unsigned char *tag;
|
||||
size_t clear_len, ciph_len;
|
||||
mbedtls_ssl_ticket_key *key = NULL;
|
||||
mbedtls_ssl_ticket_context *ctx = (mbedtls_ssl_ticket_context*)p_ticket;
|
||||
unsigned char *key_name = start;
|
||||
unsigned char *iv = start + 4;
|
||||
unsigned char *state_len_bytes = iv + 12;
|
||||
unsigned char *state = state_len_bytes + 2;
|
||||
|
||||
*tlen = 0;
|
||||
|
||||
@ -377,14 +377,14 @@ int mbedtls_ssl_ticket_parse( void *p_ticket,
|
||||
size_t len )
|
||||
{
|
||||
int ret;
|
||||
mbedtls_ssl_ticket_context *ctx = p_ticket;
|
||||
mbedtls_ssl_ticket_key *key;
|
||||
unsigned char *key_name = buf;
|
||||
unsigned char *iv = buf + 4;
|
||||
unsigned char *enc_len_p = iv + 12;
|
||||
unsigned char *ticket = enc_len_p + 2;
|
||||
unsigned char *tag;
|
||||
size_t enc_len, clear_len;
|
||||
mbedtls_ssl_ticket_key *key = NULL;
|
||||
mbedtls_ssl_ticket_context *ctx = (mbedtls_ssl_ticket_context*)p_ticket;
|
||||
unsigned char *key_name = buf;
|
||||
unsigned char *iv = buf + 4;
|
||||
unsigned char *enc_len_p = iv + 12;
|
||||
unsigned char *ticket = enc_len_p + 2;
|
||||
|
||||
if( ctx == NULL || ctx->f_rng == NULL )
|
||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||
|
14
deps/mbedtls/x509.c
vendored
14
deps/mbedtls/x509.c
vendored
@ -449,7 +449,8 @@ int mbedtls_x509_get_name( unsigned char **p, const unsigned char *end,
|
||||
/* Mark this item as being no the only one in a set */
|
||||
cur->next_merged = 1;
|
||||
|
||||
cur->next = calloc( 1, sizeof( mbedtls_x509_name ) );
|
||||
cur->next = (mbedtls_asn1_named_data*)
|
||||
calloc( 1, sizeof( mbedtls_x509_name ) );
|
||||
|
||||
if( cur->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
@ -463,7 +464,8 @@ int mbedtls_x509_get_name( unsigned char **p, const unsigned char *end,
|
||||
if( *p == end )
|
||||
return( 0 );
|
||||
|
||||
cur->next = calloc( 1, sizeof( mbedtls_x509_name ) );
|
||||
cur->next = (mbedtls_asn1_named_data*)
|
||||
calloc( 1, sizeof( mbedtls_x509_name ) );
|
||||
|
||||
if( cur->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
@ -656,10 +658,10 @@ int mbedtls_x509_get_sig_alg( const mbedtls_x509_buf *sig_oid, const mbedtls_x50
|
||||
#if defined(MBEDTLS_X509_RSASSA_PSS_SUPPORT)
|
||||
if( *pk_alg == MBEDTLS_PK_RSASSA_PSS )
|
||||
{
|
||||
mbedtls_pk_rsassa_pss_options *pss_opts;
|
||||
|
||||
pss_opts = calloc( 1, sizeof( mbedtls_pk_rsassa_pss_options ) );
|
||||
if( pss_opts == NULL )
|
||||
mbedtls_pk_rsassa_pss_options *pss_opts =
|
||||
(mbedtls_pk_rsassa_pss_options *)
|
||||
calloc( 1, sizeof( mbedtls_pk_rsassa_pss_options ) );
|
||||
if (!pss_opts)
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
ret = mbedtls_x509_get_rsassa_pss_params( sig_params,
|
||||
|
6
deps/mbedtls/x509_crl.c
vendored
6
deps/mbedtls/x509_crl.c
vendored
@ -227,7 +227,7 @@ static int x509_get_entries( unsigned char **p,
|
||||
|
||||
if( *p < end )
|
||||
{
|
||||
cur_entry->next = calloc( 1, sizeof( mbedtls_x509_crl_entry ) );
|
||||
cur_entry->next = (mbedtls_x509_crl_entry*)calloc( 1, sizeof( mbedtls_x509_crl_entry ) );
|
||||
|
||||
if( cur_entry->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
@ -269,7 +269,7 @@ int mbedtls_x509_crl_parse_der( mbedtls_x509_crl *chain,
|
||||
|
||||
if( crl->version != 0 && crl->next == NULL )
|
||||
{
|
||||
crl->next = calloc( 1, sizeof( mbedtls_x509_crl ) );
|
||||
crl->next = (mbedtls_x509_crl*)calloc( 1, sizeof( mbedtls_x509_crl ) );
|
||||
|
||||
if( crl->next == NULL )
|
||||
{
|
||||
@ -284,7 +284,7 @@ int mbedtls_x509_crl_parse_der( mbedtls_x509_crl *chain,
|
||||
/*
|
||||
* Copy raw DER-encoded CRL
|
||||
*/
|
||||
if( ( p = calloc( 1, buflen ) ) == NULL )
|
||||
if( ( p = (unsigned char*)calloc( 1, buflen ) ) == NULL )
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
memcpy( p, buf, buflen );
|
||||
|
9
deps/mbedtls/x509_crt.c
vendored
9
deps/mbedtls/x509_crt.c
vendored
@ -480,7 +480,8 @@ static int x509_get_subject_alt_name( unsigned char **p,
|
||||
if( cur->next != NULL )
|
||||
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS );
|
||||
|
||||
cur->next = calloc( 1, sizeof( mbedtls_asn1_sequence ) );
|
||||
cur->next = (mbedtls_asn1_sequence*)
|
||||
calloc( 1, sizeof( mbedtls_asn1_sequence ) );
|
||||
|
||||
if( cur->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_INVALID_EXTENSIONS +
|
||||
@ -698,7 +699,7 @@ static int x509_crt_parse_der_core( mbedtls_x509_crt *crt, const unsigned char *
|
||||
|
||||
/* Create and populate a new buffer for the raw field */
|
||||
crt->raw.len = crt_end - buf;
|
||||
crt->raw.p = p = calloc( 1, crt->raw.len );
|
||||
crt->raw.p = p = (unsigned char*)calloc( 1, crt->raw.len );
|
||||
if( p == NULL )
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
@ -932,7 +933,7 @@ int mbedtls_x509_crt_parse_der( mbedtls_x509_crt *chain, const unsigned char *bu
|
||||
*/
|
||||
if( crt->version != 0 && !crt->next)
|
||||
{
|
||||
crt->next = calloc( 1, sizeof( mbedtls_x509_crt ) );
|
||||
crt->next = (mbedtls_x509_crt*)calloc( 1, sizeof( mbedtls_x509_crt ) );
|
||||
|
||||
if( crt->next == NULL )
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
@ -1719,7 +1720,7 @@ static int x509_memcasecmp( const void *s1, const void *s2, size_t len )
|
||||
{
|
||||
size_t i;
|
||||
unsigned char diff;
|
||||
const unsigned char *n1 = s1, *n2 = s2;
|
||||
const unsigned char *n1 = (const unsigned char*)s1, *n2 = (const unsigned char*)s2;
|
||||
|
||||
for( i = 0; i < len; i++ )
|
||||
{
|
||||
|
4
deps/mbedtls/x509_csr.c
vendored
4
deps/mbedtls/x509_csr.c
vendored
@ -102,9 +102,9 @@ int mbedtls_x509_csr_parse_der( mbedtls_x509_csr *csr,
|
||||
/*
|
||||
* first copy the raw DER data
|
||||
*/
|
||||
p = calloc( 1, len = buflen );
|
||||
p = (unsigned char*)calloc( 1, len = buflen );
|
||||
|
||||
if( p == NULL )
|
||||
if (!p)
|
||||
return( MBEDTLS_ERR_X509_ALLOC_FAILED );
|
||||
|
||||
memcpy( p, buf, buflen );
|
||||
|
@ -31,7 +31,6 @@ HAVE_SSL=auto # SSL/mbedtls support
|
||||
C89_SSL=no
|
||||
HAVE_BUILTINMBEDTLS=auto # Bake in the mbedtls library
|
||||
C89_BUILTINMBEDTLS=no
|
||||
CXX_BUILTINMBEDTLS=no
|
||||
HAVE_OVERLAY=yes # Overlay support
|
||||
HAVE_VIDEO_LAYOUT=yes # Layout support
|
||||
HAVE_DYNAMIC=yes # Dynamic loading of libretro library
|
||||
|
Loading…
x
Reference in New Issue
Block a user