mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 19:18:08 +00:00
add macro definition of assert using polarssl_exit
This commit is contained in:
parent
77d3638497
commit
4c09114c32
1 changed files with 11 additions and 5 deletions
|
@ -15,10 +15,16 @@ typedef UINT32 uint32_t;
|
|||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#define assert(a) if( !( a ) ) \
|
||||
{ \
|
||||
polarssl_fprintf( stderr, "Assertion Failed at %s:%d - %s\n", \
|
||||
__FILE__, __LINE__, #a ); \
|
||||
polarssl_exit( 1 ); \
|
||||
}
|
||||
|
||||
/*
|
||||
* 32-bit integer manipulation macros (big endian)
|
||||
*/
|
||||
|
@ -42,13 +48,13 @@ typedef UINT32 uint32_t;
|
|||
}
|
||||
#endif
|
||||
|
||||
static int unhexify(unsigned char *obuf, const char *ibuf)
|
||||
static int unhexify( unsigned char *obuf, const char *ibuf )
|
||||
{
|
||||
unsigned char c, c2;
|
||||
int len = strlen(ibuf) / 2;
|
||||
assert( strlen(ibuf) % 2 == 0 ); // must be even number of bytes
|
||||
int len = strlen( ibuf ) / 2;
|
||||
assert( strlen( ibuf ) % 2 == 0 ); // must be even number of bytes
|
||||
|
||||
while (*ibuf != 0)
|
||||
while( *ibuf != 0 )
|
||||
{
|
||||
c = *ibuf++;
|
||||
if( c >= '0' && c <= '9' )
|
||||
|
|
Loading…
Reference in a new issue