POSA_LEAKSMS/firmware/common/hexutil.c
유창욱 90f121e14c chore: import codebase with security hardening
SHT30 온습도 모니터링 시스템 전체 소스(서버 PHP, STM32 펌웨어, SQL, 테스트).
전체 코드리뷰에서 도출된 보안 하드닝 10건 반영:
- 요청 서명 HMAC-SHA256 전환(펌웨어 sig.c/서버 config.php/호스트 패리티 동시)
- 재전송 방어 + 기본 API_KEY fail-closed + 디바이스 문자열 정제(api/sensor_data.php)
- 오프라인 SMS 중복 발송 경합 제거(cron_heartbeat.php, 원자적 선점)
- CSV 수식 주입 방지(monthly_report.php), 감사로그 회전 락(retention_cleanup.php)
- 브루트포스 카운터 원자화(login.php), 예시 TOTP 비밀키 무효화, 마이그레이션 멱등화

_backup/(하드코딩 실 비밀값 포함)·config.local.php·런타임 상태는 .gitignore 제외.
2026-06-20 09:37:40 +09:00

14 lines
489 B
C

/* =============================================================================
* hexutil.c
* ===========================================================================*/
#include "hexutil.h"
void hex_encode_lower(const uint8_t *in, size_t len, char *out)
{
static const char digits[] = "0123456789abcdef";
for (size_t i = 0; i < len; i++) {
out[i * 2 + 0] = digits[(in[i] >> 4) & 0x0F];
out[i * 2 + 1] = digits[in[i] & 0x0F];
}
out[len * 2] = '\0';
}