mbedtls/programs/pkey
ihsinme d21ecd71c0 dh_genprime: Fix issue where the error code returned by mbedtls_mpi_write_file() is incorrectly reported on failure
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>
2022-11-10 12:58:15 +03:00
..
CMakeLists.txt Fix cmake build of programs 2021-06-17 09:38:38 +02:00
dh_client.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
dh_genprime.c dh_genprime: Fix issue where the error code returned by mbedtls_mpi_write_file() is incorrectly reported on failure 2022-11-10 12:58:15 +03:00
dh_prime.txt - Changed saved value to RCF 3526 2048 MODP group 2012-10-03 19:50:54 +00:00
dh_server.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
ecdh_curve25519.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
ecdsa.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
gen_key.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
key_app_writer.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
key_app.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
mpi_demo.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
pk_decrypt.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
pk_encrypt.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
pk_sign.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
pk_verify.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
rsa_decrypt.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
rsa_encrypt.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
rsa_genkey.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
rsa_priv.txt Normalize line endings 2020-05-27 21:55:08 +02:00
rsa_pub.txt Normalize line endings 2020-05-27 21:55:08 +02:00
rsa_sign_pss.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
rsa_sign.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
rsa_verify_pss.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00
rsa_verify.c Include platform.h unconditionally: automatic part 2022-09-15 20:33:07 +02:00