Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,6 @@ the value of the current secure level.
- add build version in bootloader
- Fix the reason field of test_case3, change its value from 4 to 2.
2.Fix GCM AAD padding when plaintext length is zero

== version beken_trustzone pr-232 2026/10/28-22:38:00==
1. Provide an API for verifying public key hashes to the kernel.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@


#pragma once
#include <stdint.h>
#include <soc/soc.h>
#include "hal_port.h"
#include "system_hw.h"
Expand Down Expand Up @@ -66,6 +67,22 @@ bk_err_t bk_otp_read_swd_nsc(bool *swd_enabled);

bk_err_t bk_otp_read_download_nsc(bool *download_enabled);

/**
* @brief Verify a SHA256 public key hash against OTP_BL2_BOOT_PUBLIC_KEY_HASH.
*
* The comparison is performed in the secure side: the trusted hash is read
* from OTP and never handed to the non-secure firmware.
*
* @param[in] hash SHA256 digest of the DER encoded SubjectPublicKeyInfo.
* @param[in] size Size of @p hash in bytes, must be 32.
*
* @return TFM_OTP_PUBKEY_HASH_MATCH hash matches the trusted OTP value
* TFM_OTP_PUBKEY_HASH_MISMATCH hash does not match
* TFM_OTP_PUBKEY_HASH_READ_FAIL OTP read failed
* TFM_OTP_PUBKEY_HASH_BAD_ARG invalid argument
*/
int32_t bk_otp_verify_pubkey_hash_nsc(const uint8_t *hash, uint32_t size);

#ifdef __cplusplus
}
#endif
Binary file modified os/board/bk7239n/src/components/tfm/tfm_xip_build/_build/bl2.bin
Binary file not shown.
Binary file modified os/board/bk7239n/src/components/tfm/tfm_xip_build/_build/tfm_s.bin
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@


#pragma once
#include <stdint.h>
#include <soc/soc.h>
#include "hal_port.h"
#include "system_hw.h"
Expand Down Expand Up @@ -66,6 +67,22 @@ bk_err_t bk_otp_read_swd_nsc(bool *swd_enabled);

bk_err_t bk_otp_read_download_nsc(bool *download_enabled);

/**
* @brief Verify a SHA256 public key hash against OTP_BL2_BOOT_PUBLIC_KEY_HASH.
*
* The comparison is performed in the secure side: the trusted hash is read
* from OTP and never handed to the non-secure firmware.
*
* @param[in] hash SHA256 digest of the DER encoded SubjectPublicKeyInfo.
* @param[in] size Size of @p hash in bytes, must be 32.
*
* @return TFM_OTP_PUBKEY_HASH_MATCH hash matches the trusted OTP value
* TFM_OTP_PUBKEY_HASH_MISMATCH hash does not match
* TFM_OTP_PUBKEY_HASH_READ_FAIL OTP read failed
* TFM_OTP_PUBKEY_HASH_BAD_ARG invalid argument
*/
int32_t bk_otp_verify_pubkey_hash_nsc(const uint8_t *hash, uint32_t size);

#ifdef __cplusplus
}
#endif
6 changes: 5 additions & 1 deletion os/se/armino/Make.defs
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ else
tfm_firmware_dir_name := tfm_loadable_build
endif

# Board (NS side) headers must be searched before the TF-M armino headers,
# otherwise components/log.h and soc/soc.h resolve to the Secure side ones,
# which require the CMake-generated armino_config.h.
CFLAGS += -I$(TOPDIR)/board/bk7239n/src/include

ifneq ($(wildcard $(TOPDIR)/board/bk7239n/src/components/tfm/tfm/CMakeLists.txt),)
CFLAGS += -I$(TOPDIR)/board/bk7239n/src/components/tfm/tfm/interface/include
CFLAGS += -I$(TOPDIR)/board/bk7239n/src/components/tfm/tfm/platform/ext/target/beken/armino/include
else
CFLAGS += -I$(TOPDIR)/board/bk7239n/src/components/tfm/$(tfm_firmware_dir_name)/tfm_install/interface/include
endif
CFLAGS += -I$(TOPDIR)/se/armino/include
CFLAGS += -I$(TOPDIR)/board/bk7239n/src/include
endif