Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PSA implementation of ed25519 image verification and x25519 random key encryption/decryption #323

Merged
merged 14 commits into from
Sep 27, 2024

Commits on Sep 26, 2024

  1. [nrf fromtree] boot: Fix ASN.1 for mbedtls >= 3.1

    In Mbed TLS 3.1, the private fields in the ASN.1 structure were made private.
    This breaks code that accesses these private macros.
    
    Fix this by changing the ASN.1 specific code to use a new field accessor
    `ASN1_CONTEXT_MEMBER` that will be conditionally defined based on the version of
    Mbed TLS that is present.
    
    Signed-off-by: David Brown <david.brown@linaro.org>
    (cherry picked from commit 1d79ef3)
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    d3zd3z authored and de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    c2cc2ab View commit details
    Browse the repository at this point in the history
  2. [nrf fromtree] bootutil: Keep image encrypted in scratch area

    Currently, when swap using scratch is used with encrypted images,
    MCUboot is decrypting the images during the copy from the secondary slot
    to the scratch area. This means the scratch area contains plaintext
    image data and therefore that the scratch area must be placed in the
    MCU's internal flash memory. This commit makes the necessary changes to
    perform the decryption when copying from the scratch area to the primary
    slot instead, making possible to place the scratch area in an external
    flash memory since the scratch area is now encrypted.
    
    Note that BOOT_SWAP_SAVE_ENCTLV must be enabled if the scratch area is
    placed in external flash memory.
    
    Signed-off-by: Thomas Altenbach <thomas.altenbach@legrand.com>
    (cherry picked from commit 08d2d94)
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    taltenbach authored and de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    acf52b0 View commit details
    Browse the repository at this point in the history
  3. [nrf fromtree] boot: Remove pointless slot identification

    In the boot_image_validate_encrypted there was call to
    flash_area_id_to_multi_image_slot, which tries to figure out
    slot index from flash area and image index, and the result of the
    call was not used for anything as slot index is hardcoded in the
    next call to be 1 (secondary).
    
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    (cherry picked from commit 4da4a72)
    de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    543a630 View commit details
    Browse the repository at this point in the history
  4. [nrf fromtree] boot: Rename boot_enc_decrypt to boot_decrypt_key

    All of boot_enc_ function follow the same pattern where
    they take encryption context as the first parameter, and the
    boot_enc_decrypt stands out here as it does not work around
    the encryption context, but is rather single-part decryption
    function only used for decrypting of the image encryption
    key.
    
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    (cherry picked from commit 2371c0a)
    de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    257125e View commit details
    Browse the repository at this point in the history
  5. [nrf fromtree] boot: Move encryption context invalidation to boot_enc…

    …_drop.
    
    The enc_key_data.valid had been set to true when key has been added
    to the encryption context, but in case when boot_enc_drop was called,
    on the same context, the flag remained true, even though the context
    may no longer hold any valid context nor key.
    The commit moves the enc_key_data invalidation to enc_key_drop.
    
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    (cherry picked from commit 3355735)
    de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    774813a View commit details
    Browse the repository at this point in the history
  6. [nrf fromtree] boot: Change boot_enc_load to take slot number instead…

    … of image
    
    In all cases where boot_enc_load is called it is known what slot
    is addressed, so it is better to just pass the slot number
    instead of making the boot_enc_load figure out slot number from
    image index and provided flash area object.
    
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    (cherry picked from commit 7f9ac97)
    de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    5507a5e View commit details
    Browse the repository at this point in the history
  7. [nrf fromtree] boot: Reduce repeating code in boot_decrypt_and_copy_i…

    …mage_to_sram
    
    There was not really needed repetition of code in if-else
    block; common code has been moved out and the block has been
    reduced.
    
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    (cherry picked from commit d09112a)
    de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    728d056 View commit details
    Browse the repository at this point in the history
  8. [nrf fromtree] Fix style issues

    Convert tab to spaces; fix opening brace position.
    
    Signed-off-by: Fabio Utzig <utzig@apache.org>
    (cherry picked from commit d5e0e89)
    utzig authored and de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    0bd46d6 View commit details
    Browse the repository at this point in the history
  9. [nrf fromtree] boot: Remove image_index from boot_encrypt

    boot_encrypt required the image_index paired with flash area pointer
    to be able to figure out which slot it will operate on.
    Since in most calls the slot is known in advance it can be just
    passed to the function directly.
    The commit replaces both parameters with slot number.
    
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    (cherry picked from commit 3f11286)
    de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    9c75592 View commit details
    Browse the repository at this point in the history
  10. [nrf fromtree] boot: Simplify copy loop in boot_copy_region

    Move checking of conditions, which remain the same for the whole
    loop run, outside of the loop.
    
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    (cherry picked from commit 6fe259b)
    de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    2023198 View commit details
    Browse the repository at this point in the history
  11. [nrf fromtree] boot: Make boot_enc_valid take slot instead of image i…

    …ndex
    
    There is no point for boot_enc_valid to take image index and
    flash area and use these to figure out slot number.
    
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    (cherry picked from commit 956311d)
    de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    e02b962 View commit details
    Browse the repository at this point in the history
  12. [nrf fromlist] boot: Replace boot_encrypt by boot_enc_encrypt and boo…

    …t_enc_decrypt
    
    To be able to implement encryption with API that requires different
    calls for encryption and encryption, the boot_encrypt
    needs to be replaced with encryption/decryption specific functions.
    
    Upstream PR: mcu-tools/mcuboot#2017
    
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    34f51df View commit details
    Browse the repository at this point in the history
  13. [nrf noup] PSA configuration required changes

    Set of changes to Kconfig, CMakeLists.txt and some of headers
    that are required for the PSA support to compile.
    
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    691d763 View commit details
    Browse the repository at this point in the history
  14. [nrf noup] PSA implementation of x25519 and ed25519 verification

    The commit provides implementation of image verification with
    ed25519 and encryption/decryption support where random key
    is encrypted using x25519.
    
    Signed-off-by: Dominik Ermel <dominik.ermel@nordicsemi.no>
    de-nordic committed Sep 26, 2024
    Configuration menu
    Copy the full SHA
    0d4c91e View commit details
    Browse the repository at this point in the history