mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-10 21:25:30 +00:00
Merge remote-tracking branch 'origin/pr/2623' into development
* origin/pr/2623: Adapt ChangeLog Fix mpi_bigendian_to_host() on bigendian systems
This commit is contained in:
commit
826907736f
|
@ -742,10 +742,15 @@ cleanup:
|
|||
static mbedtls_mpi_uint mpi_uint_bigendian_to_host_c( mbedtls_mpi_uint x )
|
||||
{
|
||||
uint8_t i;
|
||||
unsigned char *x_ptr;
|
||||
mbedtls_mpi_uint tmp = 0;
|
||||
/* This works regardless of the endianness. */
|
||||
for( i = 0; i < ciL; i++, x >>= 8 )
|
||||
tmp |= ( x & 0xFF ) << ( ( ciL - 1 - i ) << 3 );
|
||||
|
||||
for( i = 0, x_ptr = (unsigned char*) &x; i < ciL; i++, x_ptr++ )
|
||||
{
|
||||
tmp <<= CHAR_BIT;
|
||||
tmp |= (mbedtls_mpi_uint) *x_ptr;
|
||||
}
|
||||
|
||||
return( tmp );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue