Changeset 24776


Ignore:
Timestamp:
2010-12-22T04:33:49+01:00 (7 years ago)
Author:
swalker
Message:

[packages] btpd: update to 0.16

  • drop the openssl changes that were re-added in r16657
  • update to current gnulib sha1 code
  • re-add gnulib config header guard
  • mark conffile
  • use PKG_INSTALL
Location:
packages/net/btpd
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • packages/net/btpd/Makefile

    r23207 r24776  
    99 
    1010PKG_NAME:=btpd 
    11 PKG_VERSION:=0.15 
    12 PKG_RELEASE:=2 
     11PKG_VERSION:=0.16 
     12PKG_RELEASE:=1 
    1313 
    1414PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz 
    15 PKG_SOURCE_URL:=http://www.murmeldjur.se/btpd/ 
    16 PKG_MD5SUM:=b64e2e8b9936e99685bc1e7246655561 
     15PKG_SOURCE_URL:=https://github.com/downloads/btpd/btpd 
     16PKG_MD5SUM:=fe042aae8d7c515ecd855673d1c2b33e 
     17 
     18PKG_INSTALL:=1 
    1719 
    1820include $(INCLUDE_DIR)/package.mk 
     
    2123  SECTION:=net 
    2224  CATEGORY:=Network 
    23   DEPENDS:=+libopenssl +libpthread 
     25  DEPENDS:=+libpthread 
    2426  SUBMENU:=BitTorrent 
    2527  TITLE:=btpd - BitTorrent Protocol Daemon 
    26   URL:=http://www.murmeldjur.se/btpd/ 
     28  URL:=https://github.com/btpd/btpd/wiki/ 
    2729endef 
    2830 
    2931define Package/btpd/description 
    30         BTPD is a bittorrent client consisting of a daemon and client commands,  
    31         which can be used to read and/or manipulate the daemon state.  
    32         The daemon is capable of running several torrents simultaneously and only uses one tcp port.  
    33         It's fairly low on resource usage and should be perfect for file distribution sites.  
     32        BTPD is a bittorrent client consisting of a daemon and client commands, 
     33        which can be used to read and/or manipulate the daemon state. 
     34        The daemon is capable of running several torrents simultaneously and only uses one tcp port. 
     35        It's fairly low on resource usage and should be perfect for file distribution sites. 
    3436        Efficient downloads and ease of use makes this client a good choice for the casual user as well. 
     37endef 
     38 
     39define Package/btpd/conffiles 
     40/etc/config/btpd 
    3541endef 
    3642 
     
    3945define Package/btpd/install 
    4046        $(INSTALL_DIR) $(1)/usr/bin 
    41         $(INSTALL_BIN) $(PKG_BUILD_DIR)/btpd/btpd $(1)/usr/bin 
    42         $(INSTALL_BIN) $(PKG_BUILD_DIR)/cli/btcli $(1)/usr/bin 
    43         $(INSTALL_BIN) $(PKG_BUILD_DIR)/cli/btinfo $(1)/usr/bin  
     47        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/bt{cli,info,pd} $(1)/usr/bin/ 
    4448        $(INSTALL_DIR) $(1)/etc/init.d 
    4549        $(INSTALL_BIN) ./files/btpd.init $(1)/etc/init.d/btpd 
  • packages/net/btpd/patches/000-sha1.diff

    r16657 r24776  
    1 diff -urN btpd-0.15/btpd/content.c btpd-0.15-new/btpd/content.c 
    2 --- btpd-0.15/btpd/content.c    2009-02-03 10:15:01.000000000 -0500 
    3 +++ btpd-0.15-new/btpd/content.c        2009-06-19 15:02:48.000000000 -0400 
     1--- a/btpd/btpd.c 
     2+++ b/btpd/btpd.c 
     3@@ -1,6 +1,6 @@ 
     4 #include "btpd.h" 
     5  
     6-#include <openssl/sha.h> 
     7+#include "sha1.h" 
     8 #include <signal.h> 
     9  
     10 static uint8_t m_peer_id[20]; 
     11@@ -114,7 +114,7 @@ btpd_init(void) 
     12     idcon[sizeof(idcon) - 1] = '\0'; 
     13     n = strlen(idcon); 
     14  
     15-    SHA1(idcon, n, m_peer_id); 
     16+    sha1_buffer(idcon, n, m_peer_id); 
     17     bcopy(m_peer_id, &seed, sizeof(seed)); 
     18     bcopy(BTPD_VERSION, m_peer_id, sizeof(BTPD_VERSION) - 1); 
     19     m_peer_id[sizeof(BTPD_VERSION) - 1] = '|'; 
     20--- a/btpd/content.c 
     21+++ b/btpd/content.c 
    422@@ -1,6 +1,6 @@ 
    523 #include "btpd.h" 
     
    1028  
    1129 struct content { 
    12 diff -urN btpd-0.15/btpd/download_subr.c btpd-0.15-new/btpd/download_subr.c 
    13 --- btpd-0.15/btpd/download_subr.c      2009-02-07 16:45:36.000000000 -0500 
    14 +++ btpd-0.15-new/btpd/download_subr.c  2009-06-19 15:03:06.000000000 -0400 
    15 @@ -21,7 +21,6 @@ 
     30@@ -60,16 +60,16 @@ static struct timeout m_workev; 
     31 static int 
     32 test_hash(struct torrent *tp, uint8_t *hash, uint32_t piece) 
     33 { 
     34-    char piece_hash[SHA_DIGEST_LENGTH]; 
     35+    char piece_hash[SHA1_DIGEST_SIZE]; 
     36     tlib_read_hash(tp->tl, tp->pieces_off, piece, piece_hash); 
     37-    return bcmp(hash, piece_hash, SHA_DIGEST_LENGTH); 
     38+    return bcmp(hash, piece_hash, SHA1_DIGEST_SIZE); 
     39 } 
     40  
     41 static int 
     42 test_piece(struct torrent *tp, uint32_t piece, int *ok) 
     43 { 
     44     int err; 
     45-    uint8_t hash[SHA_DIGEST_LENGTH]; 
     46+    uint8_t hash[SHA1_DIGEST_SIZE]; 
     47     if ((err = bts_sha(tp->cm->rds, piece * tp->piece_length, 
     48              torrent_piece_size(tp, piece), hash)) != 0) { 
     49         btpd_log(BTPD_L_ERROR, "io error on '%s' (%s).\n", 
     50--- a/btpd/download_subr.c 
     51+++ b/btpd/download_subr.c 
     52@@ -21,7 +21,7 @@ 
    1653  
    1754 #include "btpd.h" 
    1855  
    1956-#include <openssl/sha.h> 
     57+#include "sha1.h" 
    2058 #include <stream.h> 
    2159  
    2260 static void 
    23 diff -urN btpd-0.15/btpd/torrent.c btpd-0.15-new/btpd/torrent.c 
    24 --- btpd-0.15/btpd/torrent.c    2009-01-26 16:15:10.000000000 -0500 
    25 +++ btpd-0.15-new/btpd/torrent.c        2009-06-19 15:03:24.000000000 -0400 
     61@@ -42,7 +42,7 @@ piece_log_hashes(struct piece *pc) 
     62     for (unsigned i = 0; i < pc->nblocks; i++) { 
     63         uint32_t bsize = torrent_block_size(tp, pc->index, pc->nblocks, i); 
     64         cm_get_bytes(tp, pc->index, i * PIECE_BLOCKLEN, bsize, &buf); 
     65-        SHA1(buf, bsize, &log->hashes[i * 20]); 
     66+        sha1_buffer(buf, bsize, &log->hashes[i * 20]); 
     67         free(buf); 
     68     } 
     69 } 
     70--- a/btpd/torrent.c 
     71+++ b/btpd/torrent.c 
    2672@@ -1,7 +1,5 @@ 
    2773 #include "btpd.h" 
     
    3278  
    3379 static unsigned m_nghosts; 
    34 diff -urN btpd-0.15/configure.ac btpd-0.15-new/configure.ac 
    35 --- btpd-0.15/configure.ac      2009-02-09 16:04:53.000000000 -0500 
    36 +++ btpd-0.15-new/configure.ac  2009-06-19 15:04:12.000000000 -0400 
    37 @@ -29,13 +29,6 @@ 
     80--- a/configure.ac 
     81+++ b/configure.ac 
     82@@ -29,13 +29,6 @@ rm -f conftest.c conftest.$OBJEXT 
    3883 rm -f conftest.c conftest.$OBJEXT 
    3984 [$3])) 
     
    4994 [  --with-evloop-method    select evloop method (epoll,poll,kqueue)], 
    5095     evloop_methods=$withval, 
    51 @@ -76,11 +69,6 @@ 
     96@@ -76,11 +69,6 @@ CC_ARGS_OK_IFELSE(-Wno-pointer-sign, 
    5297 , 
    5398     AC_MSG_RESULT(no)) 
     
    61106     case $m in 
    62107     epoll) 
    63 diff -urN btpd-0.15/Makefile.in btpd-0.15-new/Makefile.in 
    64 --- btpd-0.15/Makefile.in       2009-02-09 16:08:59.000000000 -0500 
    65 +++ btpd-0.15-new/Makefile.in   2009-06-19 15:21:05.000000000 -0400 
    66 @@ -58,7 +58,8 @@ 
    67  am_misc_libmisc_a_OBJECTS = misc/benc.$(OBJEXT) misc/btpd_if.$(OBJEXT) \ 
    68         misc/metainfo.$(OBJEXT) misc/hashtable.$(OBJEXT) \ 
    69         misc/http_client.$(OBJEXT) misc/iobuf.$(OBJEXT) \ 
    70 -       misc/stream.$(OBJEXT) misc/subr.$(OBJEXT) 
    71 +       misc/stream.$(OBJEXT) misc/subr.$(OBJEXT) \ 
    72 +       misc/sha1.$(OBJEXT)  
    73  misc_libmisc_a_OBJECTS = $(am_misc_libmisc_a_OBJECTS) 
    74  am__installdirs = "$(DESTDIR)$(bindir)" 
    75  binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 
    76 @@ -213,8 +214,8 @@ 
    77  top_builddir = @top_builddir@ 
    78  top_srcdir = @top_srcdir@ 
    79  AM_CFLAGS = -std=c99 -Wall @WARNNPS@ 
    80 -AM_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D@EVLOOP_METHOD@ -I$(top_srcdir)/misc -I$(top_srcdir)/evloop @openssl_CPPFLAGS@ 
    81 -AM_LDFLAGS = @openssl_LDFLAGS@ 
    82 +AM_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -D@EVLOOP_METHOD@ -I$(top_srcdir)/misc -I$(top_srcdir)/evloop  
    83 +AM_LDFLAGS =  
    84  noinst_LIBRARIES = misc/libmisc.a evloop/libevloop.a 
    85  EXTRA_DIST = COPYRIGHT CHANGES 
    86   
    87 @@ -256,7 +257,8 @@ 
    88         misc/iobuf.c misc/iobuf.h\ 
    89         misc/queue.h\ 
    90         misc/stream.c misc/stream.h\ 
    91 -       misc/subr.c misc/subr.h 
    92 +       misc/subr.c misc/subr.h\ 
    93 +       misc/sha1.c misc/sha1.h 
    94   
    95   
    96  # evloop 
    97 @@ -349,6 +351,8 @@ 
    98         misc/$(DEPDIR)/$(am__dirstamp) 
    99  misc/subr.$(OBJEXT): misc/$(am__dirstamp) \ 
    100         misc/$(DEPDIR)/$(am__dirstamp) 
    101 +misc/sha1.$(OBJEXT): misc/$(am__dirstamp) \ 
    102 +       misc/$(DIPDIR)/$(am__dirstamp) 
    103  misc/libmisc.a: $(misc_libmisc_a_OBJECTS) $(misc_libmisc_a_DEPENDENCIES) misc/$(am__dirstamp) 
    104         -rm -f misc/libmisc.a 
    105         $(misc_libmisc_a_AR) misc/libmisc.a $(misc_libmisc_a_OBJECTS) $(misc_libmisc_a_LIBADD) 
    106 @@ -492,6 +496,7 @@ 
    107         -rm -f misc/metainfo.$(OBJEXT) 
    108         -rm -f misc/stream.$(OBJEXT) 
    109         -rm -f misc/subr.$(OBJEXT) 
    110 +       -rm -f misc/sha1.$(OBJEXT) 
    111   
    112  distclean-compile: 
    113         -rm -f *.tab.c 
    114 @@ -538,6 +543,7 @@ 
    115  @AMDEP_TRUE@@am__include@ @am__quote@misc/$(DEPDIR)/metainfo.Po@am__quote@ 
    116  @AMDEP_TRUE@@am__include@ @am__quote@misc/$(DEPDIR)/stream.Po@am__quote@ 
    117  @AMDEP_TRUE@@am__include@ @am__quote@misc/$(DEPDIR)/subr.Po@am__quote@ 
    118 +@AMDEP_TRUE@@am__include@ @am__quote@misc/$(DEPDIR)/sha1.Po@am__quote@ 
    119   
    120  .c.o: 
    121  @am__fastdepCC_TRUE@   depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ 
    122 diff -urN btpd-0.15/misc/metainfo.c btpd-0.15-new/misc/metainfo.c 
    123 --- btpd-0.15/misc/metainfo.c   2009-01-12 17:43:18.000000000 -0500 
    124 +++ btpd-0.15-new/misc/metainfo.c       2009-06-19 15:02:20.000000000 -0400 
     108--- a/misc/metainfo.c 
     109+++ b/misc/metainfo.c 
    125110@@ -6,8 +6,7 @@ 
    126111 #include <string.h> 
     
    133118 #include "metainfo.h" 
    134119 #include "subr.h" 
    135 @@ -159,7 +158,7 @@ 
     120@@ -159,7 +158,7 @@ mi_info_hash(const char *p, uint8_t *has 
    136121     if (hash == NULL) 
    137122         if ((hash = malloc(20)) == NULL) 
     
    142127  
    143128 char * 
    144 diff -urN btpd-0.15/misc/sha1.c btpd-0.15-new/misc/sha1.c 
    145 --- btpd-0.15/misc/sha1.c       1969-12-31 19:00:00.000000000 -0500 
    146 +++ btpd-0.15-new/misc/sha1.c   2009-06-19 15:02:20.000000000 -0400 
    147 @@ -0,0 +1,423 @@ 
     129--- /dev/null 
     130+++ b/misc/sha1.c 
     131@@ -0,0 +1,428 @@ 
    148132+/* sha1.c - Functions to compute SHA1 message digest of files or 
    149133+   memory blocks according to the NIST specification FIPS-180-1. 
    150134+ 
    151 +   Copyright (C) 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. 
     135+   Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2008, 2009, 2010 Free 
     136+   Software Foundation, Inc. 
    152137+ 
    153138+   This program is free software; you can redistribute it and/or modify it 
     
    170155+*/ 
    171156+ 
    172 +#ifdef HAVE_CONFIG_H 
    173 +# include <config.h> 
    174 +#endif 
     157+#include <config.h> 
    175158+ 
    176159+#include "sha1.h" 
    177160+ 
    178161+#include <stddef.h> 
     162+#include <stdlib.h> 
    179163+#include <string.h> 
    180164+ 
     
    182166+# include "unlocked-io.h" 
    183167+#endif 
    184 + 
    185 +/* SWAP does an endian swap on architectures that are little-endian, 
    186 +   as SHA1 needs some data in a big-endian form.  */ 
    187168+ 
    188169+#ifdef WORDS_BIGENDIAN 
     
    193174+#endif 
    194175+ 
    195 +#define BLOCKSIZE 4096 
     176+#define BLOCKSIZE 32768 
    196177+#if BLOCKSIZE % 64 != 0 
    197178+# error "invalid BLOCKSIZE" 
     
    203184+ 
    204185+ 
    205 +/* 
    206 +  Takes a pointer to a 160 bit block of data (five 32 bit ints) and 
    207 +  intializes it to the start constants of the SHA1 algorithm.  This 
    208 +  must be called before using hash in the call to sha1_hash. 
    209 +*/ 
     186+/* Take a pointer to a 160 bit block of data (five 32 bit ints) and 
     187+   initialize it to the start constants of the SHA1 algorithm.  This 
     188+   must be called before using hash in the call to sha1_hash.  */ 
    210189+void 
    211190+sha1_init_ctx (struct sha1_ctx *ctx) 
     
    221200+} 
    222201+ 
     202+/* Copy the 4 byte value from v into the memory location pointed to by *cp, 
     203+   If your architecture allows unaligned access this is equivalent to 
     204+   * (uint32_t *) cp = v  */ 
     205+static inline void 
     206+set_uint32 (char *cp, uint32_t v) 
     207+{ 
     208+  memcpy (cp, &v, sizeof v); 
     209+} 
     210+ 
    223211+/* Put result from CTX in first 20 bytes following RESBUF.  The result 
    224 +   must be in little endian byte order. 
    225 + 
    226 +   IMPORTANT: On some systems it is required that RESBUF is correctly 
    227 +   aligned for a 32 bits value.  */ 
     212+   must be in little endian byte order.  */ 
    228213+void * 
    229214+sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf) 
    230215+{ 
    231 +  ((uint32_t *) resbuf)[0] = SWAP (ctx->A); 
    232 +  ((uint32_t *) resbuf)[1] = SWAP (ctx->B); 
    233 +  ((uint32_t *) resbuf)[2] = SWAP (ctx->C); 
    234 +  ((uint32_t *) resbuf)[3] = SWAP (ctx->D); 
    235 +  ((uint32_t *) resbuf)[4] = SWAP (ctx->E); 
     216+  char *r = resbuf; 
     217+  set_uint32 (r + 0 * sizeof ctx->A, SWAP (ctx->A)); 
     218+  set_uint32 (r + 1 * sizeof ctx->B, SWAP (ctx->B)); 
     219+  set_uint32 (r + 2 * sizeof ctx->C, SWAP (ctx->C)); 
     220+  set_uint32 (r + 3 * sizeof ctx->D, SWAP (ctx->D)); 
     221+  set_uint32 (r + 4 * sizeof ctx->E, SWAP (ctx->E)); 
    236222+ 
    237223+  return resbuf; 
     
    239225+ 
    240226+/* Process the remaining bytes in the internal buffer and the usual 
    241 +   prolog according to the standard and write the result to RESBUF. 
    242 + 
    243 +   IMPORTANT: On some systems it is required that RESBUF is correctly 
    244 +   aligned for a 32 bits value.  */ 
     227+   prolog according to the standard and write the result to RESBUF.  */ 
    245228+void * 
    246229+sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf) 
     
    248231+  /* Take yet unprocessed bytes into account.  */ 
    249232+  uint32_t bytes = ctx->buflen; 
    250 +  size_t pad; 
     233+  size_t size = (bytes < 56) ? 64 / 4 : 64 * 2 / 4; 
    251234+ 
    252235+  /* Now count remaining bytes.  */ 
     
    255238+    ++ctx->total[1]; 
    256239+ 
    257 +  pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; 
    258 +  memcpy (&ctx->buffer[bytes], fillbuf, pad); 
    259 + 
    260240+  /* Put the 64-bit file length in *bits* at the end of the buffer.  */ 
    261 +  *(uint32_t *) &ctx->buffer[bytes + pad + 4] = SWAP (ctx->total[0] << 3); 
    262 +  *(uint32_t *) &ctx->buffer[bytes + pad] = SWAP ((ctx->total[1] << 3) | 
    263 +                                                   (ctx->total[0] >> 29)); 
     241+  ctx->buffer[size - 2] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); 
     242+  ctx->buffer[size - 1] = SWAP (ctx->total[0] << 3); 
     243+ 
     244+  memcpy (&((char *) ctx->buffer)[bytes], fillbuf, (size - 2) * 4 - bytes); 
    264245+ 
    265246+  /* Process last bytes.  */ 
    266 +  sha1_process_block (ctx->buffer, bytes + pad + 8, ctx); 
     247+  sha1_process_block (ctx->buffer, size * 4, ctx); 
    267248+ 
    268249+  return sha1_read_ctx (ctx, resbuf); 
     
    276257+{ 
    277258+  struct sha1_ctx ctx; 
    278 +  char buffer[BLOCKSIZE + 72]; 
    279259+  size_t sum; 
     260+ 
     261+  char *buffer = malloc (BLOCKSIZE + 72); 
     262+  if (!buffer) 
     263+    return 1; 
    280264+ 
    281265+  /* Initialize the computation context.  */ 
     
    286270+    { 
    287271+      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the 
    288 +        computation function processes the whole buffer so that with the 
    289 +        next round of the loop another block can be read.  */ 
     272+        computation function processes the whole buffer so that with the 
     273+        next round of the loop another block can be read.  */ 
    290274+      size_t n; 
    291275+      sum = 0; 
     
    293277+      /* Read block.  Take care for partial reads.  */ 
    294278+      while (1) 
    295 +       { 
    296 +         n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); 
    297 + 
    298 +         sum += n; 
    299 + 
    300 +         if (sum == BLOCKSIZE) 
    301 +           break; 
    302 + 
    303 +         if (n == 0) 
    304 +           { 
    305 +             /* Check for the error flag IFF N == 0, so that we don't 
    306 +                exit the loop after a partial read due to e.g., EAGAIN 
    307 +                or EWOULDBLOCK.  */ 
    308 +             if (ferror (stream)) 
    309 +               return 1; 
    310 +             goto process_partial_block; 
    311 +           } 
    312 + 
    313 +         /* We've read at least one byte, so ignore errors.  But always 
    314 +            check for EOF, since feof may be true even though N > 0. 
    315 +            Otherwise, we could end up calling fread after EOF.  */ 
    316 +         if (feof (stream)) 
    317 +           goto process_partial_block; 
    318 +       } 
     279+        { 
     280+          n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); 
     281+ 
     282+          sum += n; 
     283+ 
     284+          if (sum == BLOCKSIZE) 
     285+            break; 
     286+ 
     287+          if (n == 0) 
     288+            { 
     289+              /* Check for the error flag IFF N == 0, so that we don't 
     290+                 exit the loop after a partial read due to e.g., EAGAIN 
     291+                 or EWOULDBLOCK.  */ 
     292+              if (ferror (stream)) 
     293+                { 
     294+                  free (buffer); 
     295+                  return 1; 
     296+                } 
     297+              goto process_partial_block; 
     298+            } 
     299+ 
     300+          /* We've read at least one byte, so ignore errors.  But always 
     301+             check for EOF, since feof may be true even though N > 0. 
     302+             Otherwise, we could end up calling fread after EOF.  */ 
     303+          if (feof (stream)) 
     304+            goto process_partial_block; 
     305+        } 
    319306+ 
    320307+      /* Process buffer with BLOCKSIZE bytes.  Note that 
    321 +                       BLOCKSIZE % 64 == 0 
     308+                        BLOCKSIZE % 64 == 0 
    322309+       */ 
    323310+      sha1_process_block (buffer, BLOCKSIZE, &ctx); 
     
    332319+  /* Construct result in desired memory.  */ 
    333320+  sha1_finish_ctx (&ctx, resblock); 
     321+  free (buffer); 
    334322+  return 0; 
    335323+} 
    336324+ 
    337 +/* Compute MD5 message digest for LEN bytes beginning at BUFFER.  The 
     325+/* Compute SHA1 message digest for LEN bytes beginning at BUFFER.  The 
    338326+   result is always in little endian byte order, so that a byte-wise 
    339327+   output yields to the wanted ASCII representation of the message 
     
    364352+      size_t add = 128 - left_over > len ? len : 128 - left_over; 
    365353+ 
    366 +      memcpy (&ctx->buffer[left_over], buffer, add); 
     354+      memcpy (&((char *) ctx->buffer)[left_over], buffer, add); 
    367355+      ctx->buflen += add; 
    368356+ 
    369357+      if (ctx->buflen > 64) 
    370 +       { 
    371 +         sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx); 
    372 + 
    373 +         ctx->buflen &= 63; 
    374 +         /* The regions in the following copy operation cannot overlap.  */ 
    375 +         memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], 
    376 +                 ctx->buflen); 
    377 +       } 
     358+        { 
     359+          sha1_process_block (ctx->buffer, ctx->buflen & ~63, ctx); 
     360+ 
     361+          ctx->buflen &= 63; 
     362+          /* The regions in the following copy operation cannot overlap.  */ 
     363+          memcpy (ctx->buffer, 
     364+                  &((char *) ctx->buffer)[(left_over + add) & ~63], 
     365+                  ctx->buflen); 
     366+        } 
    378367+ 
    379368+      buffer = (const char *) buffer + add; 
     
    388377+# define UNALIGNED_P(p) (((size_t) p) % alignof (uint32_t) != 0) 
    389378+      if (UNALIGNED_P (buffer)) 
    390 +       while (len > 64) 
    391 +         { 
    392 +           sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); 
    393 +           buffer = (const char *) buffer + 64; 
    394 +           len -= 64; 
    395 +         } 
     379+        while (len > 64) 
     380+          { 
     381+            sha1_process_block (memcpy (ctx->buffer, buffer, 64), 64, ctx); 
     382+            buffer = (const char *) buffer + 64; 
     383+            len -= 64; 
     384+          } 
    396385+      else 
    397386+#endif 
    398 +       { 
    399 +         sha1_process_block (buffer, len & ~63, ctx); 
    400 +         buffer = (const char *) buffer + (len & ~63); 
    401 +         len &= 63; 
    402 +       } 
     387+        { 
     388+          sha1_process_block (buffer, len & ~63, ctx); 
     389+          buffer = (const char *) buffer + (len & ~63); 
     390+          len &= 63; 
     391+        } 
    403392+    } 
    404393+ 
     
    408397+      size_t left_over = ctx->buflen; 
    409398+ 
    410 +      memcpy (&ctx->buffer[left_over], buffer, len); 
     399+      memcpy (&((char *) ctx->buffer)[left_over], buffer, len); 
    411400+      left_over += len; 
    412401+      if (left_over >= 64) 
    413 +       { 
    414 +         sha1_process_block (ctx->buffer, 64, ctx); 
    415 +         left_over -= 64; 
    416 +         memcpy (ctx->buffer, &ctx->buffer[64], left_over); 
    417 +       } 
     402+        { 
     403+          sha1_process_block (ctx->buffer, 64, ctx); 
     404+          left_over -= 64; 
     405+          memcpy (ctx->buffer, &ctx->buffer[16], left_over); 
     406+        } 
    418407+      ctx->buflen = left_over; 
    419408+    } 
     
    423412+ 
    424413+/* SHA1 round constants */ 
    425 +#define K1 0x5a827999L 
    426 +#define K2 0x6ed9eba1L 
    427 +#define K3 0x8f1bbcdcL 
    428 +#define K4 0xca62c1d6L 
     414+#define K1 0x5a827999 
     415+#define K2 0x6ed9eba1 
     416+#define K3 0x8f1bbcdc 
     417+#define K4 0xca62c1d6 
    429418+ 
    430419+/* Round functions.  Note that F2 is the same as F4.  */ 
     
    458447+    ++ctx->total[1]; 
    459448+ 
    460 +#define rol(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) 
     449+#define rol(x, n) (((x) << (n)) | ((uint32_t) (x) >> (32 - (n)))) 
    461450+ 
    462451+#define M(I) ( tm =   x[I&0x0f] ^ x[(I-14)&0x0f] \ 
    463 +                   ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \ 
    464 +              , (x[I&0x0f] = rol(tm, 1)) ) 
     452+                    ^ x[(I-8)&0x0f] ^ x[(I-3)&0x0f] \ 
     453+               , (x[I&0x0f] = rol(tm, 1)) ) 
    465454+ 
    466455+#define R(A,B,C,D,E,F,K,M)  do { E += rol( A, 5 )     \ 
    467 +                                     + F( B, C, D )  \ 
    468 +                                     + K             \ 
    469 +                                     + M;            \ 
    470 +                                B = rol( B, 30 );    \ 
    471 +                              } while(0) 
     456+                                      + F( B, C, D )  \ 
     457+                                      + K             \ 
     458+                                      + M;            \ 
     459+                                B = rol( B, 30 );    \ 
     460+                               } while(0) 
    472461+ 
    473462+  while (words < endp) 
     
    476465+      int t; 
    477466+      for (t = 0; t < 16; t++) 
    478 +       { 
    479 +         x[t] = SWAP (*words); 
    480 +         words++; 
    481 +       } 
     467+        { 
     468+          x[t] = SWAP (*words); 
     469+          words++; 
     470+        } 
    482471+ 
    483472+      R( a, b, c, d, e, F1, K1, x[ 0] ); 
     
    569558+    } 
    570559+} 
    571 diff -urN btpd-0.15/misc/sha1.h btpd-0.15-new/misc/sha1.h 
    572 --- btpd-0.15/misc/sha1.h       1969-12-31 19:00:00.000000000 -0500 
    573 +++ btpd-0.15-new/misc/sha1.h   2009-06-19 15:02:20.000000000 -0400 
    574 @@ -0,0 +1,90 @@ 
     560--- /dev/null 
     561+++ b/misc/sha1.h 
     562@@ -0,0 +1,92 @@ 
    575563+/* Declarations of functions and data types used for SHA1 sum 
    576564+   library functions. 
    577 +   Copyright (C) 2000, 2001, 2003, 2005 Free Software Foundation, Inc. 
     565+   Copyright (C) 2000, 2001, 2003, 2005, 2006, 2008, 2009, 2010 Free Software 
     566+   Foundation, Inc. 
    578567+ 
    579568+   This program is free software; you can redistribute it and/or modify it 
     
    594583+# define SHA1_H 1 
    595584+ 
    596 +#include <stdio.h> 
    597 + 
    598 +#include <inttypes.h> 
    599 + 
    600 +#define SHA_DIGEST_LENGTH 20 
     585+# include <stdio.h> 
     586+# include <stdint.h> 
     587+ 
     588+# ifdef __cplusplus 
     589+extern "C" { 
     590+# endif 
     591+ 
     592+#define SHA1_DIGEST_SIZE 20 
    601593+ 
    602594+/* Structure to save state of computation between the single steps.  */ 
     
    611603+  uint32_t total[2]; 
    612604+  uint32_t buflen; 
    613 char buffer[128]; 
     605uint32_t buffer[32]; 
    614606+}; 
    615607+ 
     
    623615+   It is necessary that LEN is a multiple of 64!!! */ 
    624616+extern void sha1_process_block (const void *buffer, size_t len, 
    625 +                               struct sha1_ctx *ctx); 
     617+                                struct sha1_ctx *ctx); 
    626618+ 
    627619+/* Starting with the result of former calls of this function (or the 
     
    630622+   It is NOT required that LEN is a multiple of 64.  */ 
    631623+extern void sha1_process_bytes (const void *buffer, size_t len, 
    632 +                               struct sha1_ctx *ctx); 
     624+                                struct sha1_ctx *ctx); 
    633625+ 
    634626+/* Process the remaining bytes in the buffer and put result from CTX 
    635627+   in first 20 bytes following RESBUF.  The result is always in little 
    636628+   endian byte order, so that a byte-wise output yields to the wanted 
    637 +   ASCII representation of the message digest. 
    638 + 
    639 +   IMPORTANT: On some systems it is required that RESBUF be correctly 
    640 +   aligned for a 32 bits value.  */ 
     629+   ASCII representation of the message digest.  */ 
    641630+extern void *sha1_finish_ctx (struct sha1_ctx *ctx, void *resbuf); 
    642631+ 
     
    644633+/* Put result from CTX in first 20 bytes following RESBUF.  The result is 
    645634+   always in little endian byte order, so that a byte-wise output yields 
    646 +   to the wanted ASCII representation of the message digest. 
    647 + 
    648 +   IMPORTANT: On some systems it is required that RESBUF is correctly 
    649 +   aligned for a 32 bits value.  */ 
     635+   to the wanted ASCII representation of the message digest.  */ 
    650636+extern void *sha1_read_ctx (const struct sha1_ctx *ctx, void *resbuf); 
    651637+ 
     
    662648+extern void *sha1_buffer (const char *buffer, size_t len, void *resblock); 
    663649+ 
     650+# ifdef __cplusplus 
     651+} 
     652+# endif 
     653+ 
    664654+#endif 
    665 diff -urN btpd-0.15/misc/stream.c btpd-0.15-new/misc/stream.c 
    666 --- btpd-0.15/misc/stream.c     2008-12-22 17:25:36.000000000 -0500 
    667 +++ btpd-0.15-new/misc/stream.c 2009-06-19 15:02:20.000000000 -0400 
     655--- a/misc/stream.c 
     656+++ b/misc/stream.c 
    668657@@ -5,7 +5,7 @@ 
    669658 #include <stdlib.h> 
     
    675664 #include "metainfo.h" 
    676665 #include "subr.h" 
    677 @@ -161,21 +161,21 @@ 
     666@@ -161,21 +161,21 @@ bts_put(struct bt_stream *bts, off_t off 
    678667 int 
    679668 bts_sha(struct bt_stream *bts, off_t start, off_t length, uint8_t *hash) 
     
    701690 } 
    702691  
    703 diff -urN btpd-0.15/.pc/.version btpd-0.15-new/.pc/.version 
    704 --- btpd-0.15/.pc/.version      1969-12-31 19:00:00.000000000 -0500 
    705 +++ btpd-0.15-new/.pc/.version  2009-06-19 15:00:46.000000000 -0400 
    706 @@ -0,0 +1 @@ 
    707 +2 
    708 diff -urN btpd-0.15/Makefile.am btpd-0.15.new/Makefile.am 
    709 --- btpd-0.15/Makefile.am       2009-02-03 12:09:25.000000000 +0100 
    710 +++ btpd-0.15.new/Makefile.am   2009-07-02 17:39:47.000000000 +0200 
     692--- a/Makefile.am 
     693+++ b/Makefile.am 
    711694@@ -1,6 +1,6 @@ 
    712695 AM_CFLAGS=-std=c99 -Wall @WARNNPS@ 
     
    718701 bin_PROGRAMS=btpd/btpd cli/btcli cli/btinfo 
    719702 noinst_LIBRARIES=misc/libmisc.a evloop/libevloop.a 
    720 @@ -44,7 +44,8 @@ 
     703@@ -25,15 +25,15 @@ btpd_btpd_SOURCES=\ 
     704        btpd/upload.c btpd/upload.h\ 
     705        btpd/util.c 
     706 btpd_btpd_CFLAGS=@TD_CFLAGS@ $(AM_CFLAGS) 
     707-btpd_btpd_LDADD=@TD_LIBS@ misc/libmisc.a evloop/libevloop.a -lcrypto -lm @CLOCKLIB@ @INETLIBS@ 
     708+btpd_btpd_LDADD=@TD_LIBS@ misc/libmisc.a evloop/libevloop.a -lm @CLOCKLIB@ @INETLIBS@ 
     709  
     710 # btinfo 
     711 cli_btinfo_SOURCES=cli/btinfo.c 
     712-cli_btinfo_LDADD=misc/libmisc.a -lcrypto -lm 
     713+cli_btinfo_LDADD=misc/libmisc.a -lm 
     714  
     715 # btcli 
     716 cli_btcli_SOURCES=cli/btcli.c cli/btcli.h cli/add.c cli/del.c cli/list.c cli/kill.c cli/start.c cli/stop.c cli/stat.c 
     717-cli_btcli_LDADD=misc/libmisc.a -lcrypto -lm @INETLIBS@ 
     718+cli_btcli_LDADD=misc/libmisc.a -lm @INETLIBS@ 
     719  
     720 # libmisc 
     721 misc_libmisc_a_SOURCES=\ 
     722@@ -45,7 +45,8 @@ misc_libmisc_a_SOURCES=\ 
    721723        misc/iobuf.c misc/iobuf.h\ 
    722724        misc/queue.h\ 
  • packages/net/btpd/patches/001-gettime.patch

    r16657 r24776  
    1 diff -urN btpd-0.15/evloop/timer.c btpd-0.15-hack/evloop/timer.c 
    2 --- btpd-0.15/evloop/timer.c    2009-02-09 14:12:28.000000000 -0500 
    3 +++ btpd-0.15-hack/evloop/timer.c       2009-06-19 21:41:02.000000000 -0400 
     1--- a/evloop/timer.c 
     2+++ b/evloop/timer.c 
    43@@ -14,7 +14,7 @@ 
    54 int 
  • packages/net/btpd/patches/100-clock.diff

    r10354 r24776  
    1 --- btpd-0.13/config.cache  2007-10-13 17:10:21.000000000 +0400 
    2 +++ btpd-0.13/config.cache  2008-01-12 01:58:20.000000000 +0300 
     1--- /dev/null 
     2+++ b/config.cache 
    33@@ -0,0 +1 @@ 
    44+ac_cv_func_clock_gettime=no 
Note: See TracChangeset for help on using the changeset viewer.