Audit-clean C standard across all 5 cb challenges: fix 3 functions over 8 exec lines; rebuild bins; update CB-0x03 and CB-0x05 guides; verify all guides against new bins

This commit is contained in:
Kevin Thomas committed 2026-10-11 17:43:45 -04:00
1 parent 4ade66738f
commit 23b9f628ef
51 files changed
+3744 -7904

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
/**
* @file crypto.h
* @brief Lightweight rolling cipher interface for Operation Iron Net
* @author Kevin Thomas
* @date 2026
*
* MIT License
* Copyright (c) 2026 Kevin Thomas
*/
#ifndef CRYPTO_H
#define CRYPTO_H
#include <stdint.h>
#include <stddef.h>
#define TOKEN_LEN 8
/**
* @brief Decrypt the rolling strike authorization token into a buffer.
* @param dest Pointer to buffer receiving the decrypted token bytes.
* @return void No return value.
*/
void decrypt_auth_token(uint8_t *dest);
#endif /* CRYPTO_H */
+20 -1
View File
@@ -10,14 +10,33 @@
#ifndef DHT11_H
#define DHT11_H
#include <stdint.h>
#include <stdbool.h>
#define DHT11_PIN 14
typedef struct {
uint8_t humidity_int;
uint8_t humidity_dec;
uint8_t temp_int;
uint8_t temp_dec;
uint8_t checksum;
bool valid;
} dht11_data_t;
/**
* @brief Initialize the DHT11 data pin and idle the sensor high.
* @param void No parameters.
* @return void No return value.
*/
void dht11_init(void);
/**
* @brief Perform a single-wire DHT11 read into the reading cache.
* @param void No parameters.
* @return dht11_data_t* Pointer to the current sensor reading.
*/
dht11_data_t* dht11_read(void);
#endif
#endif // DHT11_H
+63
View File
@@ -0,0 +1,63 @@
/**
* @file gpio_ctrl.h
* @brief Operation Iron Net Firmware
* @author Kevin Thomas
* @date 2026
*
* MIT License
* Copyright (c) 2026 Kevin Thomas
*/
#ifndef GPIO_CTRL_H
#define GPIO_CTRL_H
#include <stdbool.h>
#define PAYLOAD_PIN 18
#define LED_RED_PIN 16
#define LED_GREEN_PIN 17
#define TAMPER_PIN 15
/**
* @brief Initialize the status LEDs, payload, and tamper pins.
* @param void No parameters.
* @return void No return value.
*/
void init_gpio(void);
/**
* @brief Drive the armed indication LEDs (red on, green off).
* @param void No parameters.
* @return void No return value.
*/
void set_led_armed(void);
/**
* @brief Drive the authorized indication LEDs (green on, red off).
* @param void No parameters.
* @return void No return value.
*/
void set_led_authorized(void);
/**
* @brief Drive the tamper flash indication on the red LED.
* @param state True to turn the red LED on, false to turn it off.
* @return void No return value.
*/
void set_led_tamper_flash(bool state);
/**
* @brief Read the enclosure tamper loop state.
* @param void No parameters.
* @return true when the tamper wire is intact, false when cut.
*/
bool is_tamper_wire_intact(void);
/**
* @brief Pulse the payload marker output to deploy the marker.
* @param void No parameters.
* @return void No return value.
*/
void payload_deploy(void);
#endif // GPIO_CTRL_H
+22 -1
View File
@@ -10,5 +10,26 @@
#ifndef LOGIC_H
#define LOGIC_H
#include <stdbool.h>
#include <stdint.h>
#define STATE_ENV_ARMED 0x01
#define STATE_ENV_AUTHORIZED 0x03
#define STATE_ENV_LOCKOUT 0xFF
/**
* @brief Initialize the strike logic, token, radio, and feedback.
* @param void No parameters.
* @return void No return value.
*/
void init_strike_controller(void);
/**
* @brief Evaluate the environment and fire the payload when authorized.
* @param void No parameters.
* @return void No return value.
*/
void evaluate_environment(void);
#endif
#endif // LOGIC_H
+64
View File
@@ -0,0 +1,64 @@
// MIT License
//
// Copyright (c) 2026 Kevin Thomas
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
// Author: Kevin Thomas
// Email: kevin@mytechnotalent.com
// GitHub: https://github.com/mytechnotalent
// File: lora.h
// Desc: Declares UART1 interface for the REYAX RYLR998 LoRa transceiver.
// Created: 2026
#ifndef LORA_H
#define LORA_H
#include <stdbool.h>
#include <stddef.h>
#include "hardware/uart.h"
#define LORA_UART uart1
#define LORA_BAUD 9600
#define LORA_TX_PIN 8
#define LORA_RX_PIN 9
/**
* @brief Initialize UART1 and configure the RYLR998 radio parameters.
* @param void No parameters.
* @return void No return value.
*/
void init_lora(void);
/**
* @brief Transmit a message over the LoRa link to the base station.
* @param msg Null-terminated message string to transmit.
* @return void No return value.
*/
void lora_send(const char *msg);
/**
* @brief Poll the UART receive buffer for a complete LoRa packet.
* @param payload_out Buffer receiving the extracted payload string.
* @param max_len Capacity of payload_out in bytes.
* @return true when a payload was extracted, false otherwise.
*/
bool lora_poll_packet(char *payload_out, size_t max_len);
#endif // LORA_H