Skip to content

Commit

Permalink
Revert changes to sigv4 sources
Browse files Browse the repository at this point in the history
  • Loading branch information
yourslab committed Aug 4, 2021
1 parent 6174e8d commit fa4a976
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 103 deletions.
53 changes: 5 additions & 48 deletions source/include/sigv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,42 +49,20 @@
/** @addtogroup sigv4_constants
* @{
*/
<<<<<<< HEAD
#define SIGV4_AWS4_HMAC_SHA256 "AWS4-HMAC-SHA256" /**< AWS identifier for SHA256 signing algorithm. */
#define SIGV4_HTTP_X_AMZ_DATE_HEADER "x-amz-date" /**< AWS identifier for HTTP date header. */
#define SIGV4_HTTP_X_AMZ_SECURITY_TOKEN_HEADER "x-amz-security-token" /**< AWS identifier for security token. */
=======
#define SIGV4_AWS4_HMAC_SHA256 "AWS4-HMAC-SHA256" /**< AWS identifier for SHA256 signing algorithm. */
#define SIGV4_AWS4_HMAC_SHA256_LENGTH ( sizeof( SIGV4_AWS4_HMAC_SHA256 ) - 1U ) /**< AWS identifier for SHA256 signing algorithm. */
#define SIGV4_HTTP_X_AMZ_DATE_HEADER "x-amz-date" /**< AWS identifier for HTTP date header. */
#define SIGV4_HTTP_X_AMZ_SECURITY_TOKEN_HEADER "x-amz-security-token" /**< AWS identifier for security token. */
>>>>>>> 9a7f2d4 (Fix test case)

#define SIGV4_STREAMING_AWS4_HMAC_SHA256_PAYLOAD "STREAMING-AWS4-HMAC-SHA256-PAYLOAD" /**< S3 identifier for chunked payloads. */
#define SIGV4_HTTP_X_AMZ_CONTENT_SHA256_HEADER "x-amz-content-sha256" /**< S3 identifier for streaming requests. */
#define SIGV4_HTTP_X_AMZ_STORAGE_CLASS_HEADER "x-amz-storage-class" /**< S3 identifier for reduced streaming redundancy. */
#define SIGV4_STREAMING_AWS4_HMAC_SHA256_PAYLOAD "STREAMING-AWS4-HMAC-SHA256-PAYLOAD" /**< S3 identifier for chunked payloads. */
#define SIGV4_HTTP_X_AMZ_CONTENT_SHA256_HEADER "x-amz-content-sha256" /**< S3 identifier for streaming requests. */
#define SIGV4_HTTP_X_AMZ_STORAGE_CLASS_HEADER "x-amz-storage-class" /**< S3 identifier for reduced streaming redundancy. */

#define SIGV4_ACCESS_KEY_ID_LENGTH 20U /**< Length of access key ID. */
#define SIGV4_SECRET_ACCESS_KEY_LENGTH 40U /**< Length of secret access key. */
#define SIGV4_ACCESS_KEY_ID_LENGTH 20U /**< Length of access key ID. */
#define SIGV4_SECRET_ACCESS_KEY_LENGTH 40U /**< Length of secret access key. */

<<<<<<< HEAD
#define SIGV4_ISO_STRING_LEN 16U /**< Length of ISO 8601 date string. */
#define SIGV4_EXPECTED_LEN_RFC_3339 20U /**< Length of RFC 3339 date input. */
<<<<<<< HEAD
#define SIGV4_EXPECTED_LEN_RFC_5322 29U /**< Length of RFC 5322 date input. */
=======
=======
#define SIGV4_ISO_STRING_LEN 16U /**< Length of ISO 8601 date string. */
#define SIGV4_EXPECTED_LEN_RFC_3339 20U /**< Length of RFC 3339 date input. */
>>>>>>> 9a7f2d4 (Fix test case)
#define SIGV4_EXPECTED_LEN_RFC_5322 29U
/**< Length of RFC 5322 date input. */

/* SHA256 definitions for block and digest length. */
#define SIGV4_SHA256_DIGEST_LENGTH 32U
#define SIGV4_SHA256_BLOCK_LENGTH 64U

>>>>>>> 20f32c7 (Add unit tests attaining branch coverage of 71%)
/** @}*/

/**
Expand Down Expand Up @@ -446,25 +424,4 @@ SigV4Status_t SigV4_AwsIotDateToIso8601( const char * pDate,
char * pDateISO8601,
size_t dateISO8601Len );
/* @[declare_sigV4_awsIotDateToIso8601_function] */
<<<<<<< HEAD
=======

/**
* Generates the HTTP Authorization header value.
*
* @param[in] pParams Parameters for generating the Sigv4 signature.
* @param[out] pAuthBuf Buffer for outputting the Authorization header
* value.
* @param[in, out] authBufLen the length of pAuthBuf, output the length
* of authorization written to the buffer.
* @param[out] pSignature Location of the signature in the authorization stirng.
* @param[out] signatureLen The length of pSignature.
* @return SUCCESS code if successful, error code otherwise.
*/
SigV4Status_t Sigv4_GenerateHTTPAuthorization( const SigV4Parameters_t * pParams,
char * pAuthBuf,
size_t * authBufLen,
char ** pSignature,
size_t * signatureLen );
>>>>>>> 9a7f2d4 (Fix test case)
#endif /* SIGV4_H_ */
55 changes: 0 additions & 55 deletions source/include/sigv4_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,44 +51,7 @@
#define ISO_YEAR_LEN 4U /**< Length of year value in ISO 8601 date. */
#define ISO_NON_YEAR_LEN 2U /**< Length of non-year values in ISO 8601 date. */

