blob: c341f8bf7d7d51468a70fbf98d06db834e4b5816 [file] [log] [blame]
David Brown902d6172017-05-05 09:37:41 -06001/*
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 Bolivarf91bca52018-04-12 12:40:46 -040018#include "mcuboot_config/mcuboot_config.h"
David Brown902d6172017-05-05 09:37:41 -060019
20uint32_t bootutil_get_caps(void)
21{
22 uint32_t res = 0;
23
Fabio Utzig3488eef2017-06-12 10:25:43 -030024#if defined(MCUBOOT_SIGN_RSA)
David Brown902d6172017-05-05 09:37:41 -060025 res |= BOOTUTIL_CAP_RSA2048;
26#endif
Fabio Utzig3488eef2017-06-12 10:25:43 -030027#if defined(MCUBOOT_SIGN_EC)
David Brown902d6172017-05-05 09:37:41 -060028 res |= BOOTUTIL_CAP_ECDSA_P224;
29#endif
Fabio Utzig3488eef2017-06-12 10:25:43 -030030#if defined(MCUBOOT_SIGN_EC256)
David Brown902d6172017-05-05 09:37:41 -060031 res |= BOOTUTIL_CAP_ECDSA_P256;
32#endif
Fabio Utzig3488eef2017-06-12 10:25:43 -030033#if defined(MCUBOOT_OVERWRITE_ONLY)
David Brown902d6172017-05-05 09:37:41 -060034 res |= BOOTUTIL_CAP_OVERWRITE_UPGRADE;
35#else
36 res |= BOOTUTIL_CAP_SWAP_UPGRADE;
37#endif
David Brownc4a60a32019-01-11 12:27:51 -070038#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 Brown902d6172017-05-05 09:37:41 -060044
45 return res;
46}