SDK for TESAIoT Dev Kit
API reference & tutorials (ModusToolbox)
Loading...
Searching...
No Matches
bento_devmode.h File Reference
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define BENTO_DEVMODE_NONCE_LEN   (16u)
#define BENTO_DEVMODE_SECRET_LEN   (32u)
#define BENTO_DEVMODE_HMAC_LEN   (32u)
#define BENTO_DEVMODE_NONCE_TTL_MS   (60000u)

Functions

void bento_devmode_init (void)
 Idempotent; seeds the 32-byte RAM secret. Every public devmode entry self-calls it.
void bento_devmode_nonce_issue (uint8_t nonce_out[BENTO_DEVMODE_NONCE_LEN])
 Fill a fresh 16-byte nonce, overwriting any pending one; starts the TTL clock.
bool bento_devmode_unlock (const char *hmac_hex, size_t hmac_hex_len)
 Verify the HMAC against the pending nonce; consumes the nonce on any call (one-shot).
void bento_devmode_lock (void)
 Clear the unlocked flag.
bool bento_devmode_is_unlocked (void)
 Whether privileged verbs (bento.exec) are permitted right now.
size_t bento_devmode_secret_hex (char *out, size_t out_sz)
 The secret as 64 hex chars + NUL, or 0 if the buffer is too small; never log it to UART.
void bento_devmode_emit_provision (void)
 Emit the provision event once per boot on the CONNECTED transition; a failed send retries.
size_t bento_devmode_secret_fp_hex (char *out, size_t out_sz)
 First 4 bytes of SHA-256(secret) as 8 hex chars + NUL — safe to log.

Macro Definition Documentation

◆ BENTO_DEVMODE_NONCE_LEN

#define BENTO_DEVMODE_NONCE_LEN   (16u)

◆ BENTO_DEVMODE_SECRET_LEN

#define BENTO_DEVMODE_SECRET_LEN   (32u)

◆ BENTO_DEVMODE_HMAC_LEN

#define BENTO_DEVMODE_HMAC_LEN   (32u)

◆ BENTO_DEVMODE_NONCE_TTL_MS

#define BENTO_DEVMODE_NONCE_TTL_MS   (60000u)