1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-28 00:21:48 +03:00

Fix mpi_write_string() to write "00" as hex output for empty MPI

This commit is contained in:
Paul Bakker
2014-07-10 14:36:19 +02:00
parent 5b11d026cd
commit 6c343d7d9a
3 changed files with 9 additions and 1 deletions

View File

@ -530,7 +530,7 @@ int mpi_write_string( const mpi *X, int radix, char *s, size_t *slen )
{
c = ( X->p[i - 1] >> ( ( j - 1 ) << 3) ) & 0xFF;
if( c == 0 && k == 0 && ( i + j + 3 ) != 0 )
if( c == 0 && k == 0 && ( i + j ) != 2 )
continue;
*(p++) = "0123456789ABCDEF" [c / 16];