rpms/iksemel/devel iksemel-gcrypt-sha.patch, NONE, 1.1 iksemel.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Jeffrey C. Ollie (jcollie) fedora-extras-commits at redhat.com
Fri Jul 28 18:11:51 UTC 2006


Author: jcollie

Update of /cvs/extras/rpms/iksemel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv12694/devel

Modified Files:
	.cvsignore sources 
Added Files:
	iksemel-gcrypt-sha.patch iksemel.spec 
Log Message:
auto-import iksemel-1.2-5 on branch devel from iksemel-1.2-5.src.rpm

iksemel-gcrypt-sha.patch:

--- NEW FILE iksemel-gcrypt-sha.patch ---
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 154)
+++ src/Makefile.am	(working copy)
@@ -25,5 +25,5 @@
 	base64.c
 
 libiksemel_la_LDFLAGS = -version-info 3:0:0 -no-undefined
-libiksemel_la_CFLAGS = $(CFLAGS) $(LIBGNUTLS_CFLAGS)
-libiksemel_la_LIBADD = $(LIBGNUTLS_LIBS)
+libiksemel_la_CFLAGS = $(CFLAGS) $(LIBGNUTLS_CFLAGS) $(LIBGCRYPT_CFLAGS)
+libiksemel_la_LIBADD = $(LIBGNUTLS_LIBS) $(LIBGCRYPT_LIBS)
Index: src/sha.c
===================================================================
--- src/sha.c	(revision 154)
+++ src/sha.c	(working copy)
@@ -4,17 +4,13 @@
 ** modify it under the terms of GNU Lesser General Public License.
 */
 
+#include <gcrypt.h>
+
 #include "common.h"
 #include "iksemel.h"
 
-static void sha_buffer (iksha *sha, const unsigned char *data, int len);
-static void sha_calculate (iksha *sha);
-
 struct iksha_struct {
-	unsigned long hash[5];
-	unsigned long buf[80];
-	int blen;
-	unsigned long lenhi, lenlo;
+	gcry_md_hd_t c;
 };
 
 iksha *
@@ -32,56 +28,37 @@
 iks_sha_reset (iksha *sha)
 {
 	memset (sha, 0, sizeof (iksha));
-	sha->hash[0] = 0x67452301L;
-	sha->hash[1] = 0xefcdab89L;
-	sha->hash[2] = 0x98badcfeL;
-	sha->hash[3] = 0x10325476L;
-	sha->hash[4] = 0xc3d2e1f0L;
+	gcry_md_open(&sha->c, GCRY_MD_SHA1, 0);
 }
 
 void
 iks_sha_hash (iksha *sha, const unsigned char *data, size_t len, int finish)
 {
-	unsigned char pad[8];
-	unsigned char padc;
-
-	if (data && len != 0) sha_buffer (sha, data, len);
-	if (!finish) return;
-
-	pad[0] = (unsigned char)((sha->lenhi >> 24) & 0xff);
-	pad[1] = (unsigned char)((sha->lenhi >> 16) & 0xff);
-	pad[2] = (unsigned char)((sha->lenhi >> 8) & 0xff);
-	pad[3] = (unsigned char)(sha->lenhi & 0xff);
-	pad[4] = (unsigned char)((sha->lenlo >> 24) & 0xff);
-	pad[5] = (unsigned char)((sha->lenlo >> 16) & 0xff);
-	pad[6] = (unsigned char)((sha->lenlo >> 8) & 0xff);
-	pad[7] = (unsigned char)(sha->lenlo & 255);
-
-	padc = 0x80;
-	sha_buffer (sha, &padc, 1);
-
-	padc = 0x00;
-	while (sha->blen != 56)
-		sha_buffer (sha, &padc, 1);
-
-	sha_buffer (sha, pad, 8);
+	if (data && len != 0)
+		gcry_md_write(sha->c, data, len);
+	if (finish)
+		gcry_md_final(sha->c);
 }
 
 void
 iks_sha_print (iksha *sha, char *hash)
 {
+	unsigned char bin[20];
 	int i;
+	
+	memcpy(bin, gcry_md_read(sha->c, 0), 20);
 
-	for (i=0; i<5; i++)
+	for (i=0; i<20; i++)
 	{
-		sprintf (hash, "%08lx", sha->hash[i]);
-		hash += 8;
+		sprintf (hash, "%02x", bin[i]);
+		hash += 2;
 	}
 }
 
 void
 iks_sha_delete (iksha *sha)
 {
+	gcry_md_close(sha->c);
 	iks_free (sha);
 }
 
@@ -95,58 +72,3 @@
 	iks_sha_print (sha, hash);
 	iks_free (sha);
 }
