mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 12:35:37 +00:00
Minor style and typo corrections
This commit is contained in:
parent
524f255c5b
commit
ef4acc569d
|
@ -52,7 +52,7 @@ static void polarssl_zeroize( void *v, size_t n ) {
|
|||
|
||||
void x509write_crt_init( x509write_cert *ctx )
|
||||
{
|
||||
memset( ctx, 0, sizeof(x509write_cert) );
|
||||
memset( ctx, 0, sizeof( x509write_cert ) );
|
||||
|
||||
mpi_init( &ctx->serial );
|
||||
ctx->version = X509_CRT_VERSION_3;
|
||||
|
@ -66,7 +66,7 @@ void x509write_crt_free( x509write_cert *ctx )
|
|||
asn1_free_named_data_list( &ctx->issuer );
|
||||
asn1_free_named_data_list( &ctx->extensions );
|
||||
|
||||
polarssl_zeroize( ctx, sizeof(x509write_cert) );
|
||||
polarssl_zeroize( ctx, sizeof( x509write_cert ) );
|
||||
}
|
||||
|
||||
void x509write_crt_set_version( x509write_cert *ctx, int version )
|
||||
|
@ -141,10 +141,10 @@ int x509write_crt_set_basic_constraints( x509write_cert *ctx,
|
|||
{
|
||||
int ret;
|
||||
unsigned char buf[9];
|
||||
unsigned char *c = buf + sizeof(buf);
|
||||
unsigned char *c = buf + sizeof( buf );
|
||||
size_t len = 0;
|
||||
|
||||
memset( buf, 0, sizeof(buf) );
|
||||
memset( buf, 0, sizeof( buf ) );
|
||||
|
||||
if( is_ca && max_pathlen > 127 )
|
||||
return( POLARSSL_ERR_X509_BAD_INPUT_DATA );
|
||||
|
@ -164,7 +164,7 @@ int x509write_crt_set_basic_constraints( x509write_cert *ctx,
|
|||
|
||||
return x509write_crt_set_extension( ctx, OID_BASIC_CONSTRAINTS,
|
||||
OID_SIZE( OID_BASIC_CONSTRAINTS ),
|
||||
0, buf + sizeof(buf) - len, len );
|
||||
0, buf + sizeof( buf ) - len, len );
|
||||
}
|
||||
|
||||
#if defined(POLARSSL_SHA1_C)
|
||||
|
@ -172,14 +172,14 @@ int x509write_crt_set_subject_key_identifier( x509write_cert *ctx )
|
|||
{
|
||||
int ret;
|
||||
unsigned char buf[POLARSSL_MPI_MAX_SIZE * 2 + 20]; /* tag, length + 2xMPI */
|
||||
unsigned char *c = buf + sizeof(buf);
|
||||
unsigned char *c = buf + sizeof( buf );
|
||||
size_t len = 0;
|
||||
|
||||
memset( buf, 0, sizeof(buf) );
|
||||
memset( buf, 0, sizeof( buf ) );
|
||||
ASN1_CHK_ADD( len, pk_write_pubkey( &c, buf, ctx->subject_key ) );
|
||||
|
||||
sha1( buf + sizeof(buf) - len, len, buf + sizeof(buf) - 20 );
|
||||
c = buf + sizeof(buf) - 20;
|
||||
sha1( buf + sizeof( buf ) - len, len, buf + sizeof( buf ) - 20 );
|
||||
c = buf + sizeof( buf ) - 20;
|
||||
len = 20;
|
||||
|
||||
ASN1_CHK_ADD( len, asn1_write_len( &c, buf, len ) );
|
||||
|
@ -187,21 +187,21 @@ int x509write_crt_set_subject_key_identifier( x509write_cert *ctx )
|
|||
|
||||
return x509write_crt_set_extension( ctx, OID_SUBJECT_KEY_IDENTIFIER,
|
||||
OID_SIZE( OID_SUBJECT_KEY_IDENTIFIER ),
|
||||
0, buf + sizeof(buf) - len, len );
|
||||
0, buf + sizeof( buf ) - len, len );
|
||||
}
|
||||
|
||||
int x509write_crt_set_authority_key_identifier( x509write_cert *ctx )
|
||||
{
|
||||
int ret;
|
||||
unsigned char buf[POLARSSL_MPI_MAX_SIZE * 2 + 20]; /* tag, length + 2xMPI */
|
||||
unsigned char *c = buf + sizeof(buf);
|
||||
unsigned char *c = buf + sizeof( buf );
|
||||
size_t len = 0;
|
||||
|
||||
memset( buf, 0, sizeof(buf) );
|
||||
memset( buf, 0, sizeof( buf ) );
|
||||
ASN1_CHK_ADD( len, pk_write_pubkey( &c, buf, ctx->issuer_key ) );
|
||||
|
||||
sha1( buf + sizeof(buf) - len, len, buf + sizeof(buf) - 20 );
|
||||
c = buf + sizeof(buf) - 20;
|
||||
sha1( buf + sizeof( buf ) - len, len, buf + sizeof( buf ) - 20 );
|
||||
c = buf + sizeof( buf ) - 20;
|
||||
len = 20;
|
||||
|
||||
ASN1_CHK_ADD( len, asn1_write_len( &c, buf, len ) );
|
||||
|
@ -213,7 +213,7 @@ int x509write_crt_set_authority_key_identifier( x509write_cert *ctx )
|
|||
|
||||
return x509write_crt_set_extension( ctx, OID_AUTHORITY_KEY_IDENTIFIER,
|
||||
OID_SIZE( OID_AUTHORITY_KEY_IDENTIFIER ),
|
||||
0, buf + sizeof(buf) - len, len );
|
||||
0, buf + sizeof( buf ) - len, len );
|
||||
}
|
||||
#endif /* POLARSSL_SHA1_C */
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ static void polarssl_zeroize( void *v, size_t n ) {
|
|||
|
||||
void x509write_csr_init( x509write_csr *ctx )
|
||||
{
|
||||
memset( ctx, 0, sizeof(x509write_csr) );
|
||||
memset( ctx, 0, sizeof( x509write_csr ) );
|
||||
}
|
||||
|
||||
void x509write_csr_free( x509write_csr *ctx )
|
||||
|
@ -59,7 +59,7 @@ void x509write_csr_free( x509write_csr *ctx )
|
|||
asn1_free_named_data_list( &ctx->subject );
|
||||
asn1_free_named_data_list( &ctx->extensions );
|
||||
|
||||
polarssl_zeroize( ctx, sizeof(x509write_csr) );
|
||||
polarssl_zeroize( ctx, sizeof( x509write_csr ) );
|
||||
}
|
||||
|
||||
void x509write_csr_set_md_alg( x509write_csr *ctx, md_type_t md_alg )
|
||||
|
|
|
@ -165,7 +165,7 @@ void x509_crt_check( char *subject_key_file, char *subject_pwd,
|
|||
TEST_ASSERT( x509write_crt_set_ns_cert_type( &crt, cert_type ) == 0 );
|
||||
}
|
||||
|
||||
ret = x509write_crt_pem( &crt, buf, sizeof(buf),
|
||||
ret = x509write_crt_pem( &crt, buf, sizeof( buf ),
|
||||
rnd_pseudo_rand, &rnd_info );
|
||||
TEST_ASSERT( ret == 0 );
|
||||
|
||||
|
@ -173,8 +173,8 @@ void x509_crt_check( char *subject_key_file, char *subject_pwd,
|
|||
|
||||
f = fopen( cert_check_file, "r" );
|
||||
TEST_ASSERT( f != NULL );
|
||||
olen = fread( check_buf, 1, sizeof(check_buf), f );
|
||||
TEST_ASSERT( olen < sizeof(check_buf) );
|
||||
olen = fread( check_buf, 1, sizeof( check_buf ), f );
|
||||
TEST_ASSERT( olen < sizeof( check_buf ) );
|
||||
fclose( f );
|
||||
|
||||
TEST_ASSERT( olen >= pem_len - 1 );
|
||||
|
|
Loading…
Reference in a new issue