mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-25 15:15:47 +01:00
Fix bug in mpi_set_bit
This commit is contained in:
parent
a0179b8c4a
commit
9a4a5ac4de
@ -15,6 +15,7 @@ Changes
|
||||
* Split off curves from ecp.c into ecp_curves.c
|
||||
|
||||
Bugfix
|
||||
* Fixed bug in mpi_set_bit() on platforms where t_uint is wider than int
|
||||
* Fixed X.509 hostname comparison (with non-regular characters)
|
||||
* SSL now gracefully handles missing RNG
|
||||
* Missing defines / cases for RSA_PSK key exchange
|
||||
|
@ -280,7 +280,8 @@ int mpi_set_bit( mpi *X, size_t pos, unsigned char val )
|
||||
MPI_CHK( mpi_grow( X, off + 1 ) );
|
||||
}
|
||||
|
||||
X->p[off] = ( X->p[off] & ~( 0x01 << idx ) ) | ( val << idx );
|
||||
X->p[off] &= ~( (t_uint) 0x01 << idx );
|
||||
X->p[off] |= (t_uint) val << idx;
|
||||
|
||||
cleanup:
|
||||
|
||||
|
@ -665,6 +665,12 @@ mpi_set_bit:10:"49979687":80:0:10:"49979687"
|
||||
Test bit set (Add above existing limbs with a 1)
|
||||
mpi_set_bit:10:"49979687":80:1:10:"1208925819614629224685863"
|
||||
|
||||
Test bit set (Bit index larger than 31 with a 0)
|
||||
mpi_set_bit:16:"FFFFFFFFFFFFFFFF":32:0:16:"FFFFFFFEFFFFFFFF"
|
||||
|
||||
Test bit set (Bit index larger than 31 with a 1)
|
||||
mpi_set_bit:16:"00":32:1:16:"0100000000"
|
||||
|
||||
MPI Selftest
|
||||
depends_on:POLARSSL_SELF_TEST
|
||||
mpi_selftest:
|
||||
|
Loading…
Reference in New Issue
Block a user