Jump to content

Landis+Gyr EEPROM Storage Map

From RECESSIM, A Reverse Engineering Community

The EEPROM storage map of a Landis+Gyr GridStream meter — where the meter keeps its configuration and the keys used by the two separate cryptosystems in the meter. This page documents the layout and process only; no key values are published here.

This builds on Dump EEPROM and relates to the on-air format in Landis+Gyr GridStream Protocol.

Two separate cryptosystems

Do not conflate these — they are different layers with different keys:

(A) RF payload key (B) Storage-at-rest key
Protects the AES-encrypted 0x81 payloads sent over the air (mesh RF) the meter's own DataFlash contents (data at rest)
Lives on the M16C radio/metrology side the SAM4C32 side (newer meters only)
Scope shared per network (same key across a network's meters) per device

(A) RF payload key record

The RF network key is stored in the meter EEPROM/DataFlash as a record beginning at page offset +0xBD:

  • +0xBD — a 2-byte checksum of the key
  • +0xBF — the 32-byte AES-256 network key

The checksum is the CRC-16/CCITT (init 0) of the 32-byte key. This lets a dump be validated without revealing the key: compute CRC-16/CCITT(init 0) over the 32 bytes at +0xBF and confirm it matches the 2 bytes stored at +0xBD.

A configuration bit selects whether the meter uses its per-meter EEPROM key or a shared/default key; the firmware also carries a default key in program flash as a fallback.

Because the RF key is a network key, a capture from one deployment only decrypts with a key dumped from a meter on that same network.


Finding the record in a raw dump. The DataFlash is read out in its native page mode, so a dump is a sequence of fixed-size pages that include the chip's spare bytes — 264 bytes/page on an AT45DB081D and 528 bytes/page on an AT45DB321E, not the "round" 256 / 512. The key record sits at offset +0xBF within a page, with its +0xBD CRC immediately before it.

You do not need to know which page. Because +0xBD is CRC-16/CCITT (init 0, poly 0x1021) over the 32 key bytes at +0xBF, the record is self-locating: slide a 34-byte window across the whole image (or test each page at +0xBD / +0xBF) and accept the first 32-byte window whose preceding two big-endian bytes equal CRC-16/CCITT(init 0) over it. In real dumps the record was found at page 8 (264 B/page chip) and page 11 (528 B/page chip), both at +0xBF.

v4 vs v5 storage

Generation Processor Key access
v4 (older) M16C The key record is readable directly from the EEPROM/DataFlash dump at +0xBD / +0xBF.
v5 (newer) SAM4C32 The DataFlash is encrypted at rest (cryptosystem B). It must be decrypted first; the plaintext DataFlash then contains the same +0xBD / +0xBF key record.


Decrypting the SAM4C32 (v5) DataFlash

On the newer Generation 5 meters (Microchip ATSAM4C32, ARM Cortex-M) the external AT45DB321E DataFlash is AES-256-CBC encrypted at rest — a raw chip dump is ciphertext until you decrypt it. (Generation 4 / M16C meters store the DataFlash in the clear, so this step does not apply to them.)

The scheme was recovered from the SAM4C32 firmware (application sf_aes_crypt @ 0x0102E8E4, bootloader sf_aes_decrypt @ 0x01005476) and verified by a per-page checksum:

  • Chip mode: AT45DB321E in 528-byte page mode (the bootloader rejects power-of-2 / 512-byte mode); a full dump is 8192 pages x 528 bytes.
  • Cipher: AES-256-CBC, performed by the SAM4C on-chip AES peripheral.
  • Key: a 32-byte key hard-coded in the SAM4C32 internal flash — the same key in the application and the bootloader; it is not stored on the DataFlash. The first key word is at internal-flash address 0x01000204, with the remaining words embedded as literals in the AES routine. The key value is not published here.
  • IV: a fixed 96-bit value from internal flash at 0x010002F4, followed by a per-page word IVR3 = big_endian(page x 528) — so every page uses its own IV.
  • Page layout after decrypt: each 528-byte page decrypts to [crc32 : 4][header : 12][data : 512]. The CRC32 (poly 0xEDB88320) over the 512-byte data confirms a correct decrypt — in a real dump, 176 of 223 used pages verify (the rest are partial / wear-levelled writes).

Once the DataFlash is decrypted, the plaintext holds the normal NV / configuration records, including the RF key record at page +0xBF (section A) — which is how the RF network key is reached on a v5 meter.

Extraction and validation (recipe)

  1. Dump the meter EEPROM/DataFlash — see Dump EEPROM.
  2. (v5 only) Decrypt the storage-at-rest layer to obtain the plaintext DataFlash.
  3. Read the key record at +0xBD (checksum) / +0xBF (32-byte key).
  4. Validate: CRC-16/CCITT(init 0) over the 32-byte key must equal the stored 2-byte checksum.
  5. Use the key with the GridStream Decrypt block (gr-smart_meters) to decrypt 0x81 payloads — see Landis+Gyr GridStream Protocol.

The on-air 0x81 plaintext carries its own CRC-16/CCITT (init 0) == 0 integrity check, which doubles as an oracle: a candidate key is correct when the decrypted payload's CRC is zero.