1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-08 17:42:09 +03:00

Fix bug in mpi_set_bit

This commit is contained in:
Manuel Pégourié-Gonnard
2013-12-04 18:05:29 +01:00
parent a0179b8c4a
commit 9a4a5ac4de
3 changed files with 9 additions and 1 deletions

View File

@@ -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: