diff options
-rw-r--r-- | lib/libmd/Makefile | 8 | ||||
-rw-r--r-- | lib/libmd/md4c.c | 6 | ||||
-rw-r--r-- | lib/libmd/md5c.c | 6 | ||||
-rw-r--r-- | lib/libmd/mdXhl.c | 6 | ||||
-rw-r--r-- | lib/libmd/rmd160c.c | 6 | ||||
-rw-r--r-- | lib/libmd/sha1c.c | 7 | ||||
-rw-r--r-- | lib/libmd/sha256c.c | 8 | ||||
-rw-r--r-- | lib/libmd/sha512c.c | 8 |
8 files changed, 49 insertions, 6 deletions
diff --git a/lib/libmd/Makefile b/lib/libmd/Makefile index 727fd86..61bea29 100644 --- a/lib/libmd/Makefile +++ b/lib/libmd/Makefile @@ -42,7 +42,13 @@ CLEANFILES+= md[245]hl.c md[245].ref md[245].3 mddriver \ sha0.ref sha0hl.c sha1.ref sha1hl.c shadriver \ sha256.ref sha256hl.c sha512.ref sha512hl.c -CFLAGS+= -I${.CURDIR} +# Define WEAK_REFS to provide weak aliases for libmd symbols +# +# Note that the same sources are also used internally by libcrypt, +# in which case: +# * macros are used to rename symbols to libcrypt internal names +# * no weak aliases are generated +CFLAGS+= -I${.CURDIR} -DWEAK_REFS .PATH: ${.CURDIR}/${MACHINE_ARCH} ${.CURDIR}/../../sys/crypto/sha2 .if exists(${MACHINE_ARCH}/sha.S) diff --git a/lib/libmd/md4c.c b/lib/libmd/md4c.c index 2234c40..de1a7b4a 100644 --- a/lib/libmd/md4c.c +++ b/lib/libmd/md4c.c @@ -291,6 +291,11 @@ unsigned int len; (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); } +#ifdef WEAK_REFS +/* When building libmd, provide weak references. Note: this is not + activated in the context of compiling these sources for internal + use in libcrypt. + */ #undef MD4Init __weak_reference(_libmd_MD4Init, MD4Init); #undef MD4Update @@ -299,3 +304,4 @@ __weak_reference(_libmd_MD4Update, MD4Update); __weak_reference(_libmd_MD4Pad, MD4Pad); #undef MD4Final __weak_reference(_libmd_MD4Final, MD4Final); +#endif diff --git a/lib/libmd/md5c.c b/lib/libmd/md5c.c index bfbb531..6b50464 100644 --- a/lib/libmd/md5c.c +++ b/lib/libmd/md5c.c @@ -336,6 +336,11 @@ MD5Transform (state, block) memset ((void *)x, 0, sizeof (x)); } +#ifdef WEAK_REFS +/* When building libmd, provide weak references. Note: this is not + activated in the context of compiling these sources for internal + use in libcrypt. + */ #undef MD5Init __weak_reference(_libmd_MD5Init, MD5Init); #undef MD5Update @@ -346,3 +351,4 @@ __weak_reference(_libmd_MD5Pad, MD5Pad); __weak_reference(_libmd_MD5Final, MD5Final); #undef MD5Transform __weak_reference(_libmd_MD5Transform, MD5Transform); +#endif diff --git a/lib/libmd/mdXhl.c b/lib/libmd/mdXhl.c index 9db000d..62be235 100644 --- a/lib/libmd/mdXhl.c +++ b/lib/libmd/mdXhl.c @@ -97,6 +97,11 @@ MDXData (const void *data, unsigned int len, char *buf) return (MDXEnd(&ctx, buf)); } +#ifdef WEAK_REFS +/* When building libmd, provide weak references. Note: this is not + activated in the context of compiling these sources for internal + use in libcrypt. + */ #undef MDXEnd __weak_reference(_libmd_MDXEnd, MDXEnd); #undef MDXFile @@ -105,3 +110,4 @@ __weak_reference(_libmd_MDXFile, MDXFile); __weak_reference(_libmd_MDXFileChunk, MDXFileChunk); #undef MDXData __weak_reference(_libmd_MDXData, MDXData); +#endif diff --git a/lib/libmd/rmd160c.c b/lib/libmd/rmd160c.c index a33126f..5a3b783 100644 --- a/lib/libmd/rmd160c.c +++ b/lib/libmd/rmd160c.c @@ -546,6 +546,11 @@ unsigned long *l; } #endif +#ifdef WEAK_REFS +/* When building libmd, provide weak references. Note: this is not + activated in the context of compiling these sources for internal + use in libcrypt. + */ #undef RIPEMD160_Init __weak_reference(_libmd_RIPEMD160_Init, RIPEMD160_Init); #undef RIPEMD160_Update @@ -558,3 +563,4 @@ __weak_reference(_libmd_RIPEMD160_Transform, RIPEMD160_Transform); __weak_reference(_libmd_RMD160_version, RMD160_version); #undef ripemd160_block __weak_reference(_libmd_ripemd160_block, ripemd160_block); +#endif diff --git a/lib/libmd/sha1c.c b/lib/libmd/sha1c.c index ea50622..93a4ff3 100644 --- a/lib/libmd/sha1c.c +++ b/lib/libmd/sha1c.c @@ -488,7 +488,11 @@ SHA_CTX *c; /* memset((char *)&c,0,sizeof(c));*/ } - +#ifdef WEAK_REFS +/* When building libmd, provide weak references. Note: this is not + activated in the context of compiling these sources for internal + use in libcrypt. + */ #undef SHA_Init __weak_reference(_libmd_SHA_Init, SHA_Init); #undef SHA_Update @@ -513,3 +517,4 @@ __weak_reference(_libmd_SHA1_Transform, SHA1_Transform); __weak_reference(_libmd_SHA1_version, SHA1_version); #undef sha1_block __weak_reference(_libmd_sha1_block, sha1_block); +#endif diff --git a/lib/libmd/sha256c.c b/lib/libmd/sha256c.c index 0c2fd1b..68f6aee 100644 --- a/lib/libmd/sha256c.c +++ b/lib/libmd/sha256c.c @@ -299,6 +299,11 @@ SHA256_Final(unsigned char digest[32], SHA256_CTX * ctx) memset((void *)ctx, 0, sizeof(*ctx)); } +#ifdef WEAK_REFS +/* When building libmd, provide weak references. Note: this is not + activated in the context of compiling these sources for internal + use in libcrypt. + */ #undef SHA256_Init __weak_reference(_libmd_SHA256_Init, SHA256_Init); #undef SHA256_Update @@ -307,5 +312,4 @@ __weak_reference(_libmd_SHA256_Update, SHA256_Update); __weak_reference(_libmd_SHA256_Final, SHA256_Final); #undef SHA256_Transform __weak_reference(_libmd_SHA256_Transform, SHA256_Transform); -#undef SHA256_version -__weak_reference(_libmd_SHA256_version, SHA256_version); +#endif diff --git a/lib/libmd/sha512c.c b/lib/libmd/sha512c.c index 5c2e200..e5e52a8 100644 --- a/lib/libmd/sha512c.c +++ b/lib/libmd/sha512c.c @@ -319,6 +319,11 @@ SHA512_Final(unsigned char digest[64], SHA512_CTX * ctx) memset((void *)ctx, 0, sizeof(*ctx)); } +#ifdef WEAK_REFS +/* When building libmd, provide weak references. Note: this is not + activated in the context of compiling these sources for internal + use in libcrypt. + */ #undef SHA512_Init __weak_reference(_libmd_SHA512_Init, SHA512_Init); #undef SHA512_Update @@ -327,5 +332,4 @@ __weak_reference(_libmd_SHA512_Update, SHA512_Update); __weak_reference(_libmd_SHA512_Final, SHA512_Final); #undef SHA512_Transform __weak_reference(_libmd_SHA512_Transform, SHA512_Transform); -#undef SHA512_version -__weak_reference(_libmd_SHA512_version, SHA512_version); +#endif |