pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/security/nacl Borrow build and runtime fixes from Debi...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/9d8b680acc64
branches:  trunk
changeset: 371135:9d8b680acc64
user:      schmonz <schmonz%pkgsrc.org@localhost>
date:      Wed Jan 05 13:51:19 2022 +0000

description:
Borrow build and runtime fixes from Debian. Fixes aarch64 build on
macOS, and perhaps others. Bump PKGREVISION.

diffstat:

 security/nacl/Makefile                                  |   4 +-
 security/nacl/distinfo                                  |  11 ++-
 security/nacl/patches/patch-cpucycles_do                |  15 +++
 security/nacl/patches/patch-cpucycles_fakenanoseconds.c |  31 +++++++
 security/nacl/patches/patch-cpucycles_fakenanoseconds.h |  29 +++++++
 security/nacl/patches/patch-cpucycles_mips.c            |  16 ++++
 security/nacl/patches/patch-curvecp_curvecpclient.c     |  15 +++
 security/nacl/patches/patch-curvecp_curvecpmessage.c    |  68 +++++++++++++++++
 security/nacl/patches/patch-curvecp_curvecpserver.c     |  27 ++++++
 security/nacl/patches/patch-curvecp_portparse.c         |  15 +++
 security/nacl/patches/patch-curvecp_socket__bind.c      |  15 +++
 11 files changed, 243 insertions(+), 3 deletions(-)

diffs (truncated from 302 to 300 lines):

diff -r c2e849106621 -r 9d8b680acc64 security/nacl/Makefile
--- a/security/nacl/Makefile    Wed Jan 05 10:56:44 2022 +0000
+++ b/security/nacl/Makefile    Wed Jan 05 13:51:19 2022 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.5 2022/01/04 20:53:20 schmonz Exp $
+# $NetBSD: Makefile,v 1.6 2022/01/05 13:51:19 schmonz Exp $
 
 DISTNAME=      nacl-20110221
-PKGREVISION=   2
+PKGREVISION=   3
 CATEGORIES=    security
 MASTER_SITES=  https://hyperelliptic.org/nacl/
 EXTRACT_SUFX=  .tar.bz2
diff -r c2e849106621 -r 9d8b680acc64 security/nacl/distinfo
--- a/security/nacl/distinfo    Wed Jan 05 10:56:44 2022 +0000
+++ b/security/nacl/distinfo    Wed Jan 05 13:51:19 2022 +0000
@@ -1,8 +1,17 @@
-$NetBSD: distinfo,v 1.6 2022/01/04 20:53:20 schmonz Exp $
+$NetBSD: distinfo,v 1.7 2022/01/05 13:51:19 schmonz Exp $
 
 BLAKE2s (nacl-20110221.tar.bz2) = d8fccb5036297da7fe4f4d357cd326f10094ba709b9422ccd1571b13e3981f4d
 SHA512 (nacl-20110221.tar.bz2) = 4c031ceffe6a28dc74b46ac003d485531f78de467c802df73c8b22ca53644dabb7d2e3080b7bdd6583f0d07ad76b6d95bc0ffdce319ca2f80ee041e6fe618656
 Size (nacl-20110221.tar.bz2) = 163415 bytes
+SHA1 (patch-cpucycles_do) = bc7bbb1a325d93a1ff73c5a87724ee39e74e4990
+SHA1 (patch-cpucycles_fakenanoseconds.c) = c45b8b83118c18f46a029bbe5202f6490a97fcdb
+SHA1 (patch-cpucycles_fakenanoseconds.h) = 0bd6b38cf0c601e26620a22e3d8ff7ef75d7bf27
+SHA1 (patch-cpucycles_mips.c) = a3e4a053927ecd366857a34010e179c664d9cc34
+SHA1 (patch-curvecp_curvecpclient.c) = c92670580856e8f5d8770af21765fc6b3ec5f3b3
+SHA1 (patch-curvecp_curvecpmessage.c) = 9fa2b9f9545156144c2c1027de64479110eabf92
+SHA1 (patch-curvecp_curvecpserver.c) = f38ef751e25f8ec0c309a42cb10dfd74c5e4c7df
+SHA1 (patch-curvecp_portparse.c) = 50474e955243969acc655af42709692a50dfcfd0
+SHA1 (patch-curvecp_socket__bind.c) = 28cb78a6439de767e6a5dcf59a3bb382debbb9b2
 SHA1 (patch-curvecp_socket__udp.c) = 77e98768d015cb16af1ffa8b57464a12620d8110
 SHA1 (patch-do) = 590961a4b2daf5693a477b06d35c8ea92f8e3173
 SHA1 (patch-okcompilers_c) = bdbc229671428738e0115551ef1c123f3224d3cf