-
-static void
-sha_buffer (iksha *sha, const unsigned char *data, int len)
-{
-	int i;
-
-	for (i=0; i<len; i++) {
-		sha->buf[sha->blen / 4] <<= 8;
-		sha->buf[sha->blen / 4] |= (unsigned long)data[i];
-		if ((++sha->blen) % 64 == 0) {
-			sha_calculate (sha);
-			sha->blen = 0;
-		}
-		sha->lenlo += 8;
-		sha->lenhi += (sha->lenlo < 8);
-	}
-}
-
-#define SRL(x,y) (((x) << (y)) | ((x) >> (32-(y))))
-#define SHA(a,b,f,c) \
-	for (i= (a) ; i<= (b) ; i++) { \
-		TMP = SRL(A,5) + ( (f) ) + E + sha->buf[i] + (c) ; \
-		E = D; \
-		D = C; \
-		C = SRL(B,30); \
-		B = A; \
-		A = TMP; \
-	}
-
-static void
-sha_calculate (iksha *sha)
-{
-	int i;
-	unsigned long A, B, C, D, E, TMP;
-
-	for (i=16; i<80; i++)
-		sha->buf[i] = SRL (sha->buf[i-3] ^ sha->buf[i-8] ^ sha->buf[i-14] ^ sha->buf[i-16], 1);
-
-	A = sha->hash[0];
-	B = sha->hash[1];
-	C = sha->hash[2];
-	D = sha->hash[3];
-	E = sha->hash[4];
-
-	SHA (0,  19, ((C^D)&B)^D,     0x5a827999L);
-	SHA (20, 39, B^C^D,           0x6ed9eba1L);
-	SHA (40, 59, (B&C)|(D&(B|C)), 0x8f1bbcdcL);
-	SHA (60, 79, B^C^D,           0xca62c1d6L);
-
-	sha->hash[0] += A;
-	sha->hash[1] += B;
-	sha->hash[2] += C;
-	sha->hash[3] += D;
-	sha->hash[4] += E;
-}
Index: configure.ac
===================================================================
--- configure.ac	(revision 154)
+++ configure.ac	(working copy)
@@ -46,6 +46,7 @@
 AC_CHECK_FUNCS(getaddrinfo)
 
 AM_PATH_LIBGNUTLS(,AC_DEFINE(HAVE_GNUTLS,,"Use libgnutls"))
+AM_PATH_LIBGCRYPT(,AC_DEFINE(HAVE_LIBGCRYPT,,"Use libgcrypt"))
 
 dnl Check -Wall flag of GCC
 if test "x$GCC" = "xyes"; then


--- NEW FILE iksemel.spec ---
Name:           iksemel
Version:        1.2
Release:        5%{?dist}
Summary:        An XML parser library designed for Jabber applications

Group: 		System Environment/Libraries
License:        LGPL
URL:            http://iksemel.jabberstudio.org/
Source0:        http://files.jabberstudio.org/iksemel/iksemel-%{version}.tar.gz
Patch0:         iksemel-gcrypt-sha.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  gnutls-devel
BuildRequires:  libgcrypt-devel
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  libtool
BuildRequires:  texinfo
# BR this because gnutls config script needs it (BZ#200493)
BuildRequires:  pkgconfig

%description

An XML parser library designed for Jabber applications. It is coded in
ANSI C for POSIX compatible environments, thus highly portable.

%package devel
Group:		Development/Libraries
Summary:	Development files for iksemel

Requires:	%{name} = %{version}-%{release}
Requires:	gnutls-devel
Requires:	pkgconfig

Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info

%description devel
Development files for iksemel.

%package utils
Group:		Applications/Internet
Summary:	Development files for iksemel
Requires:	%{name} = %{version}-%{release}

%description utils
Utlity programs for iksemel.

%prep
%setup0 -q
%patch0 -p0

# force rebuilding of the info file
rm doc/iksemel

%build
# We need to re-run the autotools because the patch we apply modifies
# the configure.ac and src/Makefile.am
libtoolize --copy --force --automake
aclocal
autoheader
automake --add-missing --force-missing --gnu --include-deps
autoconf
%configure --disable-static --disable-rpath
make %{?_smp_mflags}

%install
rm -rf %{buildroot}
make install DESTDIR=%{buildroot}

rm -f %{buildroot}%{_libdir}/*.la

mv %{buildroot}%{_infodir}/iksemel %{buildroot}%{_infodir}/iksemel.info

%check
make check

%clean
rm -rf %{buildroot}

%postun -p /sbin/ldconfig

%post -p /sbin/ldconfig

%post devel
/sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || :

%preun devel
if [ $1 = 0 ]; then
    /sbin/install-info --delete %{_infodir}/%{name}.info %{_infodir}/dir || :
fi

%files
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING HACKING NEWS README TODO

%{_libdir}/libiksemel.so.*

%files devel
%defattr(-,root,root,-)
%doc COPYING

%{_libdir}/libiksemel.so
%{_includedir}/iksemel.h
%{_libdir}/pkgconfig/iksemel.pc
%{_infodir}/iksemel.info*

%files utils
%defattr(-,root,root,-)
%doc COPYING

%{_bindir}/ikslint
%{_bindir}/iksperf
%{_bindir}/iksroster

%changelog
* Thu Jul 27 2006 Jeffrey C. Ollie <jeff at ocjtech.us> - 1.2-5
- Patch to use SHA1 hashing routines from libgcrypt rather than
  broken internal code.  This means that we need to BR autoools
  to regenerate comfigure script and makefiles.

* Mon Jun 26 2006 Jeffrey C. Ollie <jeff at ocjtech.us> - 1.2-4
- Don't re-run autotools, fix rpath in a different way.

* Mon Jun 26 2006 Jeffrey C. Ollie <jeff at ocjtech.us> - 1.2-3
- Add a %check section.
- Add BR for libtool.

* Tue May 30 2006 Jeffrey C. Ollie <jeff at ocjtech.us> - 1.2-2
- Add texinfo BR

* Mon May 29 2006 Jeffrey C. Ollie <jeff at ocjtech.us> - 1.2-1
- First version for Fedora Extras.



Index: .cvsignore
===================================================================
RCS file: /cvs/extras/rpms/iksemel/devel/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	28 Jul 2006 18:11:14 -0000	1.1
+++ .cvsignore	28 Jul 2006 18:11:51 -0000	1.2
@@ -0,0 +1 @@
+iksemel-1.2.tar.gz


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/iksemel/devel/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	28 Jul 2006 18:11:14 -0000	1.1
+++ sources	28 Jul 2006 18:11:51 -0000	1.2
@@ -0,0 +1 @@
+82e7c8fdb6211839246b788c040a796b  iksemel-1.2.tar.gz




More information about the fedora-extras-commits mailing list