Skip to content

Conversation

@mattia-moffa
Copy link
Contributor

@mattia-moffa mattia-moffa commented Dec 24, 2025

This basically adds ENCRYPT_PKCS11 and a few new options which make wolfBoot use wolfPKCS11 as the crypto backend for partition encryption (rather than plain wolfCrypt), let the application store the encryption key in the keyvault with a specific ID and make that ID available to wolfBoot. More info in the changes to docs/encrypted_partitions.md.

@mattia-moffa mattia-moffa self-assigned this Dec 24, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds PKCS#11 backend support for encrypted partitions in wolfBoot, enabling the use of wolfPKCS11 as the crypto backend for partition encryption instead of plain wolfCrypt. The implementation allows applications to store encryption keys in the keyvault with a specific ID, which wolfBoot can then retrieve and use for encryption operations.

Key changes include:

  • Added new ENCRYPT_PKCS11 configuration option with support for PKCS#11-based encryption
  • Implemented PKCS11 crypto functions (init, encrypt, decrypt, set_iv, deinit) in src/libwolfboot.c
  • Fixed variable scoping issues for sel_sec to only declare it when NVM_FLASH_WRITEONCE is defined
  • Updated build configuration in options.mk to handle PKCS11 encryption alongside existing AES and ChaCha options

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/update_flash.c Moved WP11_Library_Init() call earlier in boot sequence and added pkcs11_crypto_deinit() cleanup call
src/libwolfboot.c Added complete PKCS11 crypto implementation with init/deinit/encrypt/decrypt functions; fixed variable scoping for sel_sec
options.mk Added PKCS11 encryption configuration logic with mechanism selection and parameter definitions; updated AES object inclusion logic
include/wolfboot/wolfboot.h Added ENCRYPT_PKCS11 macro definitions for block size, key size, and nonce size
include/user_settings.h Added conditional compilation guards for AES settings; removed direct ENCRYPT_WITH_AES128 definition
include/encrypt.h Added PKCS11 crypto function declarations and macro definitions
docs/encrypted_partitions.md Added comprehensive documentation for PKCS#11 backend configuration and usage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@mattia-moffa mattia-moffa removed their assignment Dec 30, 2025
@danielinux danielinux merged commit 0462e0a into wolfSSL:master Dec 30, 2025
302 checks passed
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