mirror of
https://github.com/strophe/libstrophe.git
synced 2026-08-05 11:26:22 +00:00
Compare commits
6 Commits
0.8.7
...
wip-fbsd-p
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d8a9e9f915 | ||
|
|
a0efdd1314 | ||
|
|
1aa45c0f19 | ||
|
|
84e67d02b4 | ||
|
|
96ced6699d | ||
|
|
328bf3626f |
7
.gitignore
vendored
7
.gitignore
vendored
@@ -22,8 +22,9 @@ autom4te.cache
|
|||||||
.sconsign*
|
.sconsign*
|
||||||
src/*.o
|
src/*.o
|
||||||
examples/*.o
|
examples/*.o
|
||||||
|
tests/*.o
|
||||||
|
tests/check_parser
|
||||||
*.a
|
*.a
|
||||||
*.pc
|
|
||||||
*.tar.gz
|
*.tar.gz
|
||||||
*.zip
|
*.zip
|
||||||
docs/html
|
docs/html
|
||||||
@@ -34,11 +35,7 @@ examples/active
|
|||||||
examples/roster
|
examples/roster
|
||||||
examples/bot
|
examples/bot
|
||||||
test_stamp
|
test_stamp
|
||||||
test-suite.log
|
|
||||||
tests/*.o
|
tests/*.o
|
||||||
tests/*.log
|
|
||||||
tests/*.trs
|
|
||||||
tests/check_parser
|
|
||||||
tests/test_base64
|
tests/test_base64
|
||||||
tests/test_ctx
|
tests/test_ctx
|
||||||
tests/test_hash
|
tests/test_hash
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
0.8.7
|
TBA
|
||||||
- SCRAM-SHA-1 authentication mechanism
|
- SCRAM-SHA-1 authentication mechanism
|
||||||
- pkg-config support
|
|
||||||
|
|
||||||
0.8.5
|
0.8.5
|
||||||
- libtoolize to generate .so
|
- libtoolize to generate .so
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ endif
|
|||||||
include_HEADERS = strophe.h
|
include_HEADERS = strophe.h
|
||||||
noinst_HEADERS = strophepp.h
|
noinst_HEADERS = strophepp.h
|
||||||
|
|
||||||
pkgconfig_DATA = libstrophe.pc
|
|
||||||
|
|
||||||
EXTRA_DIST = docs
|
EXTRA_DIST = docs
|
||||||
|
|
||||||
## Examples
|
## Examples
|
||||||
@@ -63,4 +61,3 @@ tests_check_parser_SOURCES = tests/check_parser.c tests/test.h
|
|||||||
tests_check_parser_CFLAGS = @check_CFLAGS@ $(PARSER_CFLAGS) $(STROPHE_FLAGS) \
|
tests_check_parser_CFLAGS = @check_CFLAGS@ $(PARSER_CFLAGS) $(STROPHE_FLAGS) \
|
||||||
-I$(top_srcdir)/src
|
-I$(top_srcdir)/src
|
||||||
tests_check_parser_LDADD = @check_LIBS@ $(STROPHE_LIBS)
|
tests_check_parser_LDADD = @check_LIBS@ $(STROPHE_LIBS)
|
||||||
tests_check_parser_LDFLAGS = -static
|
|
||||||
|
|||||||
55
configure.ac
55
configure.ac
@@ -12,14 +12,8 @@ AS_CASE([$host_os],
|
|||||||
[freebsd*], [PLATFORM="freebsd"],
|
[freebsd*], [PLATFORM="freebsd"],
|
||||||
[PLATFORM="nix"])
|
[PLATFORM="nix"])
|
||||||
|
|
||||||
PKG_CHECK_MODULES([openssl], [openssl], [PC_REQUIRES+=(openssl)],
|
PKG_CHECK_MODULES([openssl], [openssl], [],
|
||||||
[AC_CHECK_HEADER([openssl/ssl.h],
|
[AC_CHECK_HEADER(openssl/ssl.h, [openssl_LIBS="-lssl -lcrypto"], [AC_MSG_ERROR([openssl not found; openssl required])])])
|
||||||
[
|
|
||||||
openssl_LIBS="-lssl -lcrypto"
|
|
||||||
PC_LIBS+=($openssl_LIBS)
|
|
||||||
],
|
|
||||||
[AC_MSG_ERROR([openssl not found; openssl required])]
|
|
||||||
)])
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES([check], [check >= 0.9.4], [], [AC_MSG_WARN([libcheck not found; unit tests will not be compilable])])
|
PKG_CHECK_MODULES([check], [check >= 0.9.4], [], [AC_MSG_WARN([libcheck not found; unit tests will not be compilable])])
|
||||||
|
|
||||||
@@ -30,35 +24,18 @@ AC_ARG_WITH([libxml2],
|
|||||||
|
|
||||||
if test "x$with_libxml2" != xno; then
|
if test "x$with_libxml2" != xno; then
|
||||||
PKG_CHECK_MODULES([libxml2], [libxml-2.0 >= 2.7],
|
PKG_CHECK_MODULES([libxml2], [libxml-2.0 >= 2.7],
|
||||||
[
|
[with_libxml2=yes], [dummy=1])
|
||||||
with_libxml2=yes
|
if test "x$with_libxml2" != xyes; then
|
||||||
PC_REQUIRES+=(libxml-2.0)
|
|
||||||
],
|
|
||||||
[
|
|
||||||
old_CFLAGS=$CFLAGS
|
old_CFLAGS=$CFLAGS
|
||||||
CFLAGS="-I${includedir}/libxml2"
|
CFLAGS="-I${includedir}/libxml2"
|
||||||
AC_CHECK_HEADER([libxml/parser.h],
|
AC_CHECK_HEADER([libxml/parser.h],
|
||||||
[
|
[with_libxml2=yes; libxml2_CFLAGS="-I${includedir}/libxml2"; libxml2_LIBS="-lxml2"],
|
||||||
with_libxml2=yes
|
|
||||||
libxml2_CFLAGS="-I${includedir}/libxml2"
|
|
||||||
libxml2_LIBS="-lxml2"
|
|
||||||
PC_LIBS+=($libxml2_LIBS)
|
|
||||||
PC_CFLAGS+=($libxml2_CFLAGS)
|
|
||||||
],
|
|
||||||
[AC_MSG_ERROR([libxml2 not found.])])
|
[AC_MSG_ERROR([libxml2 not found.])])
|
||||||
CFLAGS=$old_CFLAGS
|
CFLAGS=$old_CFLAGS
|
||||||
])
|
fi
|
||||||
else
|
else
|
||||||
PKG_CHECK_MODULES([expat], [expat >= 2.0.0],
|
PKG_CHECK_MODULES([expat], [expat >= 2.0.0], [],
|
||||||
[PC_REQUIRES+=(expat)],
|
[AC_CHECK_HEADER(expat.h, [expat_LIBS="-lexpat"], [AC_MSG_ERROR([expat not found; expat required.])])])
|
||||||
[AC_CHECK_HEADER([expat.h],
|
|
||||||
[
|
|
||||||
expat_LIBS="-lexpat"
|
|
||||||
PC_LIBS+=($expat_LIBS)
|
|
||||||
],
|
|
||||||
[AC_MSG_ERROR([expat not found; expat required.])]
|
|
||||||
)
|
|
||||||
])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test "x$with_libxml2" = xyes; then
|
if test "x$with_libxml2" = xyes; then
|
||||||
@@ -80,29 +57,15 @@ if test "x$PLATFORM" != xfreebsd; then
|
|||||||
AC_CHECK_LIB([resolv], [res_query], [],
|
AC_CHECK_LIB([resolv], [res_query], [],
|
||||||
[AC_CHECK_LIB([resolv], [__res_query], [],
|
[AC_CHECK_LIB([resolv], [__res_query], [],
|
||||||
[AC_MSG_ERROR([libresolv not found; libresolv required. ])])])
|
[AC_MSG_ERROR([libresolv not found; libresolv required. ])])])
|
||||||
PC_LIBS+=(-lresolv)
|
|
||||||
else
|
else
|
||||||
AC_MSG_NOTICE([skipping libresolv checks for freebsd])
|
AC_MSG_NOTICE([skipping libresolv checks for freebsd])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_HEADERS([arpa/nameser_compat.h])
|
AC_CHECK_HEADERS([arpa/nameser_compat.h])
|
||||||
|
|
||||||
|
|
||||||
m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR],
|
|
||||||
[AC_ARG_WITH([pkgconfigdir],
|
|
||||||
[AS_HELP_STRING([--with-pkgconfigdir],
|
|
||||||
[install directory for libstrophe.pc pkg-config file])],
|
|
||||||
[],[with_pkgconfigdir='$(libdir)/pkgconfig'])
|
|
||||||
AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])])
|
|
||||||
|
|
||||||
AM_CONDITIONAL([PARSER_EXPAT], [test x$with_parser != xlibxml2])
|
AM_CONDITIONAL([PARSER_EXPAT], [test x$with_parser != xlibxml2])
|
||||||
|
|
||||||
AC_SUBST([PC_REQUIRES], [${PC_REQUIRES[[@]]}])
|
|
||||||
AC_SUBST([PC_CFLAGS], [${PC_CFLAGS[[@]]}])
|
|
||||||
AC_SUBST([PC_LIBS], [${PC_LIBS[[@]]}])
|
|
||||||
|
|
||||||
AC_SUBST(PARSER_NAME)
|
AC_SUBST(PARSER_NAME)
|
||||||
AC_SUBST(PARSER_CFLAGS)
|
AC_SUBST(PARSER_CFLAGS)
|
||||||
AC_SUBST(PARSER_LIBS)
|
AC_SUBST(PARSER_LIBS)
|
||||||
AC_CONFIG_FILES([Makefile libstrophe.pc])
|
AC_CONFIG_FILES([Makefile])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
prefix=@prefix@
|
|
||||||
exec_prefix=@exec_prefix@
|
|
||||||
libdir=@libdir@
|
|
||||||
includedir=@includedir@
|
|
||||||
|
|
||||||
Name: libstrophe
|
|
||||||
Description: A simple, lightweight C library for writing XMPP clients
|
|
||||||
URL: http://strophe.im/libstrophe/
|
|
||||||
Version: @VERSION@
|
|
||||||
Requires:
|
|
||||||
Requires.private: @PC_REQUIRES@
|
|
||||||
Libs: -L${libdir} -lstrophe
|
|
||||||
Libs.private: @PC_LIBS@
|
|
||||||
Cflags: -I${includedir} @PC_CFLAGS@
|
|
||||||
@@ -8,24 +8,12 @@ License: MIT/GPLv3
|
|||||||
URL: http://strophe.im/libstrophe/
|
URL: http://strophe.im/libstrophe/
|
||||||
Source0: libstrophe_git.tar.gz
|
Source0: libstrophe_git.tar.gz
|
||||||
|
|
||||||
BuildRequires: automake
|
|
||||||
BuildRequires: libtool
|
|
||||||
BuildRequires: openssl-devel
|
|
||||||
BuildRequires: expat-devel
|
BuildRequires: expat-devel
|
||||||
Requires: expat
|
Requires: expat
|
||||||
|
|
||||||
%description
|
%description
|
||||||
XMPP library in C
|
XMPP library in C
|
||||||
|
|
||||||
%package devel
|
|
||||||
Summary: Headers and libraries for building apps that use libstrophe
|
|
||||||
Group: Development/Libraries
|
|
||||||
Requires: %{name} = %{version}-%{release}
|
|
||||||
|
|
||||||
%description devel
|
|
||||||
This package contains headers and libraries required to build applications that
|
|
||||||
use the strophe XMPP library.
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -n libstrophe
|
%setup -n libstrophe
|
||||||
./bootstrap.sh
|
./bootstrap.sh
|
||||||
@@ -37,21 +25,8 @@ make %{?_smp_mflags}
|
|||||||
%install
|
%install
|
||||||
make install DESTDIR=%{buildroot}
|
make install DESTDIR=%{buildroot}
|
||||||
|
|
||||||
%post -p /sbin/ldconfig
|
|
||||||
|
|
||||||
%postun -p /sbin/ldconfig
|
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root,-)
|
|
||||||
%{_libdir}/libstrophe.so*
|
|
||||||
%doc
|
|
||||||
|
|
||||||
%files devel
|
|
||||||
%defattr(-,root,root,-)
|
|
||||||
%{_libdir}/libstrophe.a
|
%{_libdir}/libstrophe.a
|
||||||
%{_libdir}/libstrophe.la
|
|
||||||
%{_libdir}/pkgconfig/libstrophe.pc
|
|
||||||
%{_includedir}/strophe.h
|
%{_includedir}/strophe.h
|
||||||
%doc
|
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
|||||||
@@ -250,13 +250,12 @@ const char * hash_iter_next(hash_iterator_t *iter)
|
|||||||
{
|
{
|
||||||
hash_t *table = iter->table;
|
hash_t *table = iter->table;
|
||||||
hashentry_t *entry = iter->entry;
|
hashentry_t *entry = iter->entry;
|
||||||
int i;
|
int i = iter->index + 1;
|
||||||
|
|
||||||
/* advance until we find the next entry */
|
/* advance until we find the next entry */
|
||||||
if (entry != NULL) entry = entry->next;
|
if (entry != NULL) entry = entry->next;
|
||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
/* we're off the end of list, search for a new entry */
|
/* we're off the end of list, search for a new entry */
|
||||||
i = iter->index + 1;
|
|
||||||
while (i < iter->table->length) {
|
while (i < iter->table->length) {
|
||||||
entry = table->entries[i];
|
entry = table->entries[i];
|
||||||
if (entry != NULL) {
|
if (entry != NULL) {
|
||||||
@@ -267,7 +266,7 @@ const char * hash_iter_next(hash_iterator_t *iter)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry == NULL) {
|
if ((entry == NULL) || (i >= table->length)) {
|
||||||
/* no more keys! */
|
/* no more keys! */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
29
src/sha1.c
29
src/sha1.c
@@ -90,14 +90,19 @@ A million repetitions of "a"
|
|||||||
|
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
|
|
||||||
static uint32_t host_to_be(uint32_t i);
|
|
||||||
static void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]);
|
static void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64]);
|
||||||
|
|
||||||
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
|
||||||
|
|
||||||
/* blk0() and blk() perform the initial expand. */
|
/* blk0() and blk() perform the initial expand. */
|
||||||
/* I got the idea of expanding during the round function from SSLeay */
|
/* I got the idea of expanding during the round function from SSLeay */
|
||||||
#define blk0(i) (block->l[i] = host_to_be(block->l[i]))
|
/* FIXME: can we do this in an endian-proof way? */
|
||||||
|
#ifdef WORDS_BIGENDIAN
|
||||||
|
#define blk0(i) block->l[i]
|
||||||
|
#else
|
||||||
|
#define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
|
||||||
|
|(rol(block->l[i],8)&0x00FF00FF))
|
||||||
|
#endif
|
||||||
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
|
#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
|
||||||
^block->l[(i+2)&15]^block->l[i&15],1))
|
^block->l[(i+2)&15]^block->l[i&15],1))
|
||||||
|
|
||||||
@@ -122,26 +127,6 @@ void SHAPrintContext(SHA1_CTX *context, char *msg){
|
|||||||
}
|
}
|
||||||
#endif /* VERBOSE */
|
#endif /* VERBOSE */
|
||||||
|
|
||||||
static uint32_t host_to_be(uint32_t i)
|
|
||||||
{
|
|
||||||
#define le_to_be(i) ((rol((i),24) & 0xFF00FF00) | (rol((i),8) & 0x00FF00FF))
|
|
||||||
#if defined(__BIG_ENDIAN__) || \
|
|
||||||
(defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) && \
|
|
||||||
__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
|
|
||||||
return i;
|
|
||||||
#elif defined(__LITTLE_ENDIAN__) || \
|
|
||||||
(defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && \
|
|
||||||
__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__)
|
|
||||||
return le_to_be(i);
|
|
||||||
#else /* fallback to run-time check */
|
|
||||||
static const union {
|
|
||||||
uint32_t u;
|
|
||||||
unsigned char c;
|
|
||||||
} check = {1};
|
|
||||||
return check.c ? le_to_be(i) : i;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hash a single 512-bit block. This is the core of the algorithm. */
|
/* Hash a single 512-bit block. This is the core of the algorithm. */
|
||||||
static void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
|
static void SHA1_Transform(uint32_t state[5], const uint8_t buffer[64])
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user