Sign Board Lock Application
Overview
The Sign Board Lock application is a C++ embedded system program designed to create a unique digital signature that locks an application to a specific hardware device (board). This signature is generated using the device's MAC address and a company-specific secret key, providing a hardware-based authentication mechanism.
Purpose
This application serves as a device binding security measure by:
- Creating a unique signature based on the device's MAC address
- Using MD5 hashing with a pre-configured secret key
- Storing the resulting signature in the device's flash memory
- Preventing the application from running on unauthorized hardware
How It Works
Core Components
- Secret Key Configuration: The application uses a predefined MD5 context (
YourCompanySecret) containing:
- State values:
{2106921824u, 3945495657u, 2391356351u, 2780313164u}
- Count values:
{512u, 0u}
- Buffer arrays for processing
- MAC Address Retrieval: The program obtains the MAC address from the first available network interface on the device.
- Signature Generation:
- Combines the secret key context with the device's MAC address
- Processes this combination through MD5 hashing
- Produces a 16-byte unique digest
- Storage: The generated signature is stored in the device's UserParam flash memory space.
Program Flow
- Initialization: Network stack and system diagnostics are initialized
- Network Setup: Waits up to 5 seconds for an active network connection (DHCP)
- Board Signing: Executes the
SignBoardLock() function to generate and store the signature
- Continuous Operation: Enters an infinite loop with 1-second delays
Key Functions
SignBoardLock()
- Creates a copy of the company secret MD5 context
- Retrieves the MAC address from the first network interface
- Updates the MD5 context with the MAC address data
- Finalizes the hash to produce a 16-byte digest
- Saves the digest to flash memory using
SaveUserParameters()
UserMain()
- Main application entry point
- Handles system initialization and network setup
- Calls the board signing function
- Maintains the application in a running state
Technical Details
- Hash Algorithm: MD5
- Signature Length: 16 bytes
- MAC Address Length: 6 bytes
Security Considerations
- The secret key (
YourCompanySecret) should be unique to your company/application
- The secret key values in the code should be replaced with your own company-specific values
Build Requirements
- Network interface support
- MD5 hashing library
- Flash memory access functions (
SaveUserParameters)
- RTOS with timing functions (
OSTimeDly, TICKS_PER_SECOND)
Usage Notes
- The application automatically signs the board upon startup
- No user interaction is required during the signing process
- The signature is permanently stored in flash memory
- System diagnostics are enabled by default (should be disabled for production)
Customization
To adapt this application for your use:
- Replace the
ctx_state and ctx_count values with your company-specific secret
- Disable system diagnostics for production deployment
Output
The application provides console output indicating:
- "Application started" - when initialization is complete
- "Board signed" - when the signature has been successfully generated and stored