mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-03-24 22:25:11 +00:00
Minor checks to prevent NULL-pointer exceptions
This commit is contained in:
parent
3b6a07b745
commit
c295b834a2
|
@ -200,6 +200,9 @@ int md_free_ctx( md_context_t *ctx );
|
||||||
*/
|
*/
|
||||||
static inline unsigned char md_get_size( const md_info_t *md_info )
|
static inline unsigned char md_get_size( const md_info_t *md_info )
|
||||||
{
|
{
|
||||||
|
if( md_info == NULL )
|
||||||
|
return( 0 );
|
||||||
|
|
||||||
return md_info->size;
|
return md_info->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -212,6 +215,9 @@ static inline unsigned char md_get_size( const md_info_t *md_info )
|
||||||
*/
|
*/
|
||||||
static inline md_type_t md_get_type( const md_info_t *md_info )
|
static inline md_type_t md_get_type( const md_info_t *md_info )
|
||||||
{
|
{
|
||||||
|
if( md_info == NULL )
|
||||||
|
return( POLARSSL_MD_NONE );
|
||||||
|
|
||||||
return md_info->type;
|
return md_info->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,6 +230,9 @@ static inline md_type_t md_get_type( const md_info_t *md_info )
|
||||||
*/
|
*/
|
||||||
static inline const char *md_get_name( const md_info_t *md_info )
|
static inline const char *md_get_name( const md_info_t *md_info )
|
||||||
{
|
{
|
||||||
|
if( md_info == NULL )
|
||||||
|
return( NULL );
|
||||||
|
|
||||||
return md_info->name;
|
return md_info->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue