mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-25 16:05:43 +01:00
Prevent possible alignment warnings on casting from char * to 'aligned *'
This commit is contained in:
parent
677377f472
commit
45a2c8d99a
@ -3,6 +3,7 @@ PolarSSL ChangeLog (Sorted per branch, date)
|
||||
= PolarSSL 1.3 branch
|
||||
Bugfix
|
||||
* Server does not send out extensions not advertised by client
|
||||
* Prevent possible alignment warnings on casting from char * to 'aligned *'
|
||||
|
||||
= PolarSSL 1.3.1 released on 2013-10-15
|
||||
Features
|
||||
|
@ -47,9 +47,22 @@
|
||||
* Macro to generate an internal function for oid_XXX_from_asn1() (used by
|
||||
* the other functions)
|
||||
*/
|
||||
#define FN_OID_TYPED_FROM_ASN1( TYPE_T, NAME, LIST ) \
|
||||
static const TYPE_T * oid_ ## NAME ## _from_asn1( const asn1_buf *oid ) \
|
||||
{ return (const TYPE_T *) oid_descriptor_from_buf(LIST, sizeof(TYPE_T), oid->p, oid->len ); }
|
||||
#define FN_OID_TYPED_FROM_ASN1( TYPE_T, NAME, LIST ) \
|
||||
static const TYPE_T * oid_ ## NAME ## _from_asn1( const asn1_buf *oid ) \
|
||||
{ \
|
||||
const TYPE_T *p = LIST; \
|
||||
const oid_descriptor_t *cur = (const oid_descriptor_t *) p; \
|
||||
if( p == NULL || oid == NULL ) return( NULL ); \
|
||||
while( cur->asn1 != NULL ) { \
|
||||
if( cur->asn1_len == oid->len && \
|
||||
memcmp( cur->asn1, oid->p, oid->len ) == 0 ) { \
|
||||
return( p ); \
|
||||
} \
|
||||
p++; \
|
||||
cur = (const oid_descriptor_t *) p; \
|
||||
} \
|
||||
return( NULL ); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Macro to generate a function for retrieving a single attribute from the
|
||||
@ -132,34 +145,6 @@ int FN_NAME( ATTR1_TYPE ATTR1, ATTR2_TYPE ATTR2, const char **oid , \
|
||||
return( POLARSSL_ERR_OID_NOT_FOUND ); \
|
||||
}
|
||||
|
||||
/*
|
||||
* Core generic function
|
||||
*/
|
||||
static const oid_descriptor_t *oid_descriptor_from_buf( const void *struct_set,
|
||||
size_t struct_size, const unsigned char *oid, size_t len )
|
||||
{
|
||||
const unsigned char *p = (const unsigned char *) struct_set;
|
||||
const oid_descriptor_t *cur;
|
||||
|
||||
if( struct_set == NULL || oid == NULL )
|
||||
return( NULL );
|
||||
|
||||
cur = (const oid_descriptor_t *) p;
|
||||
while( cur->asn1 != NULL )
|
||||
{
|
||||
if( cur->asn1_len == len &&
|
||||
memcmp( cur->asn1, oid, len ) == 0 )
|
||||
{
|
||||
return( cur );
|
||||
}
|
||||
|
||||
p += struct_size;
|
||||
cur = (const oid_descriptor_t *) p;
|
||||
}
|
||||
|
||||
return( NULL );
|
||||
}
|
||||
|
||||
/*
|
||||
* For X520 attribute types
|
||||
*/
|
||||
|
@ -74,8 +74,6 @@ static int ssl_save_session( const ssl_session *session,
|
||||
left -= sizeof( ssl_session );
|
||||
|
||||
#if defined(POLARSSL_X509_CRT_PARSE_C)
|
||||
((ssl_session *) buf)->peer_cert = NULL;
|
||||
|
||||
if( session->peer_cert == NULL )
|
||||
cert_len = 0;
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user