/* byte (1... 15-q) nonce byte (16-q...15) input length  */
static void aes_ccm_format_b0(uint8_t *block, const uint8_t *iv, uint32_t iv_len, uint32_t mac_len, uint32_t aad_len, uint32_t input_len)
/* byte (1... 15-q) nonce byte (16-q...15) input length  */
static void aes_ccm_format_b0(uint8_t *block, const uint8_t *iv, uint32_t iv_len, uint32_t mac_len, uint32_t aad_len, uint32_t input_len)
{
    uint8_t q = 15U - iv_len;
    block[0] = 0;
    block[0] |= (aad_len > 0) ? (1U << 6) : 0U;
    block[0] |= ((mac_len - 2U) / 2U) << 3;
    block[0] |= q - 1U;
    (void) memcpy(block + 1U, iv, iv_len);
    uint32_to_be(block + 1U + iv_len, q, input_len);
}