Fix incorrect return code on ECDSA key verification
authorAndrew Hoang <mail@andrewhoang.me>
Tue, 24 Dec 2019 04:19:24 +0000 (20:19 -0800)
committerNicola Tuveri <nic.tuv@gmail.com>
Sun, 5 Jan 2020 13:52:00 +0000 (15:52 +0200)
commit0fcc6e70bc8970c4aee5e55d517aa1cc522a3ee8
treec264e5bf5dfbb42d9eb116c57c66fd335c222ee1
parent49847f3c40590181270b2a57b8b2bc95a7579e82
Fix incorrect return code on ECDSA key verification

ECDSA_do_verify() is a function that verifies a ECDSA signature given a hash and a public EC key. The function is supposed to return 1 on valid signature, 0 on invalid signature and -1 on error. Previously, we returned 0 if the key did not have a verify_sig method. This is actually an error case and not an invalid signature. Consequently, this patch updates the return code to -1.

Fixes #8766

Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/10693)

(cherry picked from commit 26583f6aa8dc28e3598e61db66e54e2fdf8b195f)
crypto/ec/ecdsa_vrf.c