diff -r c2e849106621 -r 9d8b680acc64 security/nacl/patches/patch-cpucycles_do
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/nacl/patches/patch-cpucycles_do  Wed Jan 05 13:51:19 2022 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-cpucycles_do,v 1.1 2022/01/05 13:51:19 schmonz Exp $
+
+Part of Debian 0008-add-cpucycles-fakenanoseconds.patch:
+Provide a fakenanoseconds implementation for portability.
+
+--- cpucycles/do.orig  2011-02-21 01:49:34.000000000 +0000
++++ cpucycles/do
+@@ -70,6 +70,7 @@ okabi | (
+       echo monotoniccpuinfo
+       echo monotonic
+       echo gettimeofday
++      echo fakenanoseconds
+     ) | (
+       while read n
+       do
diff -r c2e849106621 -r 9d8b680acc64 security/nacl/patches/patch-cpucycles_fakenanoseconds.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/nacl/patches/patch-cpucycles_fakenanoseconds.c   Wed Jan 05 13:51:19 2022 +0000
@@ -0,0 +1,31 @@
+$NetBSD: patch-cpucycles_fakenanoseconds.c,v 1.1 2022/01/05 13:51:19 schmonz Exp $
+
+Part of Debian 0008-add-cpucycles-fakenanoseconds.patch:
+Provide a fakenanoseconds implementation for portability.
+
+--- cpucycles/fakenanoseconds.c.orig   2022-01-05 13:32:14.000000000 +0000
++++ cpucycles/fakenanoseconds.c
+@@ -0,0 +1,23 @@
++#include <time.h>
++
++/* XXX Measured numbers are not CPU cycles but nanoseconds !!! */
++
++static long long faketime = 0;
++
++long long cpucycles_fakenanoseconds(void) {
++
++    struct timespec t;
++    long long tm;
++
++    if (clock_gettime(CLOCK_MONOTONIC,&t) != 0) return -1;
++
++    tm = t.tv_sec * 1000000000LL + t.tv_nsec;
++    if (tm > faketime) faketime = tm;
++    ++faketime;
++
++    return faketime;
++}
++
++long long cpucycles_fakenanoseconds_persecond(void) {
++    return 1000000000LL;
++}
diff -r c2e849106621 -r 9d8b680acc64 security/nacl/patches/patch-cpucycles_fakenanoseconds.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/nacl/patches/patch-cpucycles_fakenanoseconds.h   Wed Jan 05 13:51:19 2022 +0000
@@ -0,0 +1,29 @@
+$NetBSD: patch-cpucycles_fakenanoseconds.h,v 1.1 2022/01/05 13:51:19 schmonz Exp $
+
+Part of Debian 0008-add-cpucycles-fakenanoseconds.patch:
+Provide a fakenanoseconds implementation for portability.
+
+--- cpucycles/fakenanoseconds.h.orig   2022-01-05 13:32:14.000000000 +0000
++++ cpucycles/fakenanoseconds.h
+@@ -0,0 +1,21 @@
++#ifndef CPUCYCLES_fakenanoseconds_h
++#define CPUCYCLES_fakenanoseconds_h
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++extern long long cpucycles_fakenanoseconds(void);
++extern long long cpucycles_fakenanoseconds_persecond(void);
++
++#ifdef __cplusplus
++}
++#endif
++
++#ifndef cpucycles_implementation
++#define cpucycles_implementation "fakenanoseconds"
++#define cpucycles cpucycles_fakenanoseconds
++#define cpucycles_persecond cpucycles_fakenanoseconds_persecond
++#endif
++
++#endif
diff -r c2e849106621 -r 9d8b680acc64 security/nacl/patches/patch-cpucycles_mips.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/nacl/patches/patch-cpucycles_mips.c      Wed Jan 05 13:51:19 2022 +0000
@@ -0,0 +1,16 @@
+$NetBSD: patch-cpucycles_mips.c,v 1.1 2022/01/05 13:51:19 schmonz Exp $
+
+Debian patch 0005-fix-cpucycles-mips.patch:
+MIPS portability.
+
+--- cpucycles/mips.c.orig      2011-02-21 01:49:34.000000000 +0000
++++ cpucycles/mips.c
+@@ -18,7 +18,7 @@ static void readticks(unsigned int *resu
+ {
+   struct timeval t;
+   unsigned int cc;
+-  asm volatile(".byte 59; .byte 16; .byte 2; .byte 124; move %0,$2" : "=r"(cc) : : "$2");
++  asm volatile(".long 2080510011; move %0,$2" : "=r"(cc) : : "$2");
+   gettimeofday(&t,(struct timezone *) 0);
+   result[0] = cc;
+   result[1] = t.tv_usec;
diff -r c2e849106621 -r 9d8b680acc64 security/nacl/patches/patch-curvecp_curvecpclient.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/nacl/patches/patch-curvecp_curvecpclient.c       Wed Jan 05 13:51:19 2022 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-curvecp_curvecpclient.c,v 1.1 2022/01/05 13:51:19 schmonz Exp $
+
+Part of Debian 0004-fix-segfault.patch:
+Fix segfault.
+
+--- curvecp/curvecpclient.c.orig       2011-02-21 01:49:34.000000000 +0000
++++ curvecp/curvecpclient.c
+@@ -96,6 +96,7 @@ int multiipparse(unsigned char *y,const 
+   long long j;
+   long long k;
+   long long d;
++  if (!x) return 0;
+   for (j = 0;j < 4 * NUMIP;++j) y[j] = 0;
+   ynum = 0;
+   while (ynum < 1000) {
diff -r c2e849106621 -r 9d8b680acc64 security/nacl/patches/patch-curvecp_curvecpmessage.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/nacl/patches/patch-curvecp_curvecpmessage.c      Wed Jan 05 13:51:19 2022 +0000
@@ -0,0 +1,68 @@
+$NetBSD: patch-curvecp_curvecpmessage.c,v 1.1 2022/01/05 13:51:19 schmonz Exp $
+
+Debian patch 0007-fix-collecting-zombies.patch:
+Fix collecting zombies.
+
+--- curvecp/curvecpmessage.c.orig      2011-02-21 01:49:34.000000000 +0000
++++ curvecp/curvecpmessage.c
+@@ -135,6 +135,9 @@ long long rtt_phase = 0;
+ 
+ long long lastpanic = 0;
+ 
++int childdied = 0;
++int pollret;
++
+ void earliestblocktime_compute(void) /* XXX: use priority queue */
+ {
+   long long i;
+@@ -304,7 +307,10 @@ int main(int argc,char **argv)
+     else
+       timeout = (nextaction - recent) / 1000000 + 1;
+ 
+-    if (poll(p,q - p,timeout) < 0) {
++    /* XXX */
++    if (childdied) timeout = 10;
++    pollret = poll(p,q - p,timeout);
++    if (pollret < 0) {
+       watch8 = 0;
+       watchtochild = 0;
+       watchfromchild = 0;
+@@ -314,6 +320,11 @@ int main(int argc,char **argv)
+       if (watchfromchild) if (!watchfromchild->revents) watchfromchild = 0;
+     }
+ 
++    /* XXX */
++    if (childdied && !pollret) {
++      if (childdied++ > 999) goto finish;
++    }
++
+     /* XXX: keepalives */
+ 
+     do { /* try receiving data from child: */
+@@ -642,12 +653,23 @@ int main(int argc,char **argv)
+       tochild[1] = -1;
+     } while(0);
+ 
++    /* XXX */
++    if (!childdied){
++      if (waitpid(child,&childstatus, WNOHANG) > 0) {
++        close(tochild[1]);
++        tochild[1] = -1;
++        childdied = 1;
++      }
++    }
+   }
+ 
++  if (!childdied) {
++    do {
++      r = waitpid(child,&childstatus,0);
++    } while (r == -1 && errno == EINTR);
++  }
+ 
+-  do {
+-    r = waitpid(child,&childstatus,0);
+-  } while (r == -1 && errno == EINTR);
++finish:
+ 
+   if (!WIFEXITED(childstatus)) { errno = 0; die_fatal("process killed by signal",0,0); }
+   return WEXITSTATUS(childstatus);
diff -r c2e849106621 -r 9d8b680acc64 security/nacl/patches/patch-curvecp_curvecpserver.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/nacl/patches/patch-curvecp_curvecpserver.c       Wed Jan 05 13:51:19 2022 +0000
@@ -0,0 +1,27 @@
+$NetBSD: patch-curvecp_curvecpserver.c,v 1.1 2022/01/05 13:51:19 schmonz Exp $
+
+Part of Debian 0004-fix-segfault.patch:
+Fix segfault.
+
+Also part of Debian 0009-return-correct-client-extension.patch:
+Return correct client extension.
+
+--- curvecp/curvecpserver.c.orig       2011-02-21 01:49:34.000000000 +0000
++++ curvecp/curvecpserver.c
+@@ -90,6 +90,7 @@ int ipparse(unsigned char *y,const char 
+   long long k;
+   long long d;
+ 
++  if (!x) return 0;
+   for (k = 0;k < 4;++k) y[k] = 0;
+   for (k = 0;k < 4;++k) {
+     d = 0;
+@@ -473,7 +474,7 @@ int main(int argc,char **argv)
+           byte_copy(text + 32,r,activeclients[i].message + 1);
+           crypto_box_afternm(text,text,r + 32,nonce,activeclients[i].clientshortservershort);
+           byte_copy(packet,8,"RL3aNMXM");
+-          byte_copy(packet + 8,16,clientextension);
++          byte_copy(packet + 8,16,activeclients[i].clientextension);
+           byte_copy(packet + 24,16,serverextension);
+           byte_copy(packet + 40,8,nonce + 16);
+           byte_copy(packet + 48,r + 16,text + 16);
diff -r c2e849106621 -r 9d8b680acc64 security/nacl/patches/patch-curvecp_portparse.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/nacl/patches/patch-curvecp_portparse.c   Wed Jan 05 13:51:19 2022 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-curvecp_portparse.c,v 1.1 2022/01/05 13:51:19 schmonz Exp $
+
+Part of Debian 0004-fix-segfault.patch:
+Fix segfault.
+
+--- curvecp/portparse.c.orig   2011-02-21 01:49:34.000000000 +0000
++++ curvecp/portparse.c
+@@ -4,6 +4,7 @@ int portparse(unsigned char *y,const cha
+ {
+   long long d = 0;
+   long long j;
++  if (!x) return 0;
+   for (j = 0;j < 5 && x[j] >= '0' && x[j] <= '9';++j)
+     d = d * 10 + (x[j] - '0');
+   if (j == 0) return 0;
diff -r c2e849106621 -r 9d8b680acc64 security/nacl/patches/patch-curvecp_socket__bind.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/nacl/patches/patch-curvecp_socket__bind.c        Wed Jan 05 13:51:19 2022 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-curvecp_socket__bind.c,v 1.1 2022/01/05 13:51:19 schmonz Exp $
+
+Debian patch 0003-fix-socket_bind.patch:
+Fix socket_bind.
+
+--- curvecp/socket_bind.c.orig 2011-02-21 01:49:34.000000000 +0000
++++ curvecp/socket_bind.c
+@@ -9,6 +9,7 @@ int socket_bind(int fd,const unsigned ch
+ {
+   struct sockaddr_in sa;
+   byte_zero(&sa,sizeof sa);
++  sa.sin_family = PF_INET;
+   byte_copy(&sa.sin_addr,4,ip);



Home | Main Index | Thread Index | Old Index