Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 1 | /* |
David Brown | aac7111 | 2020-02-03 16:13:42 -0700 | [diff] [blame] | 2 | * SPDX-License-Identifier: Apache-2.0 |
| 3 | * |
| 4 | * Copyright (c) 2016-2019 JUUL Labs |
| 5 | * Copyright (c) 2017 Linaro LTD |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 6 | * Copyright (C) 2021 Arm Limited |
David Brown | aac7111 | 2020-02-03 16:13:42 -0700 | [diff] [blame] | 7 | * |
| 8 | * Original license: |
| 9 | * |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 10 | * Licensed to the Apache Software Foundation (ASF) under one |
| 11 | * or more contributor license agreements. See the NOTICE file |
| 12 | * distributed with this work for additional information |
| 13 | * regarding copyright ownership. The ASF licenses this file |
| 14 | * to you under the Apache License, Version 2.0 (the |
| 15 | * "License"); you may not use this file except in compliance |
| 16 | * with the License. You may obtain a copy of the License at |
| 17 | * |
| 18 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 19 | * |
| 20 | * Unless required by applicable law or agreed to in writing, |
| 21 | * software distributed under the License is distributed on an |
| 22 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 23 | * KIND, either express or implied. See the License for the |
| 24 | * specific language governing permissions and limitations |
| 25 | * under the License. |
| 26 | */ |
| 27 | |
Marko Kiiskila | 755daed | 2016-12-30 18:53:13 -0800 | [diff] [blame] | 28 | #include <string.h> |
| 29 | |
Fabio Utzig | ba1fbe6 | 2017-07-21 14:01:20 -0300 | [diff] [blame] | 30 | #include "mcuboot_config/mcuboot_config.h" |
Fabio Utzig | eed80b6 | 2017-06-10 08:03:05 -0300 | [diff] [blame] | 31 | |
Fabio Utzig | 19356bf | 2017-05-11 16:19:36 -0300 | [diff] [blame] | 32 | #ifdef MCUBOOT_SIGN_EC256 |
Roman Okhrimenko | 1dcc73b | 2020-10-01 19:22:14 +0300 | [diff] [blame] | 33 | /*TODO: remove this after cypress port mbedtls to abstract crypto api */ |
David Brown | 641af45 | 2021-02-19 12:16:48 -0700 | [diff] [blame] | 34 | #if defined(MCUBOOT_USE_CC310) || defined(MCUBOOT_USE_MBED_TLS) |
Sigvart Hovland | 59f1d29 | 2020-10-28 14:40:09 +0100 | [diff] [blame] | 35 | #define NUM_ECC_BYTES (256 / 8) |
| 36 | #endif |
David Brown | 641af45 | 2021-02-19 12:16:48 -0700 | [diff] [blame] | 37 | #if defined(MCUBOOT_USE_TINYCRYPT) || defined(MCUBOOT_USE_CC310) || \ |
| 38 | defined(MCUBOOT_USE_MBED_TLS) |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 39 | #include "bootutil/sign_key.h" |
| 40 | |
| 41 | #include "mbedtls/oid.h" |
| 42 | #include "mbedtls/asn1.h" |
Blaž Hrastnik | 4f4833d | 2020-09-14 13:53:31 +0900 | [diff] [blame] | 43 | #include "bootutil/crypto/ecdsa_p256.h" |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 44 | #include "bootutil/crypto/common.h" |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 45 | #include "bootutil_priv.h" |
| 46 | |
| 47 | /* |
| 48 | * Declaring these like this adds NULL termination. |
| 49 | */ |
| 50 | static const uint8_t ec_pubkey_oid[] = MBEDTLS_OID_EC_ALG_UNRESTRICTED; |
| 51 | static const uint8_t ec_secp256r1_oid[] = MBEDTLS_OID_EC_GRP_SECP256R1; |
| 52 | |
| 53 | /* |
| 54 | * Parse the public key used for signing. |
| 55 | */ |
Roman Okhrimenko | 2f045a2 | 2021-03-05 14:06:33 +0200 | [diff] [blame] | 56 | #ifdef CY_MBEDTLS_HW_ACCELERATION |
| 57 | static int |
| 58 | bootutil_parse_eckey(mbedtls_ecdsa_context *ctx, uint8_t **p, uint8_t *end) |
| 59 | { |
| 60 | size_t len; |
| 61 | mbedtls_asn1_buf alg; |
| 62 | mbedtls_asn1_buf param; |
| 63 | |
| 64 | if (mbedtls_asn1_get_tag(p, end, &len, |
| 65 | MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE)) { |
| 66 | return -1; |
| 67 | } |
| 68 | end = *p + len; |
| 69 | |
| 70 | if (mbedtls_asn1_get_alg(p, end, &alg, ¶m)) { |
| 71 | return -2; |
| 72 | } |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 73 | if (alg.MBEDTLS_CONTEXT_MEMBER(len) != sizeof(ec_pubkey_oid) - 1 || |
| 74 | memcmp(alg.MBEDTLS_CONTEXT_MEMBER(p), ec_pubkey_oid, sizeof(ec_pubkey_oid) - 1)) { |
Roman Okhrimenko | 2f045a2 | 2021-03-05 14:06:33 +0200 | [diff] [blame] | 75 | return -3; |
| 76 | } |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 77 | if (param.MBEDTLS_CONTEXT_MEMBER(len) != sizeof(ec_secp256r1_oid) - 1 || |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 78 | memcmp(param.MBEDTLS_CONTEXT_MEMBER(p), ec_secp256r1_oid, sizeof(ec_secp256r1_oid) - 1)) { |
Roman Okhrimenko | 2f045a2 | 2021-03-05 14:06:33 +0200 | [diff] [blame] | 79 | return -4; |
| 80 | } |
| 81 | |
Dovhal Artem (CSUKR CSS ICW SW FW 1) | f7a3d1b | 2022-04-01 15:07:37 +0000 | [diff] [blame] | 82 | if (mbedtls_ecp_group_load(&ctx->MBEDTLS_CONTEXT_MEMBER(grp), MBEDTLS_ECP_DP_SECP256R1)) { |
Roman Okhrimenko | 2f045a2 | 2021-03-05 14:06:33 +0200 | [diff] [blame] | 83 | return -5; |
| 84 | } |
| 85 | |
| 86 | if (mbedtls_asn1_get_bitstring_null(p, end, &len)) { |
| 87 | return -6; |
| 88 | } |
| 89 | if (*p + len != end) { |
| 90 | return -7; |
| 91 | } |
| 92 | |
Dovhal Artem (CSUKR CSS ICW SW FW 1) | f7a3d1b | 2022-04-01 15:07:37 +0000 | [diff] [blame] | 93 | if (mbedtls_ecp_point_read_binary(&ctx->MBEDTLS_CONTEXT_MEMBER(grp), |
| 94 | &ctx->MBEDTLS_CONTEXT_MEMBER(Q), |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 95 | *p, end - *p)) { |
Roman Okhrimenko | 2f045a2 | 2021-03-05 14:06:33 +0200 | [diff] [blame] | 96 | return -8; |
| 97 | } |
| 98 | |
Dovhal Artem (CSUKR CSS ICW SW FW 1) | f7a3d1b | 2022-04-01 15:07:37 +0000 | [diff] [blame] | 99 | if (mbedtls_ecp_check_pubkey(&ctx->MBEDTLS_CONTEXT_MEMBER(grp), |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 100 | &ctx->MBEDTLS_CONTEXT_MEMBER(Q))) { |
Roman Okhrimenko | 2f045a2 | 2021-03-05 14:06:33 +0200 | [diff] [blame] | 101 | return -9; |
| 102 | } |
| 103 | return 0; |
| 104 | } |
Roman Okhrimenko | 13f79ed | 2021-03-11 19:05:41 +0200 | [diff] [blame] | 105 | #else /* !CY_MBEDTLS_HW_ACCELERATION */ |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 106 | static int |
Sigvart Hovland | 795cd0d | 2019-03-04 13:06:12 +0100 | [diff] [blame] | 107 | bootutil_import_key(uint8_t **cp, uint8_t *end) |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 108 | { |
| 109 | size_t len; |
| 110 | mbedtls_asn1_buf alg; |
| 111 | mbedtls_asn1_buf param; |
| 112 | |
Fabio Utzig | 33fa8ad | 2017-10-05 18:21:30 -0300 | [diff] [blame] | 113 | if (mbedtls_asn1_get_tag(cp, end, &len, |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 114 | MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE)) { |
| 115 | return -1; |
| 116 | } |
Fabio Utzig | 33fa8ad | 2017-10-05 18:21:30 -0300 | [diff] [blame] | 117 | end = *cp + len; |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 118 | |
Fabio Utzig | 33fa8ad | 2017-10-05 18:21:30 -0300 | [diff] [blame] | 119 | /* ECParameters (RFC5480) */ |
| 120 | if (mbedtls_asn1_get_alg(cp, end, &alg, ¶m)) { |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 121 | return -2; |
| 122 | } |
Fabio Utzig | 33fa8ad | 2017-10-05 18:21:30 -0300 | [diff] [blame] | 123 | /* id-ecPublicKey (RFC5480) */ |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 124 | if (alg.MBEDTLS_CONTEXT_MEMBER(len) != sizeof(ec_pubkey_oid) - 1 || |
| 125 | memcmp(alg.MBEDTLS_CONTEXT_MEMBER(p), ec_pubkey_oid, sizeof(ec_pubkey_oid) - 1)) { |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 126 | return -3; |
| 127 | } |
Fabio Utzig | 33fa8ad | 2017-10-05 18:21:30 -0300 | [diff] [blame] | 128 | /* namedCurve (RFC5480) */ |
Roman Okhrimenko | 977b375 | 2022-03-31 14:40:48 +0300 | [diff] [blame] | 129 | if (param.MBEDTLS_CONTEXT_MEMBER(len) != sizeof(ec_secp256r1_oid) - 1 || |
| 130 | memcmp(param.MBEDTLS_CONTEXT_MEMBER(p), ec_secp256r1_oid, sizeof(ec_secp256r1_oid) - 1)) { |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 131 | return -4; |
| 132 | } |
Fabio Utzig | 33fa8ad | 2017-10-05 18:21:30 -0300 | [diff] [blame] | 133 | /* ECPoint (RFC5480) */ |
| 134 | if (mbedtls_asn1_get_bitstring_null(cp, end, &len)) { |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 135 | return -6; |
| 136 | } |
Fabio Utzig | 33fa8ad | 2017-10-05 18:21:30 -0300 | [diff] [blame] | 137 | if (*cp + len != end) { |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 138 | return -7; |
| 139 | } |
| 140 | |
| 141 | if (len != 2 * NUM_ECC_BYTES + 1) { |
| 142 | return -8; |
| 143 | } |
Blaž Hrastnik | 4f4833d | 2020-09-14 13:53:31 +0900 | [diff] [blame] | 144 | |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 145 | return 0; |
| 146 | } |
Roman Okhrimenko | 13f79ed | 2021-03-11 19:05:41 +0200 | [diff] [blame] | 147 | #endif /* CY_MBEDTLS_HW_ACCELERATION */ |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 148 | |
David Brown | 641af45 | 2021-02-19 12:16:48 -0700 | [diff] [blame] | 149 | #ifndef MCUBOOT_ECDSA_NEED_ASN1_SIG |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 150 | /* |
| 151 | * cp points to ASN1 string containing an integer. |
| 152 | * Verify the tag, and that the length is 32 bytes. |
| 153 | */ |
| 154 | static int |
Sigvart Hovland | 795cd0d | 2019-03-04 13:06:12 +0100 | [diff] [blame] | 155 | bootutil_read_bigint(uint8_t i[NUM_ECC_BYTES], uint8_t **cp, uint8_t *end) |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 156 | { |
| 157 | size_t len; |
| 158 | |
| 159 | if (mbedtls_asn1_get_tag(cp, end, &len, MBEDTLS_ASN1_INTEGER)) { |
| 160 | return -3; |
| 161 | } |
Szymon Janc | 1618488 | 2017-09-22 18:32:11 -0300 | [diff] [blame] | 162 | |
Fabio Utzig | 006994b | 2019-01-16 16:33:20 -0800 | [diff] [blame] | 163 | if (len >= NUM_ECC_BYTES) { |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 164 | (void)memcpy(i, *cp + len - NUM_ECC_BYTES, NUM_ECC_BYTES); |
Marko Kiiskila | 755daed | 2016-12-30 18:53:13 -0800 | [diff] [blame] | 165 | } else { |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 166 | (void)memset(i, 0, NUM_ECC_BYTES - len); |
| 167 | (void)memcpy(i + NUM_ECC_BYTES - len, *cp, len); |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 168 | } |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 169 | *cp += len; |
| 170 | return 0; |
| 171 | } |
| 172 | |
| 173 | /* |
| 174 | * Read in signature. Signature has r and s encoded as integers. |
| 175 | */ |
| 176 | static int |
Sigvart Hovland | 795cd0d | 2019-03-04 13:06:12 +0100 | [diff] [blame] | 177 | bootutil_decode_sig(uint8_t signature[NUM_ECC_BYTES * 2], uint8_t *cp, uint8_t *end) |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 178 | { |
| 179 | int rc; |
| 180 | size_t len; |
| 181 | |
| 182 | rc = mbedtls_asn1_get_tag(&cp, end, &len, |
| 183 | MBEDTLS_ASN1_CONSTRUCTED | MBEDTLS_ASN1_SEQUENCE); |
| 184 | if (rc) { |
| 185 | return -1; |
| 186 | } |
David Brown | baff96f | 2017-01-27 17:35:14 -0700 | [diff] [blame] | 187 | if (cp + len > end) { |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 188 | return -2; |
| 189 | } |
Szymon Janc | 1618488 | 2017-09-22 18:32:11 -0300 | [diff] [blame] | 190 | |
Sigvart Hovland | 795cd0d | 2019-03-04 13:06:12 +0100 | [diff] [blame] | 191 | rc = bootutil_read_bigint(signature, &cp, end); |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 192 | if (rc) { |
| 193 | return -3; |
| 194 | } |
Sigvart Hovland | 795cd0d | 2019-03-04 13:06:12 +0100 | [diff] [blame] | 195 | rc = bootutil_read_bigint(signature + NUM_ECC_BYTES, &cp, end); |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 196 | if (rc) { |
| 197 | return -4; |
| 198 | } |
| 199 | return 0; |
| 200 | } |
David Brown | 641af45 | 2021-02-19 12:16:48 -0700 | [diff] [blame] | 201 | #endif /* not MCUBOOT_ECDSA_NEED_ASN1_SIG */ |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 202 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 203 | fih_int |
Fabio Utzig | 1a927dd | 2017-12-05 10:30:26 -0200 | [diff] [blame] | 204 | bootutil_verify_sig(uint8_t *hash, uint32_t hlen, uint8_t *sig, size_t slen, |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 205 | uint8_t key_id) |
| 206 | { |
| 207 | int rc; |
Blaž Hrastnik | 4f4833d | 2020-09-14 13:53:31 +0900 | [diff] [blame] | 208 | bootutil_ecdsa_p256_context ctx; |
Fabio Utzig | 33fa8ad | 2017-10-05 18:21:30 -0300 | [diff] [blame] | 209 | uint8_t *pubkey; |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 210 | uint8_t *end; |
Szymon Janc | 1618488 | 2017-09-22 18:32:11 -0300 | [diff] [blame] | 211 | |
David Brown | 641af45 | 2021-02-19 12:16:48 -0700 | [diff] [blame] | 212 | #ifndef MCUBOOT_ECDSA_NEED_ASN1_SIG |
Szymon Janc | 1618488 | 2017-09-22 18:32:11 -0300 | [diff] [blame] | 213 | uint8_t signature[2 * NUM_ECC_BYTES]; |
David Brown | 641af45 | 2021-02-19 12:16:48 -0700 | [diff] [blame] | 214 | #endif |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 215 | |
Fabio Utzig | 33fa8ad | 2017-10-05 18:21:30 -0300 | [diff] [blame] | 216 | pubkey = (uint8_t *)bootutil_keys[key_id].key; |
| 217 | end = pubkey + *bootutil_keys[key_id].len; |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 218 | |
Roman Okhrimenko | 2f045a2 | 2021-03-05 14:06:33 +0200 | [diff] [blame] | 219 | #ifdef CY_MBEDTLS_HW_ACCELERATION |
| 220 | mbedtls_ecdsa_init(&ctx); |
| 221 | rc = bootutil_parse_eckey(&ctx, &pubkey, end); |
| 222 | #else |
Sigvart Hovland | 795cd0d | 2019-03-04 13:06:12 +0100 | [diff] [blame] | 223 | rc = bootutil_import_key(&pubkey, end); |
Roman Okhrimenko | 2f045a2 | 2021-03-05 14:06:33 +0200 | [diff] [blame] | 224 | #endif |
Dovhal Artem (CSUKR CSS ICW SW FW 1) | f7a3d1b | 2022-04-01 15:07:37 +0000 | [diff] [blame] | 225 | if (rc != 0) { |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 226 | return FIH_FAILURE; |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 227 | } |
| 228 | |
David Brown | 641af45 | 2021-02-19 12:16:48 -0700 | [diff] [blame] | 229 | #ifndef MCUBOOT_ECDSA_NEED_ASN1_SIG |
Sigvart Hovland | 795cd0d | 2019-03-04 13:06:12 +0100 | [diff] [blame] | 230 | rc = bootutil_decode_sig(signature, sig, sig + slen); |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 231 | if (rc != 0) { |
| 232 | return FIH_FAILURE; |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 233 | } |
David Brown | 641af45 | 2021-02-19 12:16:48 -0700 | [diff] [blame] | 234 | #endif |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 235 | |
| 236 | /* |
| 237 | * This is simplified, as the hash length is also 32 bytes. |
| 238 | */ |
Roman Okhrimenko | 2f045a2 | 2021-03-05 14:06:33 +0200 | [diff] [blame] | 239 | #ifdef CY_MBEDTLS_HW_ACCELERATION |
Dovhal Artem (CSUKR CSS ICW SW FW 1) | f7a3d1b | 2022-04-01 15:07:37 +0000 | [diff] [blame] | 240 | |
Roman Okhrimenko | 2f045a2 | 2021-03-05 14:06:33 +0200 | [diff] [blame] | 241 | rc = mbedtls_ecdsa_read_signature(&ctx, hash, hlen, sig, slen); |
| 242 | |
| 243 | #else /* CY_MBEDTLS_HW_ACCELERATION */ |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 244 | if (hlen != NUM_ECC_BYTES) { |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 245 | return FIH_FAILURE; |
Marko Kiiskila | bf94339 | 2016-12-29 17:29:48 -0800 | [diff] [blame] | 246 | } |
| 247 | |
Blaž Hrastnik | 4f4833d | 2020-09-14 13:53:31 +0900 | [diff] [blame] | 248 | bootutil_ecdsa_p256_init(&ctx); |
David Brown | 641af45 | 2021-02-19 12:16:48 -0700 | [diff] [blame] | 249 | #ifdef MCUBOOT_ECDSA_NEED_ASN1_SIG |
| 250 | rc = bootutil_ecdsa_p256_verify(&ctx, pubkey, end - pubkey, hash, sig, slen); |
| 251 | #else |
| 252 | rc = bootutil_ecdsa_p256_verify(&ctx, pubkey, end - pubkey, hash, signature, |
| 253 | 2 * NUM_ECC_BYTES); |
| 254 | #endif |
Roman Okhrimenko | 2f045a2 | 2021-03-05 14:06:33 +0200 | [diff] [blame] | 255 | #endif /* CY_MBEDTLS_HW_ACCELERATION */ |
| 256 | |
Blaž Hrastnik | 4f4833d | 2020-09-14 13:53:31 +0900 | [diff] [blame] | 257 | bootutil_ecdsa_p256_drop(&ctx); |
Roman Okhrimenko | 2f045a2 | 2021-03-05 14:06:33 +0200 | [diff] [blame] | 258 | |
Roman Okhrimenko | dc0ca08 | 2023-06-21 20:49:51 +0300 | [diff] [blame] | 259 | FIH_RET(fih_int_encode_zero_equality(rc)); |
Sigvart Hovland | 65a6ab2 | 2019-03-11 15:56:04 +0100 | [diff] [blame] | 260 | } |
Blaž Hrastnik | 4f4833d | 2020-09-14 13:53:31 +0900 | [diff] [blame] | 261 | |
Roman Okhrimenko | 1dcc73b | 2020-10-01 19:22:14 +0300 | [diff] [blame] | 262 | #endif /* MCUBOOT_USE_TINYCRYPT || defined MCUBOOT_USE_CC310 */ |
Fabio Utzig | 19356bf | 2017-05-11 16:19:36 -0300 | [diff] [blame] | 263 | #endif /* MCUBOOT_SIGN_EC256 */ |