Skip to content

Commit 60b2d40

Browse files
Roland Mikhelcarlescufi
authored andcommitted
[nrf fromtree] 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 <[email protected]> Change-Id: If5943758bebdbf401b1eb387de334fa19a3a7781 (cherry picked from commit 186ac88) Signed-off-by: Georgios Vasilakis <[email protected]>
1 parent 3b7c7fb commit 60b2d40

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

boot/bootutil/src/image_ec256.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#include "bootutil/fault_injection_hardening.h"
3535
#include "bootutil/crypto/ecdsa_p256.h"
3636

37-
fih_int
37+
fih_ret
3838
bootutil_verify_sig(uint8_t *hash, uint32_t hlen, uint8_t *sig, size_t slen,
3939
uint8_t key_id)
4040
{
@@ -50,11 +50,16 @@ bootutil_verify_sig(uint8_t *hash, uint32_t hlen, uint8_t *sig, size_t slen,
5050

5151
rc = bootutil_ecdsa_p256_parse_public_key(&ctx, &pubkey, end);
5252
if (rc) {
53+
goto out;
54+
}
55+
56+
rc = bootutil_ecdsa_p256_verify(&ctx, pubkey, end-pubkey, hash, hlen, sig, slen);
57+
fih_rc = fih_ret_encode_zero_equality(rc);
58+
if (FIH_NOT_EQ(fih_rc, FIH_SUCCESS)) {
5359
FIH_SET(fih_rc, FIH_FAILURE);
54-
FIH_RET(fih_rc);
5560
}
5661

57-
FIH_CALL(bootutil_ecdsa_p256_verify, fih_rc, &ctx, pubkey, end-pubkey, hash, hlen, sig, slen);
62+
out:
5863
bootutil_ecdsa_p256_drop(&ctx);
5964

6065
FIH_RET(fih_rc);

0 commit comments

Comments
 (0)