summaryrefslogtreecommitdiffstats
path: root/_log/fpm-door-lock-rf.md
diff options
context:
space:
mode:
authorSadeep Madurange <sadeep@asciimx.com>2026-01-11 15:42:35 +0800
committerSadeep Madurange <sadeep@asciimx.com>2026-01-11 15:42:35 +0800
commitf307a04d102c668477362d425e0a5059ba173a19 (patch)
tree3faae9622ad51b3a4e8ceb2f4aa4da13309f6ea8 /_log/fpm-door-lock-rf.md
parentb998760439a20ca1d9fd860525bc95635a6d1e9e (diff)
downloadwww-f307a04d102c668477362d425e0a5059ba173a19.tar.gz
Add xor() cipher to fpm lock, add limitation to neo4j.
Diffstat (limited to '_log/fpm-door-lock-rf.md')
-rw-r--r--_log/fpm-door-lock-rf.md47
1 files changed, 40 insertions, 7 deletions
diff --git a/_log/fpm-door-lock-rf.md b/_log/fpm-door-lock-rf.md
index 8fe592a..d8822f9 100644
--- a/_log/fpm-door-lock-rf.md
+++ b/_log/fpm-door-lock-rf.md
@@ -16,21 +16,54 @@ Unreliable--constant packet loss.
the letter, audited code many times, cross-checked with RadioHead and RFM69
open-source drivers. No luck.
-Datasheet riddled with ambiguity.
-
ATmega328P runs at 5V; RFM69 3.3V. Suspect logic-level converter (LLC)
issues. High resistance. Not enough swing.
-2025-04: Ditched RFM69s. Switched to NRF24L01+ modules-- data pins 5V tolerant,
-no LLC required. Spent six weekends writing driver from scratch--clean-room.
-Works like a charm.
+2025-04: Ditched RFM69s. Switched to NRF24L01+ modules--data pins 5V tolerant,
+no LLC required. Spent six weekends writing a clean-room driver from scratch.
+Works like a charm.
+
+Basic security via xor cipher–good enough for a door behind a guard post and
+gate:
+
+```
+void xor(const char *k, const char *s, char *d, uint8_t n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ d[i] = s[i] ^ k[i];
+}
+```
+
+Resists replay attacks by cycling the key:
+
+```
+static inline void keygen(char *buf, uint8_t n)
+{
+ int i, imax;
+ uint8_t sreg;
+ uint16_t seed;
+
+ sreg = SREG;
+ cli();
+ seed = TCNT1;
+ SREG = sreg;
+
+ for (i = 0, imax = n - 1; i < imax; i++, seed++)
+ buf[i] = tab[(seed % tablen)];
+ buf[imax] = '\0';
+}
+```
+
+Protocol: FPM sends SYN. Servo responds with session key. Both xor-ed with
+static key. Session key used thereafter. Private command set authenticates
+endpoints.
2025-05: Wrote FPM drivers for R503 and FPM10A. UART RX sequence was
tricky--adopted Adafruit C++ FOSS implementation to C. R503 has built-in LEDs
and better form factor. Chose it for the lock.
-2025-06: Two PCB boards for FPM (front) and servo (back) controllers. Encrypted
-RF link between them.
+2025-06: Two PCBs for FPM (front) and servo (back) controllers.
<table style="border: none; width: 100%">
<tr style="border: none;">