summaryrefslogtreecommitdiff
path: root/pcr/zoneminder/zoneminder-1.25.0-gcrypt.patch
blob: 21f197ec67695e8c043383091a60de60d123f2eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
diff -up ./configure.ac.gcrypt ./configure.ac
--- ./configure.ac.gcrypt	2012-01-19 12:58:20.647123209 -0600
+++ ./configure.ac	2012-01-19 13:12:34.186669577 -0600
@@ -13,7 +13,7 @@ AC_ARG_VAR(ZM_DB_HOST,[Hostname where Zo
 AC_ARG_VAR(ZM_DB_NAME,[Name of ZoneMinder database, default zm])
 AC_ARG_VAR(ZM_DB_USER,[Name of ZoneMinder database user, default zmuser])
 AC_ARG_VAR(ZM_DB_PASS,[Password of ZoneMinder database user, default zmpass])
-AC_ARG_VAR(ZM_SSL_LIB,[Library to use for ssl functions, default gnutls])
+AC_ARG_VAR(ZM_SSL_LIB,[Library to use for MD5 function, default libgcrypt])
 AC_ARG_VAR(ZM_MYSQL_ENGINE,[MySQL engine to use with database, default MyISAM])
 AC_ARG_VAR(ZM_RUNDIR,[Location of transient process files, default /var/run/zm])
 AC_ARG_VAR(ZM_TMPDIR,[Location of temporary files, default /tmp/zm])
@@ -32,7 +32,7 @@ if test "$ZM_DB_PASS" == ""; then
 	AC_SUBST(ZM_DB_PASS,[zmpass])
 fi
 if test "$ZM_SSL_LIB" == ""; then
-	AC_SUBST(ZM_SSL_LIB,gnutls)
+	AC_SUBST(ZM_SSL_LIB,libgcrypt)
 fi
 if test "$ZM_MYSQL_ENGINE" == ""; then
 	AC_SUBST(ZM_MYSQL_ENGINE,MyISAM)
@@ -264,11 +264,10 @@ AC_CHECK_LIB(jpeg,jpeg_start_compress,,A
 AC_CHECK_LIB(pthread,pthread_create,,AC_MSG_ERROR(zm requires libpthread.a))
 AC_CHECK_LIB(dl,dlsym,,AC_MSG_ERROR(zm requires libdl.a))
 if test "$ZM_SSL_LIB" == "openssl"; then
-AC_CHECK_LIB(crypto,MD5,,AC_MSG_WARN([libcrypto.a is required for authenticated streaming - use ZM_SSL_LIB option to select gnutls instead]))
+AC_CHECK_LIB(crypto,MD5,,AC_MSG_WARN([libcrypto.a is required for authenticated streaming - use ZM_SSL_LIB option to select libgcrypt instead]))
 else
-AC_CHECK_HEADERS(gcrypt.h,,AC_MSG_WARN(zm requires libgcrypt headers to be installed for gnutls),)
+AC_CHECK_HEADERS(gcrypt.h,,AC_MSG_WARN(zm requires libgcrypt headers to be installed),)
 AC_CHECK_LIB(gcrypt,gcry_check_version,,AC_MSG_WARN([libgcrypt.a is required for authenticated streaming - use ZM_SSL_LIB option to select openssl instead]))
-AC_CHECK_LIB(gnutls-openssl,MD5,,AC_MSG_WARN([gnutls-openssl.a is required for authenticated streaming - use ZM_SSL_LIB option to select openssl instead]))
 fi
 AC_CHECK_LIB(pcre,pcre_compile,,AC_MSG_WARN(libpcre.a may be required for remote/network camera support))
 AC_CHECK_LIB(z,zlibVersion)
@@ -320,9 +319,6 @@ AC_CHECK_DECLS(round,,,[#include <math.h
 if test "$ZM_SSL_LIB" == "openssl"; then
 AC_CHECK_DECLS(MD5,,AC_MSG_ERROR([zm requires openssl/md5.h - use ZM_SSL_LIB option to select gnutls instead]),[#include <stdlib.h>
 #include <openssl/md5.h>])
-else
-AC_CHECK_DECLS(MD5,,AC_MSG_ERROR([zm requires gnutls/openssl.h - use ZM_SSL_LIB option to select openssl instead]),[#include <stdlib.h>
-#include <gnutls/openssl.h>])
 fi
 AC_CHECK_DECLS(backtrace,,,[#include <execinfo.h>])
 
diff -up ./src/zm_user.cpp.gcrypt ./src/zm_user.cpp
--- ./src/zm_user.cpp.gcrypt	2011-08-03 06:31:06.000000000 -0500
+++ ./src/zm_user.cpp	2012-01-19 12:58:20.654122992 -0600
@@ -140,6 +140,18 @@ User *zmLoadUser( const char *username, 
 	return( user );
 }
 
+#ifdef HAVE_GCRYPT_H
+#define HAVE_DECL_MD5 1
+#define MD5_DIGEST_LENGTH 16
+static unsigned char *MD5(const unsigned char *data, unsigned long len,
+                         unsigned char *md)
+{
+    gcry_md_hash_buffer(GCRY_MD_MD5, md, data, len);
+
+    return md;
+}
+#endif
+
 // Function to validate an authentication string
 User *zmLoadAuthUser( const char *auth, bool use_remote_addr )
 {
diff -up ./src/zm_user.h.gcrypt ./src/zm_user.h
--- ./src/zm_user.h.gcrypt	2010-11-11 06:11:07.000000000 -0600
+++ ./src/zm_user.h	2012-01-19 13:14:11.200654694 -0600
@@ -23,14 +23,11 @@
 #ifndef ZM_USER_H
 #define ZM_USER_H
 
-#if HAVE_LIBGNUTLS_OPENSSL
-#include <gnutls/openssl.h>
 #if HAVE_GCRYPT_H
 #include <gcrypt.h>
-#endif // HAVE_GCRYPT_H
 #elif HAVE_LIBCRYPTO
 #include <openssl/md5.h>
-#endif // HAVE_LIBGNUTLS_OPENSSL || HAVE_LIBCRYPTO
+#endif // HAVE_GCRYPT_H || HAVE_LIBCRYPTO
 
 class User
 {