Hi ports,  

net/p5-Net-SSH-Perl can't be built currently on sparc64. It uses
OpenSSH's code to implement the chacha20-poly1305 algorithm, with a
slight difference, apparently to silence a warning. I also learnt thanks
to danj@ and landry@ that it was already found out.

The patch i propose here builds and works on sparc64 and amd64, and
simply reverts poly1305.c as it is in OpenSSH, but there are 2
concerns: 

1) Security implications, as the context is different than OpenSSH
itself.

2) It "reintroduces" the warning, and it appears it's overriding
Perl's own definition of the U8TO32_LE macro: 

src/chacha/poly1305.c:14:1: warning: "U8TO32_LE" redefined
In file included from /usr/libdata/perl5/sparc64-openbsd/CORE/hv.h:631,
                 from /usr/libdata/perl5/sparc64-openbsd/CORE/perl.h:
3912, from Perl.xs:3:
/usr/libdata/perl5/sparc64-openbsd/CORE/hv_func.h:128:1: warning: this
is the location of the previous definition

I've met no issues with the sole consumer, Net::SFTP. Math::Prime::Util
is the only module i've found out that uses the same macro with the
additional ifndef, but we don't ship it, so i wasn't able to find a
precedent.

Comments are welcome! 

Charlène. 


Index: Makefile
===================================================================
RCS file: /cvs/ports/net/p5-Net-SSH-Perl/Makefile,v
retrieving revision 1.21
diff -u -p -u -p -r1.21 Makefile
--- Makefile    10 Sep 2018 18:37:09 -0000      1.21
+++ Makefile    25 Oct 2018 19:41:00 -0000
@@ -4,6 +4,7 @@ COMMENT =       perl implementation of the SSH
 
 MODULES =      cpan
 DISTNAME =     Net-SSH-Perl-2.14
+REVISION =     0
 CATEGORIES =   net security
 
 # perl
Index: patches/patch-src_chacha_poly1305_c
===================================================================
RCS file: patches/patch-src_chacha_poly1305_c
diff -N patches/patch-src_chacha_poly1305_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_chacha_poly1305_c 25 Oct 2018 19:41:00
-0000 @@ -0,0 +1,20 @@
+$OpenBSD$
+Sync with vanilla OpenSSH code (/usr/src/usr.bin/ssh/poly1305.c)
+Fix broken sparc64 build
+Index: src/chacha/poly1305.c
+--- src/chacha/poly1305.c.orig
++++ src/chacha/poly1305.c
+@@ -11,13 +11,11 @@
+ 
+ #define mul32x32_64(a,b) ((uint64_t)(a) * (b))
+ 
+-#ifndef U8TO32_LE
+ #define U8TO32_LE(p) \
+       (((uint32_t)((p)[0])) | \
+        ((uint32_t)((p)[1]) <<  8) | \
+        ((uint32_t)((p)[2]) << 16) | \
+        ((uint32_t)((p)[3]) << 24))
+-#endif
+ 
+ #define U32TO8_LE(p, v) \
+       do { \

Reply via email to