diff options
author | Peiwei Hu <jlu.hpw@foxmail.com> | 2022-11-15 11:25:38 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-11-16 16:44:43 +0100 |
commit | 3a4dd7f7d1a8ed31a162d4cf83e0d93bd5462101 (patch) | |
tree | 8be4982035b561083d86c5f71e0130e458450f5b /apps | |
parent | 8fe8c0f89eb9e7b67e24fdf59b759aca8f70cac2 (diff) |
apps/speed.c: fix the wrong checks
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19678)
(cherry picked from commit 9dd009dd513276e602b6592bc337a8563a1a82a1)
Diffstat (limited to 'apps')
-rw-r--r-- | apps/speed.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/apps/speed.c b/apps/speed.c index b156403f79..6647eaba52 100644 --- a/apps/speed.c +++ b/apps/speed.c @@ -2624,11 +2624,11 @@ skip_hmac: * code, for maximum performance. */ if ((test_ctx = EVP_PKEY_CTX_new(key_B, NULL)) == NULL /* test ctx from skeyB */ - || !EVP_PKEY_derive_init(test_ctx) /* init derivation test_ctx */ - || !EVP_PKEY_derive_set_peer(test_ctx, key_A) /* set peer pubkey in test_ctx */ - || !EVP_PKEY_derive(test_ctx, NULL, &test_outlen) /* determine max length */ - || !EVP_PKEY_derive(ctx, loopargs[i].secret_a, &outlen) /* compute a*B */ - || !EVP_PKEY_derive(test_ctx, loopargs[i].secret_b, &test_outlen) /* compute b*A */ + || EVP_PKEY_derive_init(test_ctx) <= 0 /* init derivation test_ctx */ + || EVP_PKEY_derive_set_peer(test_ctx, key_A) <= 0 /* set peer pubkey in test_ctx */ + || EVP_PKEY_derive(test_ctx, NULL, &test_outlen) <= 0 /* determine max length */ + || EVP_PKEY_derive(ctx, loopargs[i].secret_a, &outlen) <= 0 /* compute a*B */ + || EVP_PKEY_derive(test_ctx, loopargs[i].secret_b, &test_outlen) <= 0 /* compute b*A */ || test_outlen != outlen /* compare output length */) { ecdh_checks = 0; BIO_printf(bio_err, "ECDH computation failure.\n"); @@ -3059,10 +3059,10 @@ skip_hmac: ffdh_checks = 0; break; } - if (!EVP_PKEY_derive_init(test_ctx) || - !EVP_PKEY_derive_set_peer(test_ctx, pkey_A) || - !EVP_PKEY_derive(test_ctx, NULL, &test_out) || - !EVP_PKEY_derive(test_ctx, loopargs[i].secret_ff_b, &test_out) || + if (EVP_PKEY_derive_init(test_ctx) <= 0 || + EVP_PKEY_derive_set_peer(test_ctx, pkey_A) <= 0 || + EVP_PKEY_derive(test_ctx, NULL, &test_out) <= 0 || + EVP_PKEY_derive(test_ctx, loopargs[i].secret_ff_b, &test_out) <= 0 || test_out != secret_size) { BIO_printf(bio_err, "FFDH computation failure.\n"); op_count = 1; |