<<<<<<< HEAD
#define ISO_DATE_SCOPE_LEN 8U /**< Length of date substring used in credential scope. */
=======
#define ISO_DATE_SCOPE_LEN 8U /**< Length of date substring used in credential scope. */

/* SigV4 related string literals and lengths. */
#define CREDENTIAL_SCOPE_SEPARATOR '/'
#define CREDENTIAL_SCOPE_SEPARATOR_LEN 1U
#define CREDENTIAL_SCOPE_TERMINATOR "aws4_request"
#define CREDENTIAL_SCOPE_TERMINATOR_LEN ( sizeof( CREDENTIAL_SCOPE_TERMINATOR ) - 1U )

/**
* @brief Default value when HttpParameters_t.pPath == NULL.
*/
#define HTTP_EMPTY_PATH "/"
#define HTTP_EMPTY_PATH_LEN ( sizeof( HTTP_EMPTY_PATH ) - 1U ) /**< The length of #HTTP_EMPTY_PATH. */

#define LINEFEED_CHAR '\n' /**< A linefeed character used to build the canonical request. */
#define LINEFEED_CHAR_LEN 1U /**< The length of #LINEFEED_CHAR. */

#define SPACE_CHAR ' ' /**< A linefeed character used to build the Authorization header value. */
#define SPACE_CHAR_LEN 1U /**< The length of #SPACE_CHAR. */

#define S3_SERVICE_NAME "s3" /**< S3 is the only service where the URI must only be encoded once. */
#define S3_SERVICE_NAME_LEN ( sizeof( S3_SERVICE_NAME ) - 1U ) /**< The length of #S3_SERVICE_NAME. */

#define SIGV4_HMAC_SIGNING_KEY_PREFIX "AWS4" /**< HMAC signing key prefix. */
#define SIGV4_HMAC_SIGNING_KEY_PREFIX_LEN ( sizeof( SIGV4_HMAC_SIGNING_KEY_PREFIX ) - 1U )

#define AUTH_CREDENTIAL_PREFIX "Credential=" /**< The prefix that goes before the credential value in the Authorization header value. */
#define AUTH_CREDENTIAL_PREFIX_LEN ( sizeof( AUTH_CREDENTIAL_PREFIX ) - 1U ) /**< The length of #AUTH_CREDENTIAL_PREFIX. */
#define AUTH_SEPARATOR ", " /**< The separator between each component in the Authorization header value. */
#define AUTH_SEPARATOR_LEN ( sizeof( AUTH_SEPARATOR ) - 1U ) /**< The length of #AUTH_SEPARATOR. */
#define AUTH_SIGNED_HEADERS_PREFIX "SignedHeaders=" /**< The prefix that goes before the signed headers in the Authorization header value. */
#define AUTH_SIGNED_HEADERS_PREFIX_LEN ( sizeof( AUTH_SIGNED_HEADERS_PREFIX ) - 1U ) /**< The length of #AUTH_SIGNED_HEADERS_PREFIX. */
#define AUTH_SIGNATURE_PREFIX "Signature=" /**< The prefix that goes before the signature in the Authorization header value. */
#define AUTH_SIGNATURE_PREFIX_LEN ( sizeof( AUTH_SIGNATURE_PREFIX ) - 1U ) /**< The length of #AUTH_SIGNATURE_PREFIX. */
>>>>>>> 9a7f2d4 (Fix test case)

/**
* @brief An aggregator representing the individually parsed elements of the
Expand Down Expand Up @@ -138,27 +101,9 @@ typedef struct CanonicalContext
char * pQueryLoc[ SIGV4_MAX_QUERY_PAIR_COUNT ]; /**< Query pointers used during sorting. */
char * pHeadersLoc[ SIGV4_MAX_HTTP_HEADER_COUNT ]; /**< Header pointers used during sorting. */

<<<<<<< HEAD
uint8_t pBufProcessing[ SIGV4_PROCESSING_BUFFER_LENGTH ]; /**< Internal calculation buffer used during canonicalization. */
char * pBufCur; /**< pBufProcessing cursor */
size_t bufRemaining; /**< pBufProcessing value used during internal calculation. */
=======
uint8_t pBufProcessing[ SIGV4_PROCESSING_BUFFER_LENGTH ]; /**< Internal calculation buffer used during canonicalization. */
char * pBufCur; /**< pBufProcessing cursor. */
size_t bufRemaining; /**< pBufProcessing value used during internal calculation. */
>>>>>>> 9a7f2d4 (Fix test case)
} CanonicalContext_t;

<<<<<<< HEAD
=======
typedef struct HmacContext
{
const SigV4CryptoInterface_t * pCryptoInterface;
char key[ SIGV4_HASH_MAX_BLOCK_LENGTH ];
size_t keyLen;
uint8_t hashInitialized;
} HmacContext_t;


>>>>>>> 20f32c7 (Add unit tests attaining branch coverage of 71%)
#endif /* ifndef SIGV4_INTERNAL_H_ */

0 comments on commit fa4a976

Please sign in to comment.