Skip to content

Commit

Permalink
Avoid reserved identifiers in function arguments
Browse files Browse the repository at this point in the history
In general, replace _X with _x.

In HMAC_SHA256_Init, we're replacing _K with K because we're just
passing it to _HMAC_SHA256_Init.
  • Loading branch information
gperciva committed May 31, 2022
1 parent 34866d3 commit 38ecf49
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions libcperciva/alg/sha256.c
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,11 @@ SHA256_Buf(const void * in, size_t len, uint8_t digest[32])
* ${K}.
*/
static void
_HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * _K, size_t Klen,
_HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * _k, size_t Klen,
uint32_t tmp32[static restrict 72], uint8_t pad[static restrict 64],
uint8_t khash[static restrict 32])
{
const uint8_t * K = _K;
const uint8_t * K = _k;
size_t i;

/* If Klen > 64, the key is really SHA256(K). */
Expand Down Expand Up @@ -524,14 +524,14 @@ _HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * _K, size_t Klen,

/* Wrapper function for intermediate-values sanitization. */
void
HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * _K, size_t Klen)
HMAC_SHA256_Init(HMAC_SHA256_CTX * ctx, const void * K, size_t Klen)
{
uint32_t tmp32[72];
uint8_t pad[64];
uint8_t khash[32];

/* Call the real function. */
_HMAC_SHA256_Init(ctx, _K, Klen, tmp32, pad, khash);
_HMAC_SHA256_Init(ctx, K, Klen, tmp32, pad, khash);

/* Clean the stack. */
insecure_memzero(tmp32, sizeof(uint32_t) * 72);
Expand Down
4 changes: 2 additions & 2 deletions libcperciva/events/events_network_selectstats.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@ events_network_selectstats_select(void)
* function was called.
*/
void
events_network_selectstats(double * _N, double * _mu, double * _va,
events_network_selectstats(double * _n, double * _mu, double * _va,
double * _max)
{

/* Copy statistics out. */
*_N = N;
*_n = N;
*_mu = mu;
if (N > 1.0)
*_va = M2 / (N - 1.0);
Expand Down

0 comments on commit 38ecf49

Please sign in to comment.