David Brown | 902d617 | 2017-05-05 09:37:41 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 Linaro Limited |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include <bootutil/caps.h> |
Marti Bolivar | f91bca5 | 2018-04-12 12:40:46 -0400 | [diff] [blame] | 18 | #include "mcuboot_config/mcuboot_config.h" |
David Brown | 902d617 | 2017-05-05 09:37:41 -0600 | [diff] [blame] | 19 | |
| 20 | uint32_t bootutil_get_caps(void) |
| 21 | { |
| 22 | uint32_t res = 0; |
| 23 | |
Fabio Utzig | 3488eef | 2017-06-12 10:25:43 -0300 | [diff] [blame] | 24 | #if defined(MCUBOOT_SIGN_RSA) |
David Brown | 902d617 | 2017-05-05 09:37:41 -0600 | [diff] [blame] | 25 | res |= BOOTUTIL_CAP_RSA2048; |
| 26 | #endif |
Fabio Utzig | 3488eef | 2017-06-12 10:25:43 -0300 | [diff] [blame] | 27 | #if defined(MCUBOOT_SIGN_EC) |
David Brown | 902d617 | 2017-05-05 09:37:41 -0600 | [diff] [blame] | 28 | res |= BOOTUTIL_CAP_ECDSA_P224; |
| 29 | #endif |
Fabio Utzig | 3488eef | 2017-06-12 10:25:43 -0300 | [diff] [blame] | 30 | #if defined(MCUBOOT_SIGN_EC256) |
David Brown | 902d617 | 2017-05-05 09:37:41 -0600 | [diff] [blame] | 31 | res |= BOOTUTIL_CAP_ECDSA_P256; |
| 32 | #endif |
Fabio Utzig | 3488eef | 2017-06-12 10:25:43 -0300 | [diff] [blame] | 33 | #if defined(MCUBOOT_OVERWRITE_ONLY) |
David Brown | 902d617 | 2017-05-05 09:37:41 -0600 | [diff] [blame] | 34 | res |= BOOTUTIL_CAP_OVERWRITE_UPGRADE; |
| 35 | #else |
| 36 | res |= BOOTUTIL_CAP_SWAP_UPGRADE; |
| 37 | #endif |
David Brown | c4a60a3 | 2019-01-11 12:27:51 -0700 | [diff] [blame] | 38 | #if defined(MCUBOOT_ENCRYPT_RSA) |
| 39 | res |= BOOTUTIL_CAP_ENC_RSA; |
| 40 | #endif |
| 41 | #if defined(MCUBOOT_ENCRYPT_KW) |
| 42 | res |= BOOTUTIL_CAP_ENC_KW; |
| 43 | #endif |
David Brown | 8d0afa7 | 2019-01-11 12:31:55 -0700 | [diff] [blame^] | 44 | #if defined(MCUBOOT_VALIDATE_SLOT0) |
| 45 | res |= BOOTUTIL_CAP_VALIDATE_SLOT0; |
| 46 | #endif |
David Brown | 902d617 | 2017-05-05 09:37:41 -0600 | [diff] [blame] | 47 | |
| 48 | return res; |
| 49 | } |