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:
Viktor Szakats 2025-12-02 07:25:18 +01:00
parent dc8c0d54a5
commit c3b030b860
No known key found for this signature in database
GPG key ID: B5ABD165E2AEF201
102 changed files with 2001 additions and 2226 deletions

View file

@ -71,14 +71,13 @@
#include <nettle/md4.h>
#endif
#if defined(USE_WOLFSSL) && !defined(WOLFSSL_NO_MD4)
#ifdef OPENSSL_COEXIST
#define MD4_CTX WOLFSSL_MD4_CTX
#define MD4_Init wolfSSL_MD4_Init
#define MD4_CTX WOLFSSL_MD4_CTX
#define MD4_Init wolfSSL_MD4_Init
#define MD4_Update wolfSSL_MD4_Update
#define MD4_Final wolfSSL_MD4_Final
#define MD4_Final wolfSSL_MD4_Final
#endif
#elif defined(USE_OPENSSL) && !defined(OPENSSL_NO_MD4)
@ -129,7 +128,7 @@ static int MD4_Init(MD4_CTX *ctx)
static void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
{
CryptHashData(ctx->hHash, (const BYTE *)data, (unsigned int) size, 0);
CryptHashData(ctx->hHash, (const BYTE *)data, (unsigned int)size, 0);
}
static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
@ -224,8 +223,8 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx);
* The MD4 transformation for all three rounds.
*/
#define MD4_STEP(f, a, b, c, d, x, s) \
(a) += f((b), (c), (d)) + (x); \
(a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s))));
(a) += f((b), (c), (d)) + (x); \
(a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s))));
/*
* SET reads 4 input bytes in little-endian byte order and stores them
@ -236,19 +235,15 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx);
* does not work.
*/
#if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
#define MD4_SET(n) \
(*(const MD4_u32plus *)(const void *)&ptr[(n) * 4])
#define MD4_GET(n) \
MD4_SET(n)
#define MD4_SET(n) (*(const MD4_u32plus *)(const void *)&ptr[(n) * 4])
#define MD4_GET(n) MD4_SET(n)
#else
#define MD4_SET(n) \
(ctx->block[(n)] = \
(MD4_u32plus)ptr[(n) * 4] | \
((MD4_u32plus)ptr[(n) * 4 + 1] << 8) | \
((MD4_u32plus)ptr[(n) * 4 + 2] << 16) | \
((MD4_u32plus)ptr[(n) * 4 + 3] << 24))
#define MD4_GET(n) \
(ctx->block[(n)])
#define MD4_SET(n) (ctx->block[(n)] = \
(MD4_u32plus)ptr[(n) * 4] | \
((MD4_u32plus)ptr[(n) * 4 + 1] << 8) | \
((MD4_u32plus)ptr[(n) * 4 + 2] << 16) | \
((MD4_u32plus)ptr[(n) * 4 + 3] << 24))
#define MD4_GET(n) (ctx->block[(n)])
#endif
/*
@ -413,32 +408,32 @@ static void MD4_Final(unsigned char *result, MD4_CTX *ctx)
memset(&ctx->buffer[used], 0, available - 8);
ctx->lo <<= 3;
ctx->buffer[56] = curlx_ultouc((ctx->lo)&0xff);
ctx->buffer[57] = curlx_ultouc((ctx->lo >> 8)&0xff);
ctx->buffer[58] = curlx_ultouc((ctx->lo >> 16)&0xff);
ctx->buffer[59] = curlx_ultouc((ctx->lo >> 24)&0xff);
ctx->buffer[60] = curlx_ultouc((ctx->hi)&0xff);
ctx->buffer[61] = curlx_ultouc((ctx->hi >> 8)&0xff);
ctx->buffer[62] = curlx_ultouc((ctx->hi >> 16)&0xff);
ctx->buffer[56] = curlx_ultouc((ctx->lo) & 0xff);
ctx->buffer[57] = curlx_ultouc((ctx->lo >> 8) & 0xff);
ctx->buffer[58] = curlx_ultouc((ctx->lo >> 16) & 0xff);
ctx->buffer[59] = curlx_ultouc((ctx->lo >> 24) & 0xff);
ctx->buffer[60] = curlx_ultouc((ctx->hi) & 0xff);
ctx->buffer[61] = curlx_ultouc((ctx->hi >> 8) & 0xff);
ctx->buffer[62] = curlx_ultouc((ctx->hi >> 16) & 0xff);
ctx->buffer[63] = curlx_ultouc(ctx->hi >> 24);
my_md4_body(ctx, ctx->buffer, 64);
result[0] = curlx_ultouc((ctx->a)&0xff);
result[1] = curlx_ultouc((ctx->a >> 8)&0xff);
result[2] = curlx_ultouc((ctx->a >> 16)&0xff);
result[0] = curlx_ultouc((ctx->a) & 0xff);
result[1] = curlx_ultouc((ctx->a >> 8) & 0xff);
result[2] = curlx_ultouc((ctx->a >> 16) & 0xff);
result[3] = curlx_ultouc(ctx->a >> 24);
result[4] = curlx_ultouc((ctx->b)&0xff);
result[5] = curlx_ultouc((ctx->b >> 8)&0xff);
result[6] = curlx_ultouc((ctx->b >> 16)&0xff);
result[4] = curlx_ultouc((ctx->b) & 0xff);
result[5] = curlx_ultouc((ctx->b >> 8) & 0xff);
result[6] = curlx_ultouc((ctx->b >> 16) & 0xff);
result[7] = curlx_ultouc(ctx->b >> 24);
result[8] = curlx_ultouc((ctx->c)&0xff);
result[9] = curlx_ultouc((ctx->c >> 8)&0xff);
result[10] = curlx_ultouc((ctx->c >> 16)&0xff);
result[8] = curlx_ultouc((ctx->c) & 0xff);
result[9] = curlx_ultouc((ctx->c >> 8) & 0xff);
result[10] = curlx_ultouc((ctx->c >> 16) & 0xff);
result[11] = curlx_ultouc(ctx->c >> 24);
result[12] = curlx_ultouc((ctx->d)&0xff);
result[13] = curlx_ultouc((ctx->d >> 8)&0xff);
result[14] = curlx_ultouc((ctx->d >> 16)&0xff);
result[12] = curlx_ultouc((ctx->d) & 0xff);
result[13] = curlx_ultouc((ctx->d >> 8) & 0xff);
result[14] = curlx_ultouc((ctx->d >> 16) & 0xff);
result[15] = curlx_ultouc(ctx->d >> 24);
memset(ctx, 0, sizeof(*ctx));