Modify

Opened 7 years ago

Closed 7 years ago

Last modified 2 years ago

#5260 closed defect (fixed)

ntpd build fails with MD5_CTX not defined

Reported by: ruff <rufferson@…> Owned by: florian
Priority: normal Milestone: Barrier Breaker 14.07
Component: packages Version: Trunk
Keywords: ntpd md5.h MD5_CTX Cc:

Description

This is caused by finding file md5.h which however not contains definition of MD5_CTX. Explicitly disabling md5.h helps.

ruff@host ~/openwrt/kamikadze/package/feeds/packages/ntpd $ svn diff
Index: Makefile
===================================================================
--- Makefile    (revision 16237)
+++ Makefile    (working copy)
@@ -104,6 +104,7 @@
 endef

 define Build/Compile
+       sed -i 's/^\(#define\)\(\s\)\(HAVE_MD5_H\)\(\s1\)/#undef\2\3/' $(PKG_BUILD_DIR)/config.h
        $(MAKE) -C $(PKG_BUILD_DIR) \
                CFLAGS="$(TARGET_CFLAGS)"
 endef

Attachments (5)

101-patch_a_mdyencrypt.c.patch (283 bytes) - added by guillermo@… 7 years ago.
Patch to correct MD5_CTX (it is due to a bad header include).-
102-patch_md5c.c.patch (264 bytes) - added by guillermo@… 7 years ago.
Patch to correct MD5_CTX (it is due to a bad header include).-
103-patch_global.h.patch (527 bytes) - added by guillermo@… 7 years ago.
Patch to correct typedef UINT4's definition.-
201-patch_md5.h.patch (332 bytes) - added by guillermo@… 7 years ago.
This patch file must be applied to openssll package, it is because of a new definition of typedef witch MD5_CTX is related to.
202-patch_md5.h.2nd.patch (333 bytes) - added by guillermo@… 7 years ago.
This patch file must be applied to openssll package, it is because of a new definition of typedef witch MD5_CTX is related to.

Download all attachments as: .zip

Change History (10)

Changed 7 years ago by guillermo@…

Patch to correct MD5_CTX (it is due to a bad header include).-

Changed 7 years ago by guillermo@…

Patch to correct MD5_CTX (it is due to a bad header include).-

Changed 7 years ago by guillermo@…

Patch to correct typedef UINT4's definition.-

Changed 7 years ago by guillermo@…

This patch file must be applied to openssll package, it is because of a new definition of typedef witch MD5_CTX is related to.

Changed 7 years ago by guillermo@…

This patch file must be applied to openssll package, it is because of a new definition of typedef witch MD5_CTX is related to.

comment:1 Changed 7 years ago by guillermo@…

These patches added here works for me and NTPD works fine running on x86, atheros 2.6 too.-

comment:2 Changed 7 years ago by florian

  • Owner changed from developers to florian
  • Status changed from new to assigned

None of your patches make sense to me. Quoting libntp/a_md5encrypt.c:

/* Disable the openssl md5 includes, because they'd clash with ours. */
/* #define NO_MD5 */
/* #define OPENSSL_NO_MD5 */
#undef OPENSSL

They explicitely do not want MD5 definitions.

Also, defining UINT4 as uint32_t is fine for 32-bits architecture, but not for 64-bits architecture according to the definition: UINT4 defines a four byte word.

Please clarify all of this.

comment:3 Changed 7 years ago by guillermo@…

Florian, since there wasn't an answer to your question from the original submitted ticket (ruff <rufferson@…>) .

This part of the original submitted issue is not mine:
/* Disable the openssl md5 includes, because they'd clash with ours. */
/* #define NO_MD5 */
/* #define OPENSSL_NO_MD5 */
#undef OPENSSL

The question is, why disabling md5.h explicitly even if you could fix it up? don't you think that?.
google-ing (:D) for this kind of problem I found almost every project wich uses md5.h hast the "same" typedef definition for the function.-
wich is:

#ifndef MD5_INCLUDE

/* typedef a 32-bit type */
typedef unsigned int UINT4;

/* Data structure for MD5 (Message-Digest) computation */
typedef struct

{

UINT4 i[2]; /* number of _bits_ handled mod 264 */
UINT4 buf[4]; /* scratch buffer */
unsigned char in[64]; /* input buffer */
unsigned char digest[16]; /* actual digest after MD5Final call */

}

MD5_CTX;

void MD5Init ();
void MD5Update ();
void MD5Final ();

#define MD5_INCLUDE
#endif /* MD5_INCLUDE */

url: http://www.codase.com/search/relation?namec=md5_ctx

Maybe it was not good to use the openssl md5.h file (I didn't know it). Perhaps doing a patch just to apply only to ntpd package was the right solution.
I supposed to re-use what it was just coded before would be a "little straight-line".-

Regarding to UINT4 definitions it is a four-byte word definition for 32-bits ARCHs.

comment:4 Changed 7 years ago by florian

  • Resolution set to fixed
  • Status changed from assigned to closed

Should be fixed with [17493].

comment:5 Changed 2 years ago by jow

  • Milestone changed from Attitude Adjustment 12.09 to Barrier Breaker 14.07

Milestone Attitude Adjustment 12.09 deleted

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.