mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 23:14:23 +01:00
MD: Implement config dep'n inlining of mbedtls_md_process()
This commit is contained in:
parent
993691d9ba
commit
53ade9fa62
@ -508,7 +508,8 @@ int mbedtls_md_hmac( mbedtls_md_handle_t md_info, const unsigned char *key, size
|
||||
unsigned char *output );
|
||||
|
||||
/* Internal use */
|
||||
int mbedtls_md_process( mbedtls_md_context_t *ctx, const unsigned char *data );
|
||||
MBEDTLS_MD_INLINABLE_API int mbedtls_md_process( mbedtls_md_context_t *ctx,
|
||||
const unsigned char *data );
|
||||
|
||||
/*
|
||||
* Internal wrapper functions for those MD API functions which should be
|
||||
@ -575,6 +576,20 @@ MBEDTLS_ALWAYS_INLINE static inline int mbedtls_md_internal(
|
||||
ilen, output) );
|
||||
}
|
||||
|
||||
MBEDTLS_ALWAYS_INLINE static inline int mbedtls_md_process_internal(
|
||||
mbedtls_md_context_t *ctx, const unsigned char *data )
|
||||
{
|
||||
mbedtls_md_handle_t md_info;
|
||||
if( ctx == NULL )
|
||||
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
|
||||
|
||||
md_info = mbedtls_md_get_handle( ctx );
|
||||
if( md_info == MBEDTLS_MD_INVALID_HANDLE )
|
||||
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
|
||||
|
||||
return( mbedtls_md_info_process( md_info, ctx->md_ctx, data ) );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_MD_SINGLE_HASH)
|
||||
MBEDTLS_MD_INLINABLE_API int mbedtls_md_starts(
|
||||
mbedtls_md_context_t *ctx )
|
||||
@ -605,6 +620,12 @@ MBEDTLS_MD_INLINABLE_API int mbedtls_md(
|
||||
return( mbedtls_md_internal( md_info, input, ilen, output ) );
|
||||
}
|
||||
|
||||
MBEDTLS_MD_INLINABLE_API int mbedtls_md_process(
|
||||
mbedtls_md_context_t *ctx, const unsigned char *data )
|
||||
{
|
||||
return( mbedtls_md_process_internal( ctx, data ) );
|
||||
}
|
||||
|
||||
#endif /* MBEDTLS_MD_SINGLE_HASH */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
12
library/md.c
12
library/md.c
@ -711,18 +711,12 @@ cleanup:
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#if !defined(MBEDTLS_MD_SINGLE_HASH)
|
||||
int mbedtls_md_process( mbedtls_md_context_t *ctx, const unsigned char *data )
|
||||
{
|
||||
mbedtls_md_handle_t md_info;
|
||||
if( ctx == NULL )
|
||||
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
|
||||
|
||||
md_info = mbedtls_md_get_handle( ctx );
|
||||
if( md_info == MBEDTLS_MD_INVALID_HANDLE )
|
||||
return( MBEDTLS_ERR_MD_BAD_INPUT_DATA );
|
||||
|
||||
return( mbedtls_md_info_process( md_info, ctx->md_ctx, data ) );
|
||||
return( mbedtls_md_process_internal( ctx, data ) );
|
||||
}
|
||||
#endif /* !MBEDTLS_MD_SINGLE_HASH */
|
||||
|
||||
unsigned char mbedtls_md_get_size( mbedtls_md_handle_t md_info )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user