static size_t writeStringToSignPrefix()

in source/sigv4.c [2596:2623]


static size_t writeStringToSignPrefix( char * pBufStart,
                                       const char * pAlgorithm,
                                       size_t algorithmLen,
                                       const char * pDateIso8601 )
{
    char * pBuffer = pBufStart;

    assert( pBufStart != NULL );
    assert( pAlgorithm != NULL );
    assert( pDateIso8601 != NULL );

    /* Need to write all substrings that come before the hash in the string to sign. */

    /* Write HMAC and hashing algorithm used for SigV4 authentication. */
    ( void ) memcpy( pBuffer, pAlgorithm, algorithmLen );
    pBuffer = &( pBuffer[ algorithmLen ] );

    *pBuffer = LINEFEED_CHAR;
    pBuffer = &( pBuffer[ 1 ] );

    /* Concatenate entire ISO 8601 date string. */
    ( void ) memcpy( pBuffer, pDateIso8601, SIGV4_ISO_STRING_LEN );
    pBuffer = &( pBuffer[ SIGV4_ISO_STRING_LEN ] );

    *pBuffer = LINEFEED_CHAR;

    return algorithmLen + 1U + SIGV4_ISO_STRING_LEN + 1U;
}