LockSys is a lightweight, security-focused C library for local PIN/passphrase access control in embedded systems.
Built for hardware hackers, embedded devs, and security engineers, LockSys handles secure credential checks, lockout logic, and cryptographic protection of persistent data. Whether you're building a DIY safe or a hardened kiosk, LockSys is meant to drop in and stay out of your way.
⚠️ LockSys is an early-stage security project. Not production-ready.
Some features are placeholders or partially implemented. Use at your own risk. Contributions, feedback, and testing are very welcome.
LockSys aims to become a COTS-ready access control library:
Low-resource for embedded systems
High-security by default
Reliable across hardware platforms
Free and open source for real-world use, inspection, and verification
I’d love support from the community to help make LockSys a trustworthy foundation for physical access systems—whether for DIY safes or production kiosks.
- Secure device-unique HMAC-based PIN storage (constant-time comparison)
- Explicit memory zeroization of secrets
- Lockout and disable logic with persistent attempt tracking
- Portable HAL (hardware abstraction layer) for platform support
- Compatible with EEPROM/Flash for offline systems
- Builds cleanly on MCUs, Linux, Windows, Arduino, etc.
- Physical access control for safes, lockers, and kiosks
- Embedded systems, Microcontroller-based, with limited resources and high security demands
- IoT enclosures without cloud dependencies
- Projects needing cryptographic protection without full disk encryption
This project supports both desktop platforms (Windows, Linux, macOS) and Arduino microcontrollers.
- CMake 3.16+
- A C compiler:
- Windows: MinGW or Visual Studio
- Linux/macOS: GCC or Clang
Optional:
clang-formatfor formattingclang-tidyfor linting
mkdir buildcd buildcmake -DCRYPTO_BACKEND_TINYCRYPT=ON ..cmake --build . --target bootstrap_posix./bin/bootstrapcmake --build . --target main_posix./bin/mainmkdir buildcd buildcmake -G "MinGW Makefiles" -DCRYPTO_BACKEND_TINYCRYPT=ON ..cmake --build . --target bootstrap_winbin\bootstrap.execmake --build . --target main_winbin\main.exe- Build the bootstrap application – initializes logs, storage, and user database.
- Run the bootstrap app – sets up the initial root admin account.
- Build the main application – the normal operational interface.
- The bootstrap app is no longer required – but can reset the system if storage is retained.
- The bootstrap and main applications share a generated device key stored in
device_key.generated.h. - If this key changes, existing storage becomes unusable.
- To recreate a valid root account, the bootstrap app must match the device key used by the main application.
You can use the Arduino IDE directly — no CMake needed.
A default
device_key.generated.his included for convenience. Users who are only working within the Arduino IDE (without a CLI or build tools) must manually edit this file to customize the device key for each unit.
⚠️ After making changes to the library (includingdevice_key.generated.h), you must restart the Arduino IDE to ensure changes are applied correctly.
- Upload:
examples/arduino/BootstrapSystem/BootstrapSystem.ino - Run the sketch to initialize device storage and root admin account.
- Then upload:
examples/arduino/OpenLock/OpenLock.ino - The system is now ready for normal use. The bootstrap firmware is no longer needed.
The two Arduino programs must use the same device key. Customize configuration in:
src/global/config.h
build/ → CMake output (binaries, storage, device key)
doc/ → Design notes and threat model
examples/ → Example applications (main.c, Arduino sketches)
src/ → Core implementation
src/crypto/ → Crypto interface
src/extern/ → Embedded libraries (mbedTLS, TinyCrypt)
src/global/ → Core config, user, and device key logic
src/hal/ → Platform-specific I/O (windows, posix, arduino)
src/logging/ → Logging interfaces (planned)
tests/ → Unit tests and mocks
tools/ → Bootstrap and key generation utilities
- Regenerate the device key for each deployed device
- Never reuse the same device key across production units
- Do not commit
device_key.generated.hor generated secrets to version control - Securely erase provisioning files once the system is deployed:
src/global/device_key.generated.h
build/*
| Capability | Supported | Notes |
|---|---|---|
| Constant-time HMAC PIN validation | ✅ | SHA256 HMAC |
| Memory zeroization of secrets | ✅ | Manual volatile overwrite |
| Lockout logic + retry throttling | ✅ | Configurable thresholds |
| Platform HAL abstraction | ✅ | Arduino, POSIX, Windows |
| Persistent lock state | ✅ | EEPROM/Flash supported |
| Secure audit logs | HMAC log storage planned | |
| Arduino IDE support | ✅ | BootstrapSystem.ino, OpenLock.ino |
| Networked auth / SSO / OAuth | ❌ | Not supported, by design |
| Secure messaging / file crypto | ❌ | Out of scope |
| HIPAA / FIPS 140-2 / compliance | ❌ | No certs. Use at your own risk |
We welcome:
- Feedback or security concerns (open an issue)
- Platform ports (new HALs)
- Example integrations or test cases
See CONTRIBUTING.md for details.
MIT – Free for personal and commercial use.
Developed by Ross Kinard – 2025