in source/sigv4.c [2405:2452]
static int32_t hmacIntermediate( HmacContext_t * pHmacContext,
const char * pData,
size_t dataLen )
{
int32_t returnStatus = 0;
size_t i = 0U;
const SigV4CryptoInterface_t * pCryptoInterface;
assert( pHmacContext != NULL );
assert( dataLen > 0U );
assert( pHmacContext->key != NULL );
assert( pHmacContext->pCryptoInterface != NULL );
assert( pHmacContext->pCryptoInterface->hashInit != NULL );
assert( pHmacContext->pCryptoInterface->hashUpdate != NULL );
assert( pHmacContext->pCryptoInterface->hashFinal != NULL );
assert( pHmacContext->keyLen == pHmacContext->pCryptoInterface->hashBlockLen );
pCryptoInterface = pHmacContext->pCryptoInterface;
/* Derive the inner HMAC key by XORing the key with inner pad byte. */
for( i = 0U; i < pCryptoInterface->hashBlockLen; i++ )
{
/* XOR the key with the ipad. */
pHmacContext->key[ i ] ^= HMAC_INNER_PAD_BYTE;
}
/* Initialize the Hash Crypto interface for performing new hash operation
* of H(Inner Key || Data) in the HMAC algorithm. */
returnStatus = pCryptoInterface->hashInit( pCryptoInterface->pHashContext );
if( returnStatus == 0 )
{
/* Hash the inner-padded block-sized key. */
returnStatus = pCryptoInterface->hashUpdate( pCryptoInterface->pHashContext,
pHmacContext->key,
pCryptoInterface->hashBlockLen );
}
if( returnStatus == 0 )
{
/* Hash the data. */
returnStatus = pCryptoInterface->hashUpdate( pCryptoInterface->pHashContext,
( const uint8_t * ) pData,
dataLen );
}
return returnStatus;
}