mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Update external polarssl to 1.3.8
There were some fixes back on March 13th, 2014 for fixing compiling on MIPS64. Also some fixes on June 25th, 2014 for SPARC64 fixes. Probably more things, but those are what I care about.
This commit is contained in:
90
Externals/polarssl/library/oid.c
vendored
90
Externals/polarssl/library/oid.c
vendored
@ -3,7 +3,7 @@
|
||||
*
|
||||
* \brief Object Identifier (OID) database
|
||||
*
|
||||
* Copyright (C) 2006-2013, Brainspark B.V.
|
||||
* Copyright (C) 2006-2014, Brainspark B.V.
|
||||
*
|
||||
* This file is part of PolarSSL (http://www.polarssl.org)
|
||||
* Lead Maintainer: Paul Bakker <polarssl_maintainer at polarssl.org>
|
||||
@ -25,7 +25,11 @@
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#if !defined(POLARSSL_CONFIG_FILE)
|
||||
#include "polarssl/config.h"
|
||||
#else
|
||||
#include POLARSSL_CONFIG_FILE
|
||||
#endif
|
||||
|
||||
#if defined(POLARSSL_OID_C)
|
||||
|
||||
@ -72,7 +76,7 @@ static const TYPE_T * oid_ ## NAME ## _from_asn1( const asn1_buf *oid ) \
|
||||
int FN_NAME( const asn1_buf *oid, ATTR1_TYPE * ATTR1 ) \
|
||||
{ \
|
||||
const TYPE_T *data = oid_ ## TYPE_NAME ## _from_asn1( oid ); \
|
||||
if( data == NULL ) return ( POLARSSL_ERR_OID_NOT_FOUND ); \
|
||||
if( data == NULL ) return( POLARSSL_ERR_OID_NOT_FOUND ); \
|
||||
*ATTR1 = data->descriptor.ATTR1; \
|
||||
return( 0 ); \
|
||||
}
|
||||
@ -85,7 +89,7 @@ int FN_NAME( const asn1_buf *oid, ATTR1_TYPE * ATTR1 ) \
|
||||
int FN_NAME( const asn1_buf *oid, ATTR1_TYPE * ATTR1 ) \
|
||||
{ \
|
||||
const TYPE_T *data = oid_ ## TYPE_NAME ## _from_asn1( oid ); \
|
||||
if( data == NULL ) return ( POLARSSL_ERR_OID_NOT_FOUND ); \
|
||||
if( data == NULL ) return( POLARSSL_ERR_OID_NOT_FOUND ); \
|
||||
*ATTR1 = data->ATTR1; \
|
||||
return( 0 ); \
|
||||
}
|
||||
@ -99,7 +103,7 @@ int FN_NAME( const asn1_buf *oid, ATTR1_TYPE * ATTR1 ) \
|
||||
int FN_NAME( const asn1_buf *oid, ATTR1_TYPE * ATTR1, ATTR2_TYPE * ATTR2 ) \
|
||||
{ \
|
||||
const TYPE_T *data = oid_ ## TYPE_NAME ## _from_asn1( oid ); \
|
||||
if( data == NULL ) return ( POLARSSL_ERR_OID_NOT_FOUND ); \
|
||||
if( data == NULL ) return( POLARSSL_ERR_OID_NOT_FOUND ); \
|
||||
*ATTR1 = data->ATTR1; \
|
||||
*ATTR2 = data->ATTR2; \
|
||||
return( 0 ); \
|
||||
@ -195,6 +199,38 @@ static const oid_x520_attr_t oid_x520_attr_type[] =
|
||||
{ ADD_LEN( OID_AT_POSTAL_CODE ), "id-at-postalCode", "Postal code" },
|
||||
"postalCode",
|
||||
},
|
||||
{
|
||||
{ ADD_LEN( OID_AT_SUR_NAME ), "id-at-surName", "Surname" },
|
||||
"SN",
|
||||
},
|
||||
{
|
||||
{ ADD_LEN( OID_AT_GIVEN_NAME ), "id-at-givenName", "Given name" },
|
||||
"GN",
|
||||
},
|
||||
{
|
||||
{ ADD_LEN( OID_AT_INITIALS ), "id-at-initials", "Initials" },
|
||||
"initials",
|
||||
},
|
||||
{
|
||||
{ ADD_LEN( OID_AT_GENERATION_QUALIFIER ), "id-at-generationQualifier", "Generation qualifier" },
|
||||
"generationQualifier",
|
||||
},
|
||||
{
|
||||
{ ADD_LEN( OID_AT_TITLE ), "id-at-title", "Title" },
|
||||
"title",
|
||||
},
|
||||
{
|
||||
{ ADD_LEN( OID_AT_DN_QUALIFIER ),"id-at-dnQualifier", "Distinguished Name qualifier" },
|
||||
"dnQualifier",
|
||||
},
|
||||
{
|
||||
{ ADD_LEN( OID_AT_PSEUDONYM ), "id-at-pseudonym", "Pseudonym" },
|
||||
"pseudonym",
|
||||
},
|
||||
{
|
||||
{ ADD_LEN( OID_DOMAIN_COMPONENT ), "id-domainComponent", "Domain component" },
|
||||
"DC",
|
||||
},
|
||||
{
|
||||
{ NULL, 0, NULL, NULL },
|
||||
NULL,
|
||||
@ -327,6 +363,10 @@ static const oid_sig_alg_t oid_sig_alg[] =
|
||||
{ ADD_LEN( OID_ECDSA_SHA512 ), "ecdsa-with-SHA512", "ECDSA with SHA512" },
|
||||
POLARSSL_MD_SHA512, POLARSSL_PK_ECDSA,
|
||||
},
|
||||
{
|
||||
{ ADD_LEN( OID_RSASSA_PSS ), "RSASSA-PSS", "RSASSA-PSS" },
|
||||
POLARSSL_MD_NONE, POLARSSL_PK_RSASSA_PSS,
|
||||
},
|
||||
{
|
||||
{ NULL, 0, NULL, NULL },
|
||||
0, 0,
|
||||
@ -493,10 +533,6 @@ static const oid_md_alg_t oid_md_alg[] =
|
||||
{ ADD_LEN( OID_DIGEST_ALG_SHA1 ), "id-sha1", "SHA-1" },
|
||||
POLARSSL_MD_SHA1,
|
||||
},
|
||||
{
|
||||
{ ADD_LEN( OID_DIGEST_ALG_SHA1 ), "id-sha1", "SHA-1" },
|
||||
POLARSSL_MD_SHA1,
|
||||
},
|
||||
{
|
||||
{ ADD_LEN( OID_DIGEST_ALG_SHA224 ), "id-sha224", "SHA-224" },
|
||||
POLARSSL_MD_SHA224,
|
||||
@ -569,7 +605,7 @@ FN_OID_GET_ATTR2(oid_get_pkcs12_pbe_alg, oid_pkcs12_pbe_alg_t, pkcs12_pbe_alg, m
|
||||
* This fuction tries to 'fix' this by at least suggesting enlarging the
|
||||
* size by 20.
|
||||
*/
|
||||
static int compat_snprintf(char *str, size_t size, const char *format, ...)
|
||||
static int compat_snprintf( char *str, size_t size, const char *format, ... )
|
||||
{
|
||||
va_list ap;
|
||||
int res = -1;
|
||||
@ -581,29 +617,27 @@ static int compat_snprintf(char *str, size_t size, const char *format, ...)
|
||||
va_end( ap );
|
||||
|
||||
// No quick fix possible
|
||||
if ( res < 0 )
|
||||
if( res < 0 )
|
||||
return( (int) size + 20 );
|
||||
|
||||
return res;
|
||||
return( res );
|
||||
}
|
||||
|
||||
#define snprintf compat_snprintf
|
||||
#endif
|
||||
#endif /* _MSC_VER && !snprintf && !EFIX64 && !EFI32 */
|
||||
|
||||
#define POLARSSL_ERR_DEBUG_BUF_TOO_SMALL -2
|
||||
|
||||
#define SAFE_SNPRINTF() \
|
||||
{ \
|
||||
if( ret == -1 ) \
|
||||
return( -1 ); \
|
||||
\
|
||||
if ( (unsigned int) ret > n ) { \
|
||||
p[n - 1] = '\0'; \
|
||||
return POLARSSL_ERR_DEBUG_BUF_TOO_SMALL;\
|
||||
} \
|
||||
\
|
||||
n -= (unsigned int) ret; \
|
||||
p += (unsigned int) ret; \
|
||||
#define SAFE_SNPRINTF() \
|
||||
{ \
|
||||
if( ret == -1 ) \
|
||||
return( POLARSSL_ERR_OID_BUF_TOO_SMALL ); \
|
||||
\
|
||||
if( (unsigned int) ret >= n ) { \
|
||||
p[n - 1] = '\0'; \
|
||||
return( POLARSSL_ERR_OID_BUF_TOO_SMALL ); \
|
||||
} \
|
||||
\
|
||||
n -= (unsigned int) ret; \
|
||||
p += (unsigned int) ret; \
|
||||
}
|
||||
|
||||
/* Return the x.y.z.... style numeric string for the given OID */
|
||||
@ -629,8 +663,8 @@ int oid_get_numeric_string( char *buf, size_t size,
|
||||
for( i = 1; i < oid->len; i++ )
|
||||
{
|
||||
/* Prevent overflow in value. */
|
||||
if ( ( ( value << 7 ) >> 7 ) != value )
|
||||
return( POLARSSL_ERR_DEBUG_BUF_TOO_SMALL );
|
||||
if( ( ( value << 7 ) >> 7 ) != value )
|
||||
return( POLARSSL_ERR_OID_BUF_TOO_SMALL );
|
||||
|
||||
value <<= 7;
|
||||
value += oid->p[i] & 0x7F;
|
||||
|
Reference in New Issue
Block a user