tis 2014-03-11 klockan 09:53 +0200 skrev Tsantilas Christos:

> No objection, just to note that these algorithms are implemented in
> openssl library too and squid already has dependencies to openSSL.

And in Squid-2 used OpenSSL MD5 if linked to OpenSSL, or some system MD5
implementation (i.e. Solaris).

>From squid-2 squid_md5.h:

/*
 * If Squid is compiled with OpenSSL then we use the MD5 routines
 * from there via some wrapper macros, and the rest of this file is ignored..
 */

#if USE_OPENSSL && HAVE_OPENSSL_MD5_H
#define USE_SQUID_MD5 0
#include <openssl/md5.h>

/* Hack to adopt Squid to the OpenSSL syntax */
#define SQUID_MD5_DIGEST_LENGTH MD5_DIGEST_LENGTH

#define SQUID_MD5Init MD5_Init
#define SQUID_MD5Update MD5_Update
#define SQUID_MD5Final MD5_Final
#define SQUID_MD5_CTX MD5_CTX

#elif USE_OPENSSL && !HAVE_OPENSSL_MD5_H
#error Cannot find OpenSSL MD5 headers

#elif (HAVE_SYS_MD5_H || HAVE_MD5_H) && HAVE_MD5INIT
/*
 * Solaris 10 provides MD5 as part of the system.
 */
#if HAVE_MD5_H
#include <md5.h>
#else
#include <sys/md5.h>
#endif

/*
 * They also define SQUID_MD5_CTX with different field names
 * fortunately we do not access it directly in the squid code.
 */

#define SQUID_MD5Init MD5Init
#define SQUID_MD5Update MD5Update
#define SQUID_MD5Final MD5Final
#define SQUID_MD5_CTX MD5_CTX

#ifdef MD5_DIGEST_LENGTH
#define SQUID_MD5_DIGEST_LENGTH MD5_DIGEST_LENGTH
#else
#define SQUID_MD5_DIGEST_LENGTH 16
#endif

#else /* No system MD5 code found */


> The API provided by nettle is very similar to openSSL related API.

Which is very similar to the reference implementation shipped with
Squid.

Regards
Henrik

Reply via email to