How nxp-auto-linux/pkcs11-hse works
Project type and purpose
• This is a middleware/security‐library project. It implements a PKCS#11 module (“pkcs11-hse.so”) that sits between standard crypto libraries (OpenSSL/libp11) and NXP’s HSE (Hardware Secure Engine).
• Purpose: allow host applications (or tools like OpenSC’s pkcs11-tool) to perform key generation, storage, and cryptographic operations inside the secure HSE, via the standard PKCS#11 API.
File structure
• Top level contains build scripts (Makefile, common.mk), configuration (.checkpatch.conf), and license files.
• libhse/: internal HSE user-mode API, memory abstractions, header definitions.
• libpkcs/: implements the PKCS#11 interface (C files for C_Initialize, C_GenerateKeyPair, etc.), plus redistribution headers.
• examples/: sample host applications demonstrating use of pkcs11-hse.so (e.g., key generation, encryption, TrustZone provisioning).
• No “frontend/backend” split; it’s a native C library, built via Makefiles, cross‐compiled for aarch64.
README for additional insights
• Describes cross‐compiling prerequisites: OpenSSL and libp11 for aarch64, then building pkcs11-hse.so.
• Explains runtime usage: host app links against libp11 and libcrypto, loads the PKCS#11 module, and drives HSE operations.
• Also shows how to integrate with OpenSC’s pkcs11-tool for manual key provisioning.
Elements
• Rectangles: Host App, libp11, pkcs11-hse.so, libhse, HSE Hardware
• Runtime components in another (e.g., green)
• Hardware in a distinct shade (e.g., gray)
• Labels: function calls (C_Initialize, C_GenerateKeyPair, HSE_EncryptCmd, etc.), file/folder names if helpful.