SigV4 v1.3.0
SigV4 Library for AWS Authentication
 
Loading...
Searching...
No Matches
Porting Guide

Guide for porting the AWS SigV4 Library to a new platform.

To use the AWS SigV4 library, a platform must implement the following components:

  1. Configuration Macros
  2. Crypto Interface

Configuration Macros

Configuration macros that can be set in the config header sigv4_config.h, or passed in as compiler options.

The following optional logging macros are used throughout the library:

See also
Configurations for more information.
Note
Regardless of whether the above macros are defined in sigv4_config.h or passed as compiler options, by default the sigv4_config.h file is needed to build the AWS SigV4 Library. To disable this requirement and build the library with default configuration values, provide SIGV4_DO_NOT_USE_CUSTOM_CONFIG as a compile time preprocessor macro.

Crypto Interface

The AWS SigV4 library relies on the implementation of crypto interface to provide hash functions used in generating the Authorization header by the library.

A port must implement functions corresponding to the following functions pointers:

  • [Hash Initialize]: A function to initialize the Hash Context.
    int32_t ( * hashInit )( void * pHashContext );
  • [Hash Update]: A function to update the hash to be calculated with more input data.
    int32_t ( * hashUpdate )( void * pHashContext,
    const uint8_t * pInput,
    size_t inputLen );
  • [Hash Final]: A function to calculate the final binary digest of the hash from the context.
    int32_t ( * hashFinal )( void * pHashContext,
    uint8_t * pOutput,
    size_t outputLen );

The above three functions take in a pointer to pHashContext which defines the context used by the above function in calculating the hash. The HashContext must also be defined by the user's implementation and ought to contain any information necessary to calculate the hash.

void * pHashContext;

A port must also define the following:

  • [Hash Block Length]: The block length of the hash function implemented by the user.
    size_t hashBlockLen;
  • [Hash Digest Length]: The digest length of the hash function implemented by the user.
    size_t hashDigestLen;