Skip to content

Commit

Permalink
Fix FUNC_ENTER macros and naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Dana Robinson committed Jan 12, 2025
1 parent 47ad1ce commit 707ca31
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions src/H5FDs3comms.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ struct s3r_datastruct {

static size_t curlwritecallback(char *ptr, size_t size, size_t nmemb, void *userdata);

static herr_t H5FD_s3comms_s3r_getsize(s3r_t *handle);
static herr_t H5FD__s3comms_s3r_getsize(s3r_t *handle);

static herr_t H5FD_s3comms_bytes_to_hex(char *dest, size_t dest_len, const unsigned char *msg,
size_t msg_len);
static herr_t H5FD__s3comms_bytes_to_hex(char *dest, size_t dest_len, const unsigned char *msg,
size_t msg_len);

static herr_t H5FD__s3comms_load_aws_creds_from_file(FILE *file, const char *profile_name, char *key_id,
char *access_key, char *aws_region);

/*********************/
/* Package Variables */
Expand Down Expand Up @@ -701,7 +704,7 @@ H5FD_s3comms_s3r_get_filesize(s3r_t *handle)

/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_s3r_getsize()
* Function: H5FD__s3comms_s3r_getsize()
*
* Purpose:
*
Expand Down Expand Up @@ -729,7 +732,7 @@ H5FD_s3comms_s3r_get_filesize(s3r_t *handle)
*----------------------------------------------------------------------------
*/
static herr_t
H5FD_s3comms_s3r_getsize(s3r_t *handle)
H5FD__s3comms_s3r_getsize(s3r_t *handle)
{
uintmax_t content_length = 0;
CURL *curlh = NULL;
Expand All @@ -739,7 +742,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle)
char *start = NULL;
herr_t ret_value = SUCCEED;

FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE

if (handle == NULL)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "handle cannot be NULL");
Expand Down Expand Up @@ -831,7 +834,7 @@ H5FD_s3comms_s3r_getsize(s3r_t *handle)
H5MM_xfree(headerresponse);

FUNC_LEAVE_NOAPI(ret_value)
} /* H5FD_s3comms_s3r_getsize */
} /* H5FD__s3comms_s3r_getsize */

/*----------------------------------------------------------------------------
*
Expand Down Expand Up @@ -981,8 +984,8 @@ H5FD_s3comms_s3r_open(const char *url, const char *region, const char *id, const
* GET FILE SIZE *
*******************/

if (FAIL == H5FD_s3comms_s3r_getsize(handle))
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "problem in H5FD_s3comms_s3r_getsize");
if (FAIL == H5FD__s3comms_s3r_getsize(handle))
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, NULL, "problem in H5FD__s3comms_s3r_getsize");

/*********************
* FINAL PREPARATION *
Expand Down Expand Up @@ -1268,8 +1271,8 @@ H5FD_s3comms_s3r_read(s3r_t *handle, haddr_t offset, size_t len, void *dest)
/* buffer1 -> signature */
HMAC(EVP_sha256(), handle->signing_key, SHA256_DIGEST_LENGTH, (const unsigned char *)buffer2,
strlen(buffer2), md, &md_len);
if (H5FD_s3comms_bytes_to_hex(buffer1, 512 + H5FD_ROS3_MAX_SECRET_TOK_LEN + 1,
(const unsigned char *)md, (size_t)md_len) == FAIL)
if (H5FD__s3comms_bytes_to_hex(buffer1, 512 + H5FD_ROS3_MAX_SECRET_TOK_LEN + 1,
(const unsigned char *)md, (size_t)md_len) == FAIL)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "could not convert to hex string.");

iso8601now[8] = 0; /* trim to yyyyMMDD */
Expand Down Expand Up @@ -1561,20 +1564,19 @@ H5FD_s3comms_aws_canonical_request(char *canonical_request_dest, int _cr_size, c
} /* end H5FD_s3comms_aws_canonical_request() */

/*----------------------------------------------------------------------------
*
* Function: H5FD_s3comms_bytes_to_hex()
* Function: H5FD__s3comms_bytes_to_hex()
*
* Purpose: Convert a byte string to a NUL-terminated hex string
*
* Return: SUCCEED/FAIL
*----------------------------------------------------------------------------
*/
static herr_t
H5FD_s3comms_bytes_to_hex(char *dest, size_t dest_len, const unsigned char *msg, size_t msg_len)
H5FD__s3comms_bytes_to_hex(char *dest, size_t dest_len, const unsigned char *msg, size_t msg_len)
{
herr_t ret_value = SUCCEED;

FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE

assert(dest);
assert(msg);
Expand All @@ -1592,7 +1594,7 @@ H5FD_s3comms_bytes_to_hex(char *dest, size_t dest_len, const unsigned char *msg,

done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_s3comms_bytes_to_hex() */
} /* end H5FD__s3comms_bytes_to_hex() */

/*----------------------------------------------------------------------------
*
Expand Down Expand Up @@ -2234,8 +2236,8 @@ H5FD_s3comms_tostringtosign(char *dest, const char *req, const char *now, const

SHA256((const unsigned char *)req, strlen(req), checksum);

if (H5FD_s3comms_bytes_to_hex(hexsum, S3COMMS_SHA256_HEXSTR_LENGTH, (const unsigned char *)checksum,
SHA256_DIGEST_LENGTH) == FAIL)
if (H5FD__s3comms_bytes_to_hex(hexsum, S3COMMS_SHA256_HEXSTR_LENGTH, (const unsigned char *)checksum,
SHA256_DIGEST_LENGTH) == FAIL)
HGOTO_ERROR(H5E_VFL, H5E_BADVALUE, FAIL, "could not create hex string");

for (i = 0; i < S3COMMS_SHA256_HEXSTR_LENGTH - 1; i++)
Expand Down

0 comments on commit 707ca31

Please sign in to comment.