mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2024-12-27 12:16:07 +00:00
d21ecd71c0
In 'dh_genprime.c', the following condition can be found inside an 'if' statement: ret = mbedtls_mpi_write_file( "P = ", &P, 16, fout ) != 0 As the '!=' operator binds closer than the assignment operator ('='), the value assigned to 'ret' will be the boolean result of the comparison (0 or 1) instead of the status code returned by 'mbedtls_mpi_write_file'. This means that the above statement is actually equivalent to: ret = ( mbedtls_mpi_write_file( "P = ", &P, 16, fout ) != 0 ) What we want instead is for the the status code to be assigned to 'ret'. If the value assigned is non-zero, it will be 'truthy' and the 'if' branch will be taken. ( ret = mbedtls_mpi_write_file( "P = ", &P, 16, fout ) ) != 0 This PR fixes the issue by explicitly specifying the precedence of operations with parentheses. Signed-off-by: ihsinme <ihsinme@gmail.com> |
||
---|---|---|
.. | ||
CMakeLists.txt | ||
dh_client.c | ||
dh_genprime.c | ||
dh_prime.txt | ||
dh_server.c | ||
ecdh_curve25519.c | ||
ecdsa.c | ||
gen_key.c | ||
key_app_writer.c | ||
key_app.c | ||
mpi_demo.c | ||
pk_decrypt.c | ||
pk_encrypt.c | ||
pk_sign.c | ||
pk_verify.c | ||
rsa_decrypt.c | ||
rsa_encrypt.c | ||
rsa_genkey.c | ||
rsa_priv.txt | ||
rsa_pub.txt | ||
rsa_sign_pss.c | ||
rsa_sign.c | ||
rsa_verify_pss.c | ||
rsa_verify.c |