diff options
author | Peiwei Hu <jlu.hpw@foxmail.com> | 2022-12-02 16:31:02 +0800 |
---|---|---|
committer | Tomas Mraz <tomas@openssl.org> | 2022-12-05 13:05:59 +0100 |
commit | 5812a2d282a76e83a95ea19aa08e89ba0571b182 (patch) | |
tree | 8983eaba52f1f863c4662329ab84d927c34e2775 | |
parent | 17345cf10f974d77bbb62015c8ab5f8962fc33f4 (diff) |
Fix the checks in rsautl_main
Reviewed-by: Hugo Landau <hlandau@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19819)
(cherry picked from commit 4c3fadfe57b94f71fa83786726046b8833997c7c)
-rw-r--r-- | apps/rsautl.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/apps/rsautl.c b/apps/rsautl.c index ae0206014d..df29069bc1 100644 --- a/apps/rsautl.c +++ b/apps/rsautl.c @@ -243,25 +243,25 @@ int rsautl_main(int argc, char **argv) switch (rsa_mode) { case RSA_VERIFY: - rv = EVP_PKEY_verify_recover_init(ctx) - && EVP_PKEY_CTX_set_rsa_padding(ctx, pad) + rv = EVP_PKEY_verify_recover_init(ctx) > 0 + && EVP_PKEY_CTX_set_rsa_padding(ctx, pad) > 0 && EVP_PKEY_verify_recover(ctx, rsa_out, &rsa_outlen, - rsa_in, rsa_inlen); + rsa_in, rsa_inlen) > 0; break; case RSA_SIGN: - rv = EVP_PKEY_sign_init(ctx) - && EVP_PKEY_CTX_set_rsa_padding(ctx, pad) - && EVP_PKEY_sign(ctx, rsa_out, &rsa_outlen, rsa_in, rsa_inlen); + rv = EVP_PKEY_sign_init(ctx) > 0 + && EVP_PKEY_CTX_set_rsa_padding(ctx, pad) > 0 + && EVP_PKEY_sign(ctx, rsa_out, &rsa_outlen, rsa_in, rsa_inlen) > 0; break; case RSA_ENCRYPT: - rv = EVP_PKEY_encrypt_init(ctx) - && EVP_PKEY_CTX_set_rsa_padding(ctx, pad) - && EVP_PKEY_encrypt(ctx, rsa_out, &rsa_outlen, rsa_in, rsa_inlen); + rv = EVP_PKEY_encrypt_init(ctx) > 0 + && EVP_PKEY_CTX_set_rsa_padding(ctx, pad) > 0 + && EVP_PKEY_encrypt(ctx, rsa_out, &rsa_outlen, rsa_in, rsa_inlen) > 0; break; case RSA_DECRYPT: - rv = EVP_PKEY_decrypt_init(ctx) - && EVP_PKEY_CTX_set_rsa_padding(ctx, pad) - && EVP_PKEY_decrypt(ctx, rsa_out, &rsa_outlen, rsa_in, rsa_inlen); + rv = EVP_PKEY_decrypt_init(ctx) > 0 + && EVP_PKEY_CTX_set_rsa_padding(ctx, pad) > 0 + && EVP_PKEY_decrypt(ctx, rsa_out, &rsa_outlen, rsa_in, rsa_inlen) > 0; break; } |