1 /*
2  * Copyright (c) 2017 Linaro Limited
3  * Copyright (c) 2021-2023 Arm Limited
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *     http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef H_BOOTUTIL_CAPS_H_
19 #define H_BOOTUTIL_CAPS_H_
20 
21 #include <stdint.h>
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 /*
28  * The bootloader can be compile with different capabilities selected
29  * at compile time.  This function provides runtime access to these
30  * capabilities.  This is intended primarily for testing, although
31  * these will possibly be available at runtime to the application
32  * running within the bootloader.
33  */
34 uint32_t bootutil_get_caps(void);
35 
36 #define BOOTUTIL_CAP_RSA2048                (1<<0)
37                                 /* reserved (1<<1) */
38 #define BOOTUTIL_CAP_ECDSA_P256             (1<<2)
39 #define BOOTUTIL_CAP_SWAP_USING_SCRATCH     (1<<3)
40 #define BOOTUTIL_CAP_OVERWRITE_UPGRADE      (1<<4)
41 #define BOOTUTIL_CAP_ENC_RSA                (1<<5)
42 #define BOOTUTIL_CAP_ENC_KW                 (1<<6)
43 #define BOOTUTIL_CAP_VALIDATE_PRIMARY_SLOT  (1<<7)
44 #define BOOTUTIL_CAP_RSA3072                (1<<8)
45 #define BOOTUTIL_CAP_ED25519                (1<<9)
46 #define BOOTUTIL_CAP_ENC_EC256              (1<<10)
47 #define BOOTUTIL_CAP_SWAP_USING_MOVE        (1<<11)
48 #define BOOTUTIL_CAP_DOWNGRADE_PREVENTION   (1<<12)
49 #define BOOTUTIL_CAP_ENC_X25519             (1<<13)
50 #define BOOTUTIL_CAP_BOOTSTRAP              (1<<14)
51 #define BOOTUTIL_CAP_AES256                 (1<<15)
52 #define BOOTUTIL_CAP_RAM_LOAD               (1<<16)
53 #define BOOTUTIL_CAP_DIRECT_XIP             (1<<17)
54 #define BOOTUTIL_CAP_HW_ROLLBACK_PROT       (1<<18)
55 #define BOOTUTIL_CAP_ECDSA_P384             (1<<19)
56 
57 /*
58  * Query the number of images this bootloader is configured for.  This
59  * is also primarily used for testing.
60  */
61 uint32_t bootutil_get_num_images(void);
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 #endif
68