File md5-use-in-tree-libmd5-rfc-rather-than-libcrypto.patch of Package istgt
From aa3ef98403259dd6b03ea73161a7ef3c6bff478b Mon Sep 17 00:00:00 2001
From: David Disseldorp <ddiss@suse.de>
Date: Fri, 5 Apr 2013 16:13:36 +0200
Subject: [PATCH 6/7] md5: use in tree libmd5-rfc, rather than libcrypto
Currently libcrypto (openssl) is linked purely for md5 calculation
utilities. Use the tiny in tree libmd5-rfc library instead, and do away
with the libcrypto dependency.
---
configure | 45 ---------------------------------------------
configure.in | 1 -
src/istgt_md5.c | 20 +++++++-------------
src/istgt_md5.h | 6 +++---
4 files changed, 10 insertions(+), 62 deletions(-)
diff --git configure configure
index c4a9174..c46e423 100755
--- configure
+++ configure
@@ -3472,51 +3472,6 @@ _ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for MD5_Update in -lcrypto" >&5
-$as_echo_n "checking for MD5_Update in -lcrypto... " >&6; }
-if ${ac_cv_lib_crypto_MD5_Update+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lcrypto $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char MD5_Update ();
-int
-main ()
-{
-return MD5_Update ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_crypto_MD5_Update=yes
-else
- ac_cv_lib_crypto_MD5_Update=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_MD5_Update" >&5
-$as_echo "$ac_cv_lib_crypto_MD5_Update" >&6; }
-if test "x$ac_cv_lib_crypto_MD5_Update" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBCRYPTO 1
-_ACEOF
-
- LIBS="-lcrypto $LIBS"
-
-fi
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for cam_open_spec_device in -lcam" >&5
$as_echo_n "checking for cam_open_spec_device in -lcam... " >&6; }
if ${ac_cv_lib_cam_cam_open_spec_device+:} false; then :
diff --git configure.in configure.in
index 40ccecd..4eca28a 100644
--- configure.in
+++ configure.in
@@ -60,7 +60,6 @@ esac
# Checks for libraries.
AC_CHECK_LIB([pthread], [pthread_create])
-AC_CHECK_LIB([crypto], [MD5_Update])
AC_CHECK_LIB([cam], [cam_open_spec_device])
# Checks for header files.
diff --git src/istgt_md5.c src/istgt_md5.c
index 5a12abc..3e2f00f 100644
--- src/istgt_md5.c
+++ src/istgt_md5.c
@@ -33,42 +33,36 @@
#include <stdint.h>
#include <stddef.h>
-#include <openssl/md5.h>
#include "istgt.h"
+#include "md5.h"
#include "istgt_md5.h"
int
istgt_md5init(ISTGT_MD5CTX *md5ctx)
{
- int rc;
-
if (md5ctx == NULL)
return -1;
- rc = MD5_Init(&md5ctx->md5ctx);
- return rc;
+ md5_init(&md5ctx->state);
+ return 0;
}
int
istgt_md5final(void *md5, ISTGT_MD5CTX *md5ctx)
{
- int rc;
-
if (md5ctx == NULL || md5 == NULL)
return -1;
- rc = MD5_Final(md5, &md5ctx->md5ctx);
- return rc;
+ md5_finish(&md5ctx->state, md5);
+ return 0;
}
int
istgt_md5update(ISTGT_MD5CTX *md5ctx, const void *data, size_t len)
{
- int rc;
-
if (md5ctx == NULL)
return -1;
if (data == NULL || len <= 0)
return 0;
- rc = MD5_Update(&md5ctx->md5ctx, data, len);
- return rc;
+ md5_append(&md5ctx->state, (const md5_byte_t *)data, (int)len);
+ return 0;
}
diff --git src/istgt_md5.h src/istgt_md5.h
index 2728e18..bd40fd6 100644
--- src/istgt_md5.h
+++ src/istgt_md5.h
@@ -30,12 +30,12 @@
#include <stddef.h>
-#include <openssl/md5.h>
+#include "md5.h"
-#define ISTGT_MD5DIGEST_LEN MD5_DIGEST_LENGTH
+#define ISTGT_MD5DIGEST_LEN 16
typedef struct istgt_md5ctx_t {
- MD5_CTX md5ctx;
+ md5_state_t state;
} ISTGT_MD5CTX;
int istgt_md5init(ISTGT_MD5CTX *md5ctx);
--
1.8.1.4