Minor formatting tweaks

Signed-off-by: Dave Rodgman <dave.rodgman@arm.com>
This commit is contained in:
Dave Rodgman 2022-11-24 21:17:40 +00:00
parent 875d2383d0
commit 7a910a8be0
3 changed files with 8 additions and 8 deletions

View file

@ -33,10 +33,10 @@
* \param p pointer to 4 bytes of data * \param p pointer to 4 bytes of data
* \return Data at the given address * \return Data at the given address
*/ */
inline uint32_t mbedtls_get_unaligned_uint32( void const *p ) inline uint32_t mbedtls_get_unaligned_uint32( const void *p )
{ {
uint32_t r; uint32_t r;
memcpy( &r, p, 4 ); memcpy( &r, p, sizeof( r ) );
return r; return r;
} }
@ -49,7 +49,7 @@ inline uint32_t mbedtls_get_unaligned_uint32( void const *p )
*/ */
inline void mbedtls_put_unaligned_uint32( void *p, uint32_t x ) inline void mbedtls_put_unaligned_uint32( void *p, uint32_t x )
{ {
memcpy( p, &x, 4 ); memcpy( p, &x, sizeof( x ) );
} }
/** Byte Reading Macros /** Byte Reading Macros

View file

@ -86,7 +86,7 @@ extern void (*mbedtls_test_hook_test_fail)( const char * test, int line, const c
* \param b Pointer to input (buffer of at least \p n bytes) * \param b Pointer to input (buffer of at least \p n bytes)
* \param n Number of bytes to process. * \param n Number of bytes to process.
*/ */
inline void mbedtls_xor( unsigned char *r, unsigned char const *a, unsigned char const *b, size_t n ) inline void mbedtls_xor( unsigned char *r, const unsigned char *a, const unsigned char *b, size_t n )
{ {
size_t i; size_t i;
for ( i = 0; ( i + 4 ) <= n; i += 4 ) for ( i = 0; ( i + 4 ) <= n; i += 4 )

View file

@ -82,9 +82,9 @@ void mbedtls_xor( int len )
ASSERT_COMPARE( r1 + r_off, n, r2 + r_off, n ); ASSERT_COMPARE( r1 + r_off, n, r2 + r_off, n );
} }
exit: exit:
if ( a != NULL ) mbedtls_free( a ); mbedtls_free( a );
if ( a != NULL ) mbedtls_free( b ); mbedtls_free( b );
if ( r1 != NULL ) mbedtls_free( r1 ); mbedtls_free( r1 );
if ( r2 != NULL ) mbedtls_free( r2 ); mbedtls_free( r2 );
} }
/* END_CASE */ /* END_CASE */