Bug 11921 - ../source4/../lib/crypto/hmacmd5.h:28:9: fatal error: unknown type name 'MD5_CTX'
Summary: ../source4/../lib/crypto/hmacmd5.h:28:9: fatal error: unknown type name 'MD5_...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Build (show other bugs)
Version: 4.1.23
Hardware: x64 Mac OS X
: P1 critical (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-18 11:10 UTC by Ruga
Modified: 2017-03-10 10:24 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ruga 2016-05-18 11:10:49 UTC
The following holds with gnutls stable 3.4.11:

[...]
[ 517/3610] Compiling lib/util/getpass.c
[ 518/3610] Compiling lib/util/genrand.c
In file included from ../lib/util/genrand.c:24:
In file included from ../source4/../lib/crypto/crypto.h:23:
../source4/../lib/crypto/hmacmd5.h:28:9: fatal error: unknown type name 'MD5_CTX'
        MD5_CTX ctx;
        ^
1 error generated.
Waf: Leaving directory `/opt/src/samba-4.1.23/bin'
Build failed:  -> task failed (err #1): 
        {task: cc genrand.c -> genrand_1.o}
make: *** [all] Error 1
Comment 1 Ruga 2016-05-18 11:16:04 UTC
The same holds without gnutls.
Comment 2 Ruga 2016-05-18 11:20:23 UTC
/opt/src/samba-4.1.23/source4/../lib/crypto/hmacmd5.h
#include "../lib/crypto/md5.h"

/opt/src/samba-4.1.23/source4/../lib/crypto/md5.h
Comment 3 Ruga 2016-05-18 11:26:06 UTC
> /opt/src/samba-4.1.23/source4/../lib/crypto/hmacmd5.h

#include "../lib/crypto/md5.h"

> /opt/src/samba-4.1.23/source4/../lib/crypto/md5.h

/* Try to use CommonCrypto on Mac as otherwise we can get MD5Final twice */
#elif defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
#include <CommonCrypto/CommonDigest.h>

>/usr/include/CommonCrypto/CommonDigest.h

#define MD5_CTX   CC_MD5_CTX

Then, why "unknown type name"?
Comment 4 Ruga 2016-05-18 11:55:38 UTC
...

#if defined(HAVE_BSD_MD5_H)
/* Try to avoid clashes with BSD MD5 implementation (on linux) */
#include <bsd/md5.h>
#elif defined(HAVE_SYS_MD5_H)
/* Try to avoid clashes with BSD MD5 implementation (on BSD) */
#include <sys/md5.h>
/* Try to use CommonCrypto on Mac as otherwise we can get MD5Final twice */
#elif defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
#include <CommonCrypto/CommonDigest.h>
#define MD5Init(c)                              CC_MD5_Init(c)
#define MD5Update(c,d,l)                        CC_MD5_Update(c,d,l)
#define MD5Final(m, c)                          CC_MD5_Final((unsigned char *)m,c)
#define MD5Context CC_MD5state_st
#else
typedef struct MD5Context {
        uint32_t buf[4];
        uint32_t bits[2];
        uint8_t in[64];
} MD5_CTX;

...

>ls /usr/include/bsd/md5.h                                                      
ls: /usr/include/bsd/md5.h: No such file or directory

>ls /usr/include/sys/md5.h                                                      
ls: /usr/include/sys/md5.h: No such file or directory

>ls -l /usr/include/CommonCrypto/CommonDigest.h                                                                                                               
-rw-r--r--  1 root  wheel  11670 Feb  5 02:15 /usr/include/CommonCrypto/CommonDigest.h

/opt/src/samba-4.1.23/bin/config.log:157987:#define HAVE_COMMONCRYPTO_COMMONDIGEST_H 1
...

>grep 'define\ MD5_CTX' /usr/include/CommonCrypto/CommonDigest.h              
#define MD5_CTX                     CC_MD5_CTX
#define MD5_CTX                     CC_MD5_CTX
Comment 5 Ruga 2017-03-10 10:24:38 UTC
Problem solved on samba 4.6.0