mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 09:15:43 +01:00
Use own implementation of strsep()
Not available on windows, and strtok() is not a good option
This commit is contained in:
parent
54150a36d1
commit
28e1ac5cab
@ -83,6 +83,36 @@ int verify_print( void *data, x509_crt *crt, int certificate_depth, int *flags )
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* POLARSSL_X509_CRT_PARSE_C */
|
||||
|
||||
/* strsep() not available on Windows */
|
||||
char *mystrsep(char **stringp, const char *delim)
|
||||
{
|
||||
const char *p;
|
||||
char *ret = *stringp;
|
||||
|
||||
if( *stringp == NULL )
|
||||
return( NULL );
|
||||
|
||||
for( ; ; (*stringp)++ )
|
||||
{
|
||||
if( **stringp == '\0' )
|
||||
{
|
||||
*stringp = NULL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
for( p = delim; *p != '\0'; p++ )
|
||||
if( **stringp == *p )
|
||||
{
|
||||
**stringp = '\0';
|
||||
(*stringp)++;
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
done:
|
||||
return( ret );
|
||||
}
|
||||
/* END_HEADER */
|
||||
|
||||
/* BEGIN_DEPENDENCIES
|
||||
@ -457,7 +487,7 @@ void x509_crt_verify_chain( char *chain_paths, char *trusted_ca, int flags_resu
|
||||
x509_crt_init( &chain );
|
||||
x509_crt_init( &trusted );
|
||||
|
||||
while( ( act = strsep( &chain_paths, " " ) ) != NULL )
|
||||
while( ( act = mystrsep( &chain_paths, " " ) ) != NULL )
|
||||
TEST_ASSERT( x509_crt_parse_file( &chain, act ) == 0 );
|
||||
TEST_ASSERT( x509_crt_parse_file( &trusted, trusted_ca ) == 0 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user