components/esp32c3/esp_hmac.c
/**
 * @brief Apply the HMAC padding without the embedded length.
 *
 * @note This function does not check the data length, it is the responsibility of the other functions in this
 * module to make sure that \c data_len is at most SHA256_BLOCK_SZ - 1 so the padding fits in.
 * Otherwise, this function has undefined behavior.
 * Note however, that for the actual HMAC implementation on ESP32C3, the length also needs to be applied at the end
 * of the block. This function alone deosn't do that.
 */
@brief Apply the HMAC padding without the embedded length.
@note This function does not check the data length, it is the responsibility of the other functions in this
module to make sure that \c data_len is at most SHA256_BLOCK_SZ - 1 so the padding fits in.
Otherwise, this function has undefined behavior.
Note however, that for the actual HMAC implementation on ESP32C3, the length also needs to be applied at the end
of the block. This function alone deosn't do that.
@brief Apply the HMAC padding without the embedded length . @note This function does not check the data length it is the responsibility of the other functions in this module to make sure that \ c data_len is at most SHA256_BLOCK_SZ - 1 so the padding fits in . Otherwise this function has undefined behavior . Note however that for the actual HMAC implementation on ESP32C3 the length also needs to be applied at the end of the block . This function alone deosn ' t do that .
static void write_and_padd(uint8_t *block, const uint8_t *data, uint16_t data_len)
{
    memcpy(block, data, data_len);
    block[data_len] = 0x80;
    bzero(block + data_len + 1, SHA256_BLOCK_SZ - data_len - 1);
}
static void write_and_padd ( uint8_t * block , const uint8_t * data , uint16_t data_len ) { memcpy ( block , data , data_len ) ; block [ data_len ] = 0x80 ; bzero ( block + data_len + 1 , SHA256_BLOCK_SZ - data_len - 1 ) ; }
@brief Apply the HMAC padding without the embedded length.
@brief Apply the HMAC padding without the embedded length .
// Apply a one bit, followed by zero bits (refer to the ESP32C3 TRM).