SDK Reference¶
The EmbSec SDK provides a simplified abstraction layer over TivaWare for embedded security lab development. It includes essential functions for UART communication, GPIO control, timing, cryptography, and secure flag generation.
Overview¶
The SDK is designed to make embedded programming more accessible while teaching fundamental security concepts. It provides:
- Simple APIs - Clean, well-documented functions that abstract complex hardware details
- Security Features - Built-in cryptographic functions and secure flag generation
- Educational Focus - Functions designed to support security lab scenarios
- Cross-platform - Supports both hardware (TM4C123GH6PM) and QEMU emulation
Key Components¶
Core Functions¶
The Core API provides system initialization, interrupt control, and basic utilities.
UART Communication¶
The UART API handles console I/O with functions for character and string operations.
GPIO Control¶
The GPIO API manages digital I/O including LEDs and switches.
Timing Functions¶
The Timer API provides delays, timeouts, and performance measurement.
Cryptography¶
The Crypto API includes SHA-256 hashing, HMAC, and secure random generation.
Flag Generation¶
The Flag API generates unique, cryptographically secure flags for CTF challenges.
Getting Started¶
Every program using the EmbSec SDK should start with:
#include <embsec/embsec.h>
#include <embsec/uart.h>
// Include other headers as needed
int main(void) {
// Initialize the SDK
embsec_init();
// Your code here
embsec_printf("Hello, EmbSec!\n");
while (1) {
// Main loop
}
}
Version Information¶
The SDK version can be checked at compile time:
#include <embsec/version.h>
#if !EMBSEC_VERSION_CHECK(1, 0, 0)
#error "EmbSec SDK 1.0.0 or later required"
#endif
Or at runtime:
Header Files¶
All SDK headers are located in sdk/include/embsec/:
embsec.h- Main SDK header with core functionsuart.h- UART communication functionsgpio.h- GPIO control functionstimer.h- Timing and delay functionscrypto.h- Cryptographic functionsflag.h- Flag generation functionsversion.h- Version information
Building with the SDK¶
The SDK is automatically included when building labs with CMake:
This automatically:
- Links the EmbSec SDK library
- Includes SDK headers
- Configures for the target platform
- Sets up proper compiler flags
Platform Support¶
The SDK supports two platforms:
Hardware (TM4C123GH6PM)¶
- Texas Instruments Tiva C Series LaunchPad
- 80MHz ARM Cortex-M4F
- Hardware peripherals (UART, GPIO, timers)
Emulation (QEMU)¶
- QEMU emulation of LM3S6965
- Same API, adapted for emulation
- Ideal for development and testing
Memory Considerations¶
The SDK is designed for constrained embedded systems:
- Minimal RAM usage
- Efficient stack usage
- No dynamic memory allocation
- Compile-time configuration where possible
Security Considerations¶
When using the SDK for security labs:
- Flag Generation - Always use the provided flag generation functions
- Crypto Functions - Use constant-time comparison for sensitive data
- Memory Clearing - Use
embsec_secure_zero()for sensitive data - Random Numbers - Use
embsec_random_bytes()for cryptographic randomness
Examples¶
See the Examples page for complete code examples demonstrating:
- Basic I/O operations
- LED and switch control
- Timer usage
- Flag generation
- Cryptographic operations
API Reference¶
For detailed function documentation, see:
- Complete API Reference
- Individual module documentation (linked above)
Support¶
For issues or questions:
- Check the Examples page
- Review lab implementations in
labs/ - Consult the TivaWare documentation for hardware details