Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Can't build evbarm



> Today, the build fails while making tools:
> 
> 
> --- md2.lo ---
> /dist/src/tools/compat/../../lib/libc/hash/md2/md2.c:130:4: error: call to undeclared function 'MD2Transform'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
>                        MD2Transform(context); /* resets i */
>                        ^
> /dist/src/tools/compat/../../lib/libc/hash/md2/md2.c:163:1: error: conflicting types for 'MD2Transform'
> MD2Transform(MD2_CTX *context)
> ^
> /dist/src/tools/compat/../../lib/libc/hash/md2/md2.c:130:4: note: previous implicit declaration is here
>                        MD2Transform(context); /* resets i */
>                        ^
> 2 errors generated.

Reverting lib/libc/hash/md2/md2.c to v1.7 fixes the build.

As I understand, MD2Transform() is used (in MD2Update()) before it is defined, so to fix it properly I suggest the following patch.

Commit?

Kind regards,
Adam



diff -u -r1.8 md2.c
--- md2.c 20 Jan 2024 14:52:47 -0000 1.8
+++ md2.c 25 Jan 2024 08:17:43 -0000
@@ -113,6 +113,30 @@
  memset(&context->X[0], 0, sizeof(context->X));
 }
  +/*
+ * XXX This should not be visible, but due to an accident, it is
+ * XXX so it must remain so.
+ */
+/*static*/ void
+MD2Transform(MD2_CTX *context)
+{
+ uint32_t l, j, k, t;
+
+ /* set block "3" and update "checksum" */
+ for (l = context->C[15], j = 0; j < 16; j++) {
+ context->X[32 + j] = context->X[j] ^ context->X[16 + j];
+ l = context->C[j] ^= S[context->X[16 + j] ^ l];
+ }
+
+ /* mangle input block */
+ for (t = j = 0; j < 18; t = (t + j) % 256, j++)
+ for (k = 0; k < 48; k++)
+ t = context->X[k] = (context->X[k] ^ S[t]);
+
+ /* reset input pointer */
+ context->i = 16;
+}
+
 void
 MD2Update(MD2_CTX *context, const unsigned char *input, unsigned int inputLen)
 {
@@ -155,28 +179,4 @@
  MD2Init(context);
 }
  -/*
- * XXX This should not be visible, but due to an accident, it is
- * XXX so it must remain so.
- */
-/*static*/ void
-MD2Transform(MD2_CTX *context)
-{
- uint32_t l, j, k, t;
-
- /* set block "3" and update "checksum" */
- for (l = context->C[15], j = 0; j < 16; j++) {
- context->X[32 + j] = context->X[j] ^ context->X[16 + j];
- l = context->C[j] ^= S[context->X[16 + j] ^ l];
- }
-
- /* mangle input block */
- for (t = j = 0; j < 18; t = (t + j) % 256, j++)
- for (k = 0; k < 48; k++)
- t = context->X[k] = (context->X[k] ^ S[t]);
-
- /* reset input pointer */
- context->i = 16;
-}
-
 #endif /* !HAVE_MD2_H */


Home | Main Index | Thread Index | Old Index