bootutil: Fix FIH return type for EC256

For bootutil_verify_sig the declaration expects fih_ret
as the return type not fih_int, this has now been fixed.

Signed-off-by: Roland Mikhel <roland.mikhel@arm.com>
Change-Id: If5943758bebdbf401b1eb387de334fa19a3a7781
This commit is contained in:
Roland Mikhel 2023-04-13 20:43:14 +02:00 committed by Dávid Vincze
parent 5397c13d24
commit 186ac88583
1 changed files with 9 additions and 4 deletions

View File

@ -35,7 +35,7 @@
#include "bootutil/fault_injection_hardening.h" #include "bootutil/fault_injection_hardening.h"
#include "bootutil/crypto/ecdsa_p256.h" #include "bootutil/crypto/ecdsa_p256.h"
fih_int fih_ret
bootutil_verify_sig(uint8_t *hash, uint32_t hlen, uint8_t *sig, size_t slen, bootutil_verify_sig(uint8_t *hash, uint32_t hlen, uint8_t *sig, size_t slen,
uint8_t key_id) uint8_t key_id)
{ {
@ -51,11 +51,16 @@ bootutil_verify_sig(uint8_t *hash, uint32_t hlen, uint8_t *sig, size_t slen,
rc = bootutil_ecdsa_p256_parse_public_key(&ctx, &pubkey, end); rc = bootutil_ecdsa_p256_parse_public_key(&ctx, &pubkey, end);
if (rc) { if (rc) {
FIH_SET(fih_rc, FIH_FAILURE); goto out;
FIH_RET(fih_rc);
} }
FIH_CALL(bootutil_ecdsa_p256_verify, fih_rc, &ctx, pubkey, end-pubkey, hash, hlen, sig, slen); rc = bootutil_ecdsa_p256_verify(&ctx, pubkey, end-pubkey, hash, hlen, sig, slen);
fih_rc = fih_ret_encode_zero_equality(rc);
if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
FIH_SET(fih_rc, FIH_FAILURE);
}
out:
bootutil_ecdsa_p256_drop(&ctx); bootutil_ecdsa_p256_drop(&ctx);
FIH_RET(fih_rc); FIH_RET(fih_rc);