mirror of
https://github.com/curl/curl.git
synced 2026-08-25 02:03:36 +03:00
lib: fix formatting nits (part 3)
From `lib/h` to `lib/w`. part 1:47a1ab2ebe#19764 part 2:86b346443b#19800 Closes #19811
This commit is contained in:
parent
dc8c0d54a5
commit
c3b030b860
102 changed files with 2001 additions and 2226 deletions
16
lib/hmac.c
16
lib/hmac.c
|
|
@ -46,10 +46,9 @@
|
|||
static const unsigned char hmac_ipad = 0x36;
|
||||
static const unsigned char hmac_opad = 0x5C;
|
||||
|
||||
struct HMAC_context *
|
||||
Curl_HMAC_init(const struct HMAC_params *hashparams,
|
||||
const unsigned char *key,
|
||||
unsigned int keylen)
|
||||
struct HMAC_context *Curl_HMAC_init(const struct HMAC_params *hashparams,
|
||||
const unsigned char *key,
|
||||
unsigned int keylen)
|
||||
{
|
||||
size_t i;
|
||||
struct HMAC_context *ctxt;
|
||||
|
|
@ -64,15 +63,15 @@ Curl_HMAC_init(const struct HMAC_params *hashparams,
|
|||
return ctxt;
|
||||
|
||||
ctxt->hash = hashparams;
|
||||
ctxt->hashctxt1 = (void *) (ctxt + 1);
|
||||
ctxt->hashctxt2 = (void *) ((char *) ctxt->hashctxt1 + hashparams->ctxtsize);
|
||||
ctxt->hashctxt1 = (void *)(ctxt + 1);
|
||||
ctxt->hashctxt2 = (void *)((char *)ctxt->hashctxt1 + hashparams->ctxtsize);
|
||||
|
||||
/* If the key is too long, replace it by its hash digest. */
|
||||
if(keylen > hashparams->maxkeylen) {
|
||||
if(hashparams->hinit(ctxt->hashctxt1))
|
||||
goto fail;
|
||||
hashparams->hupdate(ctxt->hashctxt1, key, keylen);
|
||||
hkey = (unsigned char *) ctxt->hashctxt2 + hashparams->ctxtsize;
|
||||
hkey = (unsigned char *)ctxt->hashctxt2 + hashparams->ctxtsize;
|
||||
hashparams->hfinal(hkey, ctxt->hashctxt1);
|
||||
key = hkey;
|
||||
keylen = hashparams->resultlen;
|
||||
|
|
@ -112,7 +111,6 @@ int Curl_HMAC_update(struct HMAC_context *ctxt,
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int Curl_HMAC_final(struct HMAC_context *ctxt, unsigned char *output)
|
||||
{
|
||||
const struct HMAC_params *hashparams = ctxt->hash;
|
||||
|
|
@ -121,7 +119,7 @@ int Curl_HMAC_final(struct HMAC_context *ctxt, unsigned char *output)
|
|||
storage. */
|
||||
|
||||
if(!output)
|
||||
output = (unsigned char *) ctxt->hashctxt2 + ctxt->hash->ctxtsize;
|
||||
output = (unsigned char *)ctxt->hashctxt2 + ctxt->hash->ctxtsize;
|
||||
|
||||
hashparams->hfinal(output, ctxt->hashctxt1);
|
||||
hashparams->hupdate(ctxt->hashctxt2, output, hashparams->resultlen);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue