Skip to content

boot:crypto Add custom crypto support#2680

Open
OleksandrShkurchenko wants to merge 1 commit intomcu-tools:mainfrom
OleksandrShkurchenko:custom_crypto_pr
Open

boot:crypto Add custom crypto support#2680
OleksandrShkurchenko wants to merge 1 commit intomcu-tools:mainfrom
OleksandrShkurchenko:custom_crypto_pr

Conversation

@OleksandrShkurchenko
Copy link
Copy Markdown

@OleksandrShkurchenko OleksandrShkurchenko commented Mar 30, 2026

The MCUBOOT_USE_CUSTOM_CRYPTO option allows to implement a custom
backend that lets users plug in any crypto library, hardware
accelerator, proprietary SDK, or another software implementation
without modifying MCUboot's own source.

Copy link
Copy Markdown
Member

@d3zd3z d3zd3z left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. A minor textual change, and adding CI support.

In addition, can you please format the commit text to be less than 72 columns.

Comment thread docs/custom_crypto.md Outdated
# Custom Crypto Backend

MCUboot's crypto abstraction layer supports several open source backends like
`MCUBOOT_USE_MBED_TLS`, `MCUBOOT_USE_TINYCRYPT`, etc. The `MCUBOOT_USE_CUSTOM_CRYPTO` option allows to implement a custom backend that lets users plug in any crypto library —
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line can be wrapped at < 78 or so solumns, which will help when reading these files directly.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment thread sim/Cargo.toml
max-align-32 = ["mcuboot-sys/max-align-32"]
hw-rollback-protection = ["mcuboot-sys/hw-rollback-protection"]
check-load-addr = ["mcuboot-sys/check-load-addr"]
custom-crypto = ["mcuboot-sys/custom-crypto"]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add a custom-crypto configuration, we should also add to .github/workflows/sim.yaml to the build matrix to include testing of this configuration.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment thread boot/bootutil/src/encrypted_psa.c Outdated
Comment on lines +3 to +4
* Copyright (c) 2026 Infineon Technologies AG, or an affiliate of Infineon
* Technologies AG
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Copyright (c) 2026 Infineon Technologies AG, or an affiliate of Infineon
* Technologies AG

let's not add copyrights for 2 line #ifdef changes

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment on lines +7 to +8
* Copyright (c) 2026 Infineon Technologies AG, or an affiliate of Infineon
* Technologies AG
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Copyright (c) 2026 Infineon Technologies AG, or an affiliate of Infineon
* Technologies AG

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Comment on lines +5 to +6
* Copyright (c) 2026 Infineon Technologies AG, or an affiliate of Infineon
* Technologies AG
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Copyright (c) 2026 Infineon Technologies AG, or an affiliate of Infineon
* Technologies AG

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@nordicjm nordicjm requested a review from de-nordic April 9, 2026 14:52
Comment thread docs/custom_crypto.md Outdated
const struct flash_area *fap,
struct boot_status *bs);
bool boot_enc_valid(struct enc_key_data *enc_state, uint8_t slot);
void boot_enc_encrypt(struct enc_key_data *enc_state, uint8_t slot,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code for this function doesn't have a slot argument.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Also reviewed whole .md for such issues in other sections

Comment thread .github/workflows/sim.yaml Outdated
- "ram-load enc-aes256-kw multiimage"
- "ram-load enc-aes256-kw sig-ecdsa-mbedtls multiimage"
- "custom-crypto,custom-crypto overwrite-only,custom-crypto validate-primary-slot"
- "custom-enc-crypto,custom-enc-crypto overwrite-only,custom-enc-crypto validate-primary-slot,custom-enc-crypto max-align-32"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we be testing custom crypto with at least swap-offset, as that is the mode we are generally encouraging people to use.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add swap offset

The `MCUBOOT_USE_CUSTOM_CRYPTO` option allows to implement a custom
backend that lets users plug in any crypto library, hardware
accelerator, proprietary SDK, or another software implementation
without modifying MCUboot's own source.

Signed-off-by: Oleksandr Shkurchenko <Oleksandr.Shkurchenko@infineon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants