52void construct_iv(
const uint8_t *data, uint8_t len,
const uint8_t challenge[HMAC_SIZE], uint8_t iv[IV_SIZE]);
81bool aes128_encrypt(
const uint8_t in[AES_BLOCK_SIZE],
const uint8_t key[AES_KEY_SIZE], uint8_t out[AES_BLOCK_SIZE]);
88bool aes128_decrypt(
const uint8_t in[AES_BLOCK_SIZE],
const uint8_t key[AES_KEY_SIZE], uint8_t out[AES_BLOCK_SIZE]);
101bool key_check_value(
const uint8_t key[AES_KEY_SIZE], uint8_t out[KEY_CHECK_VALUE_SIZE]);
116bool create_hmac(
const uint8_t *data, uint8_t len,
const uint8_t challenge[HMAC_SIZE],
const uint8_t key[AES_KEY_SIZE],
117 uint8_t hmac[HMAC_SIZE]);
126bool verify_hmac(
const uint8_t *data, uint8_t len,
const uint8_t hmac[HMAC_SIZE],
const uint8_t challenge[HMAC_SIZE],
127 const uint8_t key[AES_KEY_SIZE]);
149bool create_1w_hmac(
const uint8_t *data, uint8_t len, uint16_t sequence,
const uint8_t controller_key[AES_KEY_SIZE],
150 uint8_t hmac[HMAC_SIZE]);
164bool crypt_key(
const uint8_t *data, uint8_t len,
const uint8_t challenge[HMAC_SIZE],
const uint8_t in[AES_KEY_SIZE],
165 uint8_t out[AES_KEY_SIZE]);
181bool crypt_1w_key(
const uint8_t node[NODE_ID_SIZE],
const uint8_t in[AES_KEY_SIZE], uint8_t out[AES_KEY_SIZE]);
void compute_checksum(uint8_t byte, uint8_t &c1, uint8_t &c2)
Proprietary checksum algorithm used in IV construction.
static constexpr uint8_t KEY_CHECK_VALUE_SIZE
Length of a key check value (key_check_value()).
void generate_challenge(uint8_t out[HMAC_SIZE])
Generate 6 random bytes for a challenge using the ESP32 hardware RNG.
bool create_hmac(const uint8_t *data, uint8_t len, const uint8_t challenge[HMAC_SIZE], const uint8_t key[AES_KEY_SIZE], uint8_t hmac[HMAC_SIZE])
Create a 6-byte HMAC for authentication (proprietary IO-Homecontrol scheme).
bool aes128_decrypt(const uint8_t in[AES_BLOCK_SIZE], const uint8_t key[AES_KEY_SIZE], uint8_t out[AES_BLOCK_SIZE])
AES‑128 ECB decrypt a single 16‑byte block.
bool key_check_value(const uint8_t key[AES_KEY_SIZE], uint8_t out[KEY_CHECK_VALUE_SIZE])
Compute a key check value. See proto_crypto.h for the full contract.
bool crypt_1w_key(const uint8_t node[NODE_ID_SIZE], const uint8_t in[AES_KEY_SIZE], uint8_t out[AES_KEY_SIZE])
Encrypt or decrypt a 1W controller key during add-controller key adoption (CMD 0x30).
bool verify_hmac(const uint8_t *data, uint8_t len, const uint8_t hmac[HMAC_SIZE], const uint8_t challenge[HMAC_SIZE], const uint8_t key[AES_KEY_SIZE])
Verify a received HMAC using constant-time comparison.
void construct_iv(const uint8_t *data, uint8_t len, const uint8_t challenge[HMAC_SIZE], uint8_t iv[IV_SIZE])
Construct the 16-byte initialization vector (IV) for AES encryption.
bool aes128_encrypt(const uint8_t in[AES_BLOCK_SIZE], const uint8_t key[AES_KEY_SIZE], uint8_t out[AES_BLOCK_SIZE])
AES-128 ECB encrypt a single 16-byte block.
bool crypt_key(const uint8_t *data, uint8_t len, const uint8_t challenge[HMAC_SIZE], const uint8_t in[AES_KEY_SIZE], uint8_t out[AES_KEY_SIZE])
Encrypt or decrypt a system key during pairing.
bool create_1w_hmac(const uint8_t *data, uint8_t len, uint16_t sequence, const uint8_t controller_key[AES_KEY_SIZE], uint8_t hmac[HMAC_SIZE])
Create the 6-byte authenticator for a 1W frame.
void construct_iv_1w_sequence(const uint8_t *data, uint8_t len, uint16_t sequence, uint8_t iv[IV_SIZE])
Construct the 16-byte IV for the 1W sequence-keyed HMAC (create_1w_hmac()).
void construct_iv_1w_node(const uint8_t node[NODE_ID_SIZE], uint8_t iv[IV_SIZE])
Construct the 16-byte IV for the 1W key-wrap primitive from a sender's node address alone.
Fundamental IO-Homecontrol frame and crypto size constants.