mirror of
https://github.com/ARMmbed/mbedtls.git
synced 2025-05-10 00:49:04 +08:00
Fix minor issues
1. Typo fix. 2. Change byte by byte coipy to `memcpy`. 3. Remove parenthesis in switch cases.
This commit is contained in:
parent
e269537b80
commit
a291391775
@ -1016,9 +1016,9 @@ static int x509_get_crt_ext( unsigned char **p,
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* If MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE is returned, the we cannot
|
* If MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE is returned, then we
|
||||||
* interpret or enforce the policy. However, it is up to the user
|
* cannot interpret or enforce the policy. However, it is up to
|
||||||
* to choose how to enforce the policies,
|
* the user to choose how to enforce the policies,
|
||||||
* unless the extension is critical.
|
* unless the extension is critical.
|
||||||
*/
|
*/
|
||||||
if( ret != MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE )
|
if( ret != MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE )
|
||||||
@ -1737,7 +1737,6 @@ static int x509_info_subject_alt_name( char **buf, size_t *size,
|
|||||||
*subject_alt_name,
|
*subject_alt_name,
|
||||||
const char *prefix )
|
const char *prefix )
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
int ret;
|
int ret;
|
||||||
size_t n = *size;
|
size_t n = *size;
|
||||||
char *p = *buf;
|
char *p = *buf;
|
||||||
@ -1770,7 +1769,7 @@ static int x509_info_subject_alt_name( char **buf, size_t *size,
|
|||||||
/*
|
/*
|
||||||
* otherName
|
* otherName
|
||||||
*/
|
*/
|
||||||
case( MBEDTLS_X509_SAN_OTHER_NAME ):
|
case MBEDTLS_X509_SAN_OTHER_NAME:
|
||||||
{
|
{
|
||||||
mbedtls_x509_san_other_name *other_name = &san.san.other_name;
|
mbedtls_x509_san_other_name *other_name = &san.san.other_name;
|
||||||
|
|
||||||
@ -1797,10 +1796,10 @@ static int x509_info_subject_alt_name( char **buf, size_t *size,
|
|||||||
return( MBEDTLS_ERR_X509_BUFFER_TOO_SMALL );
|
return( MBEDTLS_ERR_X509_BUFFER_TOO_SMALL );
|
||||||
}
|
}
|
||||||
|
|
||||||
for( i = 0; i < other_name->value.hardware_module_name.val.len; i++ )
|
memcpy( p, other_name->value.hardware_module_name.val.p,
|
||||||
{
|
other_name->value.hardware_module_name.val.len );
|
||||||
*p++ = other_name->value.hardware_module_name.val.p[i];
|
p += other_name->value.hardware_module_name.val.len;
|
||||||
}
|
|
||||||
n -= other_name->value.hardware_module_name.val.len;
|
n -= other_name->value.hardware_module_name.val.len;
|
||||||
|
|
||||||
}/* MBEDTLS_OID_ON_HW_MODULE_NAME */
|
}/* MBEDTLS_OID_ON_HW_MODULE_NAME */
|
||||||
@ -1810,7 +1809,7 @@ static int x509_info_subject_alt_name( char **buf, size_t *size,
|
|||||||
/*
|
/*
|
||||||
* dNSName
|
* dNSName
|
||||||
*/
|
*/
|
||||||
case( MBEDTLS_X509_SAN_DNS_NAME ):
|
case MBEDTLS_X509_SAN_DNS_NAME:
|
||||||
{
|
{
|
||||||
ret = mbedtls_snprintf( p, n, "\n%s dNSName : ", prefix );
|
ret = mbedtls_snprintf( p, n, "\n%s dNSName : ", prefix );
|
||||||
MBEDTLS_X509_SAFE_SNPRINTF;
|
MBEDTLS_X509_SAFE_SNPRINTF;
|
||||||
@ -1819,9 +1818,10 @@ static int x509_info_subject_alt_name( char **buf, size_t *size,
|
|||||||
*p = '\0';
|
*p = '\0';
|
||||||
return( MBEDTLS_ERR_X509_BUFFER_TOO_SMALL );
|
return( MBEDTLS_ERR_X509_BUFFER_TOO_SMALL );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy( p, san.san.unstructured_name.p, san.san.unstructured_name.len );
|
||||||
|
p += san.san.unstructured_name.len;
|
||||||
n -= san.san.unstructured_name.len;
|
n -= san.san.unstructured_name.len;
|
||||||
for( i = 0; i < san.san.unstructured_name.len; i++ )
|
|
||||||
*p++ = san.san.unstructured_name.p[i];
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user