On Thu, Sep 02, 2021 at 06:28:52PM -0400, Brad Smith wrote:
> On Fri, Aug 27, 2021 at 01:10:52AM -0400, Brad Smith wrote:
> > On 8/20/2021 11:12 PM, Brad Smith wrote:
> > > Here is an update to Aircrack-ng 1.6.
> > > 
> > > Other than building the package that is all I have tested on amd64
> > > and i386.
> > > 
> > > Any users familiar with Aircrack-ng able to test this out?
> 
> Make use of GNU libtool. As Stuart pointed out the regress tests
> pass in full with this. Without, 21 out of 38 fail.

An updated diff.

Pull out the arm bits as it doesn't build anyway.

I was looking through aircrack-ng code and noticed a function
using hw.ncpu to retrieve the number of CPUs so I added
hw.ncpuonline support as well as hw.physmem64 support for
another function.


Index: Makefile
===================================================================
RCS file: /cvs/ports/security/aircrack-ng/Makefile,v
retrieving revision 1.33
diff -u -p -u -p -r1.33 Makefile
--- Makefile    27 Dec 2020 18:13:18 -0000      1.33
+++ Makefile    23 Oct 2021 07:03:13 -0000
@@ -1,8 +1,8 @@
 # $OpenBSD: Makefile,v 1.33 2020/12/27 18:13:18 sthen Exp $
 
 COMMENT=               802.11 WEP and WPA-PSK keys cracking program
-DISTNAME=              aircrack-ng-1.5.2
-REVISION=              6
+
+DISTNAME=              aircrack-ng-1.6
 CATEGORIES=            security
 
 HOMEPAGE=              https://www.aircrack-ng.org/
@@ -10,8 +10,7 @@ HOMEPAGE=             https://www.aircrack-ng.org/
 # GPLv2
 PERMIT_PACKAGE=        Yes
 
-WANTLIB+=              c pthread crypto z pcre
-WANTLIB+=              ${COMPILER_LIBCXX} m sqlite3
+WANTLIB+=              ${COMPILER_LIBCXX} c crypto m pcre pthread sqlite3 ssl z
 
 MASTER_SITES=          https://download.aircrack-ng.org/
 
@@ -22,11 +21,8 @@ LIB_DEPENDS=         databases/sqlite3 \
 
 RUN_DEPENDS+=          net/arp-scan,-mac>=20190128
 
+USE_LIBTOOL=           gnu
 USE_GMAKE=             Yes
-.if ${MACHINE_ARCH} == "i386"
-# ld: error: undefined symbol: __i686.get_pc_thunk.bx
-USE_LLD=               No
-.endif
 LIBTOOL_FLAGS=         --tag=disable-static
 AUTOCONF_VERSION=      2.69
 AUTOMAKE_VERSION=      1.16
@@ -44,20 +40,14 @@ PKG_ARGS+=              -Dx86=1
 .else
 PKG_ARGS+=              -Dx86=0
 .endif
-# XXX PFRAG.arm files relate to NEON optimizations, disabled above.
-#.if ${MACHINE_ARCH} == "arm" || ${MACHINE_ARCH} == "aarch64"
-#PKG_ARGS+=              -Darm=1
-#.else
-PKG_ARGS+=              -Darm=0
-#.endif
+
 # XXX AltiVec optimizations can't be built with clang, and POWER8 ones
 # are useless on powerpc
 .if ${MACHINE_ARCH} == "powerpc"
 MAKE_ENV+=              ALTIVEC=false POWER8=false
 .endif
 
-
 pre-configure:
-       ${SUBST_CMD} ${WRKSRC}/src/airodump-ng.h
+       ${SUBST_CMD} ${WRKSRC}/src/airodump-ng/airodump-ng.c
 
 .include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/security/aircrack-ng/distinfo,v
retrieving revision 1.4
diff -u -p -u -p -r1.4 distinfo
--- distinfo    23 Feb 2019 22:23:25 -0000      1.4
+++ distinfo    23 Oct 2021 07:03:13 -0000
@@ -1,2 +1,2 @@
-SHA256 (aircrack-ng-1.5.2.tar.gz) = 
nlkv52WARiIOCsCm0FxAJpA/MHeySIk+AFbMvk7ogkE=
-SIZE (aircrack-ng-1.5.2.tar.gz) = 7138360
+SHA256 (aircrack-ng-1.6.tar.gz) = Twv9SG78bqcin3+8VDQP+LIJSg1z6fYX4KOfh4mZokc=
+SIZE (aircrack-ng-1.6.tar.gz) = 7933308
Index: patches/patch-build_m4_aircrack_ng_simd_m4
===================================================================
RCS file: patches/patch-build_m4_aircrack_ng_simd_m4
diff -N patches/patch-build_m4_aircrack_ng_simd_m4
--- patches/patch-build_m4_aircrack_ng_simd_m4  13 Jun 2020 17:38:49 -0000      
1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,25 +0,0 @@
-$OpenBSD: patch-build_m4_aircrack_ng_simd_m4,v 1.1 2020/06/13 17:38:49 cwen 
Exp $
-
-Ensure that disabling AltiVec and POWER8 instructions with MAKE_ENV is honoured
-even if the build machine supports them, from:
-https://github.com/aircrack-ng/aircrack-ng/issues/1941
-
-Index: build/m4/aircrack_ng_simd.m4
---- build/m4/aircrack_ng_simd.m4.orig
-+++ build/m4/aircrack_ng_simd.m4
-@@ -132,7 +132,6 @@ then
-     AX_CHECK_COMPILE_FLAG([-maltivec], [
-         AX_APPEND_FLAG(-maltivec, [ppc_altivec_[]_AC_LANG_ABBREV[]flags])
-         AC_SUBST(ppc_altivec_[]_AC_LANG_ABBREV[]flags)
--        ALTIVEC_FOUND=1
-     ])
- 
-     AX_CHECK_COMPILE_FLAG([-mabi=altivec], [
-@@ -148,7 +147,6 @@ then
-     AX_CHECK_COMPILE_FLAG([-mpower8-vector], [
-         AX_APPEND_FLAG(-mpower8-vector, 
[ppc_altivec_[]_AC_LANG_ABBREV[]flags])
-         AC_SUBST(ppc_altivec_[]_AC_LANG_ABBREV[]flags)
--        POWER8_FOUND=1
-     ])
- fi
- 
Index: patches/patch-include_aircrack-ng_crypto_sha1-sse2_h
===================================================================
RCS file: patches/patch-include_aircrack-ng_crypto_sha1-sse2_h
diff -N patches/patch-include_aircrack-ng_crypto_sha1-sse2_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-include_aircrack-ng_crypto_sha1-sse2_h        23 Oct 2021 
07:03:13 -0000
@@ -0,0 +1,365 @@
+$OpenBSD$
+
+chore: remove unused assembly routines
+
+Index: include/aircrack-ng/crypto/sha1-sse2.h
+--- include/aircrack-ng/crypto/sha1-sse2.h.orig
++++ include/aircrack-ng/crypto/sha1-sse2.h
+@@ -36,357 +36,3 @@
+ #include <time.h>
+ 
+ #include <aircrack-ng/crypto/crypto.h>
+-
+-#if defined(__i386__) || ((defined(__x86_64__) && !defined(__CYGWIN__))       
 \
+-                                                || (defined(__x86_64__) && 
defined(__CYGWIN__)       \
+-                                                        && 
!defined(__clang__)))
+-
+-#ifdef OLD_SSE_CORE
+-void show_result(char * key, unsigned char * pmk)
+-{
+-      int i;
+-      printf("%-14s ", key);
+-      for (i = 0; i < 32; i++) printf("%.2X", pmk[i]);
+-      printf("\n");
+-}
+-
+-#endif
+-extern int shasse2_init(unsigned char ctx[80]) __attribute__((regparm(1)));
+-
+-extern int shasse2_ends(unsigned char ctx[80], unsigned char digests[80])
+-      __attribute__((regparm(2)));
+-
+-extern int shasse2_data(unsigned char ctx[80],
+-                                              unsigned char data[256],
+-                                              unsigned char buf[1280]) 
__attribute__((regparm(3)));
+-
+-extern int shasse2_cpuid(void);
+-
+-#ifdef OLD_SSE_CORE
+-void calc_4pmk(char * _key1,
+-                         char * _key2,
+-                         char * _key3,
+-                         char * _key4,
+-                         char * _essid,
+-                         unsigned char * _pmk1,
+-                         unsigned char * _pmk2,
+-                         unsigned char * _pmk3,
+-                         unsigned char * _pmk4)
+-{
+-      int slen;
+-      char essid[36] __attribute__((aligned(16)));
+-      char key1[128] __attribute__((aligned(16)));
+-      char key2[128] __attribute__((aligned(16)));
+-      char key3[128] __attribute__((aligned(16)));
+-      char key4[128] __attribute__((aligned(16)));
+-      unsigned char pmks[128 * 4] __attribute__((aligned(16)));
+-
+-      // All in double size
+-      unsigned char k_ipad[256] __attribute__((aligned(16)));
+-      unsigned char ctx_ipad[80] __attribute__((aligned(16)));
+-      unsigned char k_opad[256] __attribute__((aligned(16)));
+-      unsigned char ctx_opad[80] __attribute__((aligned(16)));
+-      unsigned char buffer[256] __attribute__((aligned(16)));
+-      unsigned char sha1_ctx[80] __attribute__((aligned(16)));
+-      unsigned char wrkbuf[1280] __attribute__((aligned(16)));
+-      unsigned i, *u, *v, *w, *u3, *v4;
+-      unsigned char *pmk1, *pmk2, *pmk3, *pmk4;
+-
+-      pmk1 = pmks;
+-      pmk2 = pmks + 128;
+-      pmk3 = pmks + 128 * 2;
+-      pmk4 = pmks + 128 * 3;
+-
+-      memset(key1, 0, sizeof(key1));
+-      memset(key2, 0, sizeof(key2));
+-      memset(key3, 0, sizeof(key3));
+-      memset(key4, 0, sizeof(key4));
+-      memset(essid, 0, sizeof(essid));
+-      memset(pmks, 0, sizeof(pmks));
+-      memset(buffer, 0, sizeof(buffer));
+-      memset(wrkbuf, 0, sizeof(wrkbuf));
+-
+-      memccpy(essid, _essid, 0, sizeof(essid));
+-      memccpy(key1, _key1, 0, sizeof(key1));
+-      memccpy(key2, _key2, 0, sizeof(key2));
+-      memccpy(key3, _key3, 0, sizeof(key3));
+-      memccpy(key4, _key4, 0, sizeof(key4));
+-
+-      slen = strlen(essid) + 4;
+-
+-      /* SSE2 available, so compute four PMKs in a single row */
+-
+-      memset(k_ipad, 0, sizeof(k_ipad));
+-      memset(k_opad, 0, sizeof(k_opad));
+-
+-      memcpy(k_ipad, key1, strlen(key1));
+-      memcpy(k_opad, key1, strlen(key1));
+-
+-      memcpy(k_ipad + 64, key2, strlen(key2));
+-      memcpy(k_opad + 64, key2, strlen(key2));
+-
+-      memcpy(k_ipad + 128, key3, strlen(key3));
+-      memcpy(k_opad + 128, key3, strlen(key3));
+-
+-      memcpy(k_ipad + 192, key4, strlen(key4));
+-      memcpy(k_opad + 192, key4, strlen(key4));
+-
+-      u = (unsigned *) (k_ipad);
+-      v = (unsigned *) (k_ipad + 64);
+-      u3 = (unsigned *) (k_ipad + 128);
+-      v4 = (unsigned *) (k_ipad + 192);
+-      w = (unsigned *) buffer;
+-
+-      for (i = 0; i < 16; i++)
+-      {
+-              /* interleave the data */
+-
+-              *w++ = *u++ ^ 0x36363636;
+-              *w++ = *v++ ^ 0x36363636;
+-              *w++ = *u3++ ^ 0x36363636;
+-              *w++ = *v4++ ^ 0x36363636;
+-      }
+-
+-      shasse2_init(ctx_ipad);
+-      shasse2_data(ctx_ipad, buffer, wrkbuf);
+-
+-      u = (unsigned *) (k_opad);
+-      v = (unsigned *) (k_opad + 64);
+-      u3 = (unsigned *) (k_opad + 128);
+-      v4 = (unsigned *) (k_opad + 192);
+-      w = (unsigned *) buffer;
+-
+-      for (i = 0; i < 16; i++)
+-      {
+-              *w++ = *u++ ^ 0x5C5C5C5C;
+-              *w++ = *v++ ^ 0x5C5C5C5C;
+-              *w++ = *u3++ ^ 0x5C5C5C5C;
+-              *w++ = *v4++ ^ 0x5C5C5C5C;
+-      }
+-
+-      shasse2_init(ctx_opad);
+-      shasse2_data(ctx_opad, buffer, wrkbuf);
+-
+-      memset(buffer, 0, sizeof(buffer));
+-
+-      buffer[80] = buffer[84] = buffer[88] = buffer[92] = 0x80;
+-      buffer[242] = buffer[246] = buffer[250] = buffer[254] = 0x02;
+-      buffer[243] = buffer[247] = buffer[251] = buffer[255] = 0xA0;
+-
+-      essid[slen - 1] = '\1';
+-
+-      HMAC(EVP_sha1(),
+-               (unsigned char *) key1,
+-               strlen(key1),
+-               (unsigned char *) essid,
+-               slen,
+-               pmk1,
+-               NULL);
+-      HMAC(EVP_sha1(),
+-               (unsigned char *) key2,
+-               strlen(key2),
+-               (unsigned char *) essid,
+-               slen,
+-               pmk2,
+-               NULL);
+-      HMAC(EVP_sha1(),
+-               (unsigned char *) key3,
+-               strlen(key3),
+-               (unsigned char *) essid,
+-               slen,
+-               pmk3,
+-               NULL);
+-      HMAC(EVP_sha1(),
+-               (unsigned char *) key4,
+-               strlen(key4),
+-               (unsigned char *) essid,
+-               slen,
+-               pmk4,
+-               NULL);
+-
+-      u = (unsigned *) pmk1;
+-      v = (unsigned *) pmk2;
+-      u3 = (unsigned *) pmk3;
+-      v4 = (unsigned *) pmk4;
+-      w = (unsigned *) buffer;
+-
+-      *w++ = *u++;
+-      *w++ = *v++;
+-      *w++ = *u3++;
+-      *w++ = *v4++;
+-      *w++ = *u++;
+-      *w++ = *v++;
+-      *w++ = *u3++;
+-      *w++ = *v4++;
+-      *w++ = *u++;
+-      *w++ = *v++;
+-      *w++ = *u3++;
+-      *w++ = *v4++;
+-      *w++ = *u++;
+-      *w++ = *v++;
+-      *w++ = *u3++;
+-      *w++ = *v4++;
+-      *w++ = *u++;
+-      *w++ = *v++;
+-      *w++ = *u3++;
+-      *w++ = *v4++;
+-
+-      for (i = 1; i < 4096; i++)
+-      {
+-              memcpy(sha1_ctx, ctx_ipad, 80); // eran 40
+-              shasse2_data(sha1_ctx, buffer, wrkbuf);
+-              shasse2_ends(sha1_ctx, buffer);
+-
+-              memcpy(sha1_ctx, ctx_opad, 80);
+-              shasse2_data(sha1_ctx, buffer, wrkbuf);
+-              shasse2_ends(sha1_ctx, buffer);
+-
+-              u = (unsigned *) pmk1;
+-              v = (unsigned *) pmk2;
+-              u3 = (unsigned *) pmk3;
+-              v4 = (unsigned *) pmk4;
+-              w = (unsigned *) buffer;
+-
+-              /* de-interleave the digests */
+-              *u++ ^= *w++;
+-              *v++ ^= *w++;
+-              *u3++ ^= *w++;
+-              *v4++ ^= *w++;
+-              *u++ ^= *w++;
+-              *v++ ^= *w++;
+-              *u3++ ^= *w++;
+-              *v4++ ^= *w++;
+-              *u++ ^= *w++;
+-              *v++ ^= *w++;
+-              *u3++ ^= *w++;
+-              *v4++ ^= *w++;
+-              *u++ ^= *w++;
+-              *v++ ^= *w++;
+-              *u3++ ^= *w++;
+-              *v4++ ^= *w++;
+-              *u++ ^= *w++;
+-              *v++ ^= *w++;
+-              *u3++ ^= *w++;
+-              *v4++ ^= *w++;
+-      }
+-
+-      essid[slen - 1] = '\2';
+-
+-      HMAC(EVP_sha1(),
+-               (unsigned char *) key1,
+-               strlen(key1),
+-               (unsigned char *) essid,
+-               slen,
+-               pmk1 + 20,
+-               NULL);
+-      HMAC(EVP_sha1(),
+-               (unsigned char *) key2,
+-               strlen(key2),
+-               (unsigned char *) essid,
+-               slen,
+-               pmk2 + 20,
+-               NULL);
+-      HMAC(EVP_sha1(),
+-               (unsigned char *) key3,
+-               strlen(key3),
+-               (unsigned char *) essid,
+-               slen,
+-               pmk3 + 20,
+-               NULL);
+-      HMAC(EVP_sha1(),
+-               (unsigned char *) key4,
+-               strlen(key4),
+-               (unsigned char *) essid,
+-               slen,
+-               pmk4 + 20,
+-               NULL);
+-
+-      u = (unsigned *) (pmk1 + 20); // eran 20
+-      v = (unsigned *) (pmk2 + 20);
+-      u3 = (unsigned *) (pmk3 + 20); // eran 20
+-      v4 = (unsigned *) (pmk4 + 20);
+-      w = (unsigned *) buffer;
+-
+-      *w++ = *u++;
+-      *w++ = *v++;
+-      *w++ = *u3++;
+-      *w++ = *v4++;
+-      *w++ = *u++;
+-      *w++ = *v++;
+-      *w++ = *u3++;
+-      *w++ = *v4++;
+-      *w++ = *u++;
+-      *w++ = *v++;
+-      *w++ = *u3++;
+-      *w++ = *v4++;
+-      *w++ = *u++;
+-      *w++ = *v++;
+-      *w++ = *u3++;
+-      *w++ = *v4++;
+-      *w++ = *u++;
+-      *w++ = *v++;
+-      *w++ = *u3++;
+-      *w++ = *v4++;
+-
+-      for (i = 1; i < 4096; i++)
+-      {
+-              memcpy(sha1_ctx, ctx_ipad, 80); // eran 40
+-              shasse2_data(sha1_ctx, buffer, wrkbuf);
+-              shasse2_ends(sha1_ctx, buffer);
+-
+-              memcpy(sha1_ctx, ctx_opad, 80);
+-              shasse2_data(sha1_ctx, buffer, wrkbuf);
+-              shasse2_ends(sha1_ctx, buffer);
+-
+-              u = (unsigned *) (pmk1 + 20); // eran 20
+-              v = (unsigned *) (pmk2 + 20);
+-              u3 = (unsigned *) (pmk3 + 20);
+-              v4 = (unsigned *) (pmk4 + 20);
+-              w = (unsigned *) buffer;
+-
+-              *u++ ^= *w++;
+-              *v++ ^= *w++;
+-              *u3++ ^= *w++;
+-              *v4++ ^= *w++;
+-              *u++ ^= *w++;
+-              *v++ ^= *w++;
+-              *u3++ ^= *w++;
+-              *v4++ ^= *w++;
+-              *u++ ^= *w++;
+-              *v++ ^= *w++;
+-              *u3++ ^= *w++;
+-              *v4++ ^= *w++;
+-      }
+-
+-      memcpy(_pmk3, pmk3, 32);
+-      memcpy(_pmk4, pmk4, 32);
+-      memcpy(_pmk1, pmk1, 32);
+-      memcpy(_pmk2, pmk2, 32);
+-
+-      /*printf("\n");
+-      show_result(_key1, _pmk1);
+-      show_result(_key2, _pmk2);
+-      show_result(_key3, _pmk3);
+-      show_result(_key4, _pmk4);
+-      fflush(stdout);*/
+-}
+-#endif
+-#else
+-#ifdef OLD_SSE_CORE
+-void calc_4pmk(char * _key1,
+-                         char * _key2,
+-                         char * _key3,
+-                         char * _key4,
+-                         char * _essid,
+-                         unsigned char * _pmk1,
+-                         unsigned char * _pmk2,
+-                         unsigned char * _pmk3,
+-                         unsigned char * _pmk4)
+-{
+-      calc_pmk(_key1, _essid, _pmk1);
+-      calc_pmk(_key2, _essid, _pmk2);
+-      calc_pmk(_key3, _essid, _pmk3);
+-      calc_pmk(_key4, _essid, _pmk4);
+-}
+-#endif
+-#endif
Index: patches/patch-lib_Makefile_inc
===================================================================
RCS file: patches/patch-lib_Makefile_inc
diff -N patches/patch-lib_Makefile_inc
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_Makefile_inc      23 Oct 2021 07:03:13 -0000
@@ -0,0 +1,26 @@
+$OpenBSD$
+
+chore: remove unused assembly routines
+
+Index: lib/Makefile.inc
+--- lib/Makefile.inc.orig
++++ lib/Makefile.inc
+@@ -64,10 +64,6 @@ if LIBGCRYPT
+ SRC_CRYPTO    +=      %D%/crypto/sha1-git.c
+ endif
+ 
+-if X86
+-SRC_CRYPTO    +=      %D%/crypto/sha1-sse2.S
+-endif
+-
+ libaccrypto_la_SOURCES        = $(SRC_CRYPTO)
+ libaccrypto_la_CFLAGS         = $(COMMON_CFLAGS) $(PCRE_CFLAGS)
+ libaccrypto_la_LIBADD         = $(PCRE_LIBS) $(LIBAIRCRACK_OSDEP_LIBS) 
$(CRYPTO_LIBS)
+@@ -251,7 +247,6 @@ EXTRA_DIST +=      %D%/ce-wep/uniqueiv.c \
+                                                       %D%/cowpatty/cowpatty.c 
\
+                                                       %D%/crypto/crypto.c \
+                                                       %D%/crypto/sha1-git.c \
+-                                                      %D%/crypto/sha1-sse2.S \
+                                                       
%D%/libac/adt/avl_tree.c \
+                                                       
%D%/libac/adt/circular_buffer.c \
+                                                       
%D%/libac/adt/circular_queue.c \
Index: patches/patch-lib_libac_support_common_c
===================================================================
RCS file: patches/patch-lib_libac_support_common_c
diff -N patches/patch-lib_libac_support_common_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_libac_support_common_c    23 Oct 2021 07:03:13 -0000
@@ -0,0 +1,63 @@
+$OpenBSD$
+
+Index: lib/libac/support/common.c
+--- lib/libac/support/common.c.orig
++++ lib/libac/support/common.c
+@@ -52,8 +52,8 @@
+ 
+ #include <aircrack-ng/support/common.h>
+ 
+-#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)    
 \
+-      || defined(__MidnightBSD__)
++#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)    \
++      || defined(__DragonFly__) || defined(__MidnightBSD__)
+ #include <sys/sysctl.h>
+ #include <sys/user.h>
+ #endif
+@@ -183,11 +183,15 @@ int is_string_number(const char * str)
+ int get_ram_size(void)
+ {
+       int ret = -1;
+-#if defined(__FreeBSD__) || defined(__MidnightBSD__)
++#if defined(HW_PHYSMEM) || defined(HW_PHYSMEM64)
++#ifdef HW_PHYSMEM64
++      int mib[] = {CTL_HW, HW_PHYSMEM64};
++      uint64_t physmem;
++#else
+       int mib[] = {CTL_HW, HW_PHYSMEM};
++      size_t physmem;
++#endif
+       size_t len;
+-      unsigned long physmem;
+-
+       len = sizeof(physmem);
+ 
+       if (!sysctl(mib, 2, &physmem, &len, NULL, 0))
+@@ -357,11 +361,12 @@ int get_nb_cpus(void)
+ 
+               fclose(f);
+       }
+-#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)  
 \
+-      || defined(__MidnightBSD__)
+-      // Not sure about defined(__DragonFly__) || defined(__NetBSD__) ||
+-      // defined(__OpenBSD__) || defined(__APPLE__)
++#elif defined(HW_NCPU) || defined(HW_NCPUONLINE)
++#ifdef HW_NCPUONLINE
++      int mib[] = {CTL_HW, HW_NCPUONLINE};
++#else
+       int mib[] = {CTL_HW, HW_NCPU};
++#endif
+       size_t len;
+       unsigned long nbcpu;
+ 
+@@ -371,9 +376,7 @@ int get_nb_cpus(void)
+       {
+               number = (int) nbcpu;
+       }
+-#endif
+-
+-#ifdef _SC_NPROCESSORS_ONLN
++#elif defined(_SC_NPROCESSORS_ONLN)
+       // Try the usual method if _SC_NPROCESSORS_ONLN exist
+       if (number == -1)
+       {
Index: patches/patch-lib_osdep_openbsd_c
===================================================================
RCS file: patches/patch-lib_osdep_openbsd_c
diff -N patches/patch-lib_osdep_openbsd_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_osdep_openbsd_c   23 Oct 2021 07:03:13 -0000
@@ -0,0 +1,67 @@
+$OpenBSD$
+
+- fix(osdep/openbsd): use memcpy for fixed length copies
+- fix(osdep/openbsd): remove kernel-only header
+
+Index: lib/osdep/openbsd.c
+--- lib/osdep/openbsd.c.orig
++++ lib/osdep/openbsd.c
+@@ -42,7 +42,6 @@
+ #include <net80211/ieee80211_crypto.h>
+ #include <frame.h>
+ #include <sys/timeout.h>
+-#include <machine/intr.h>
+ #undef _KERNEL
+ #include <net80211/ieee80211_node.h>
+ #include <net80211/ieee80211_ioctl.h>
+@@ -364,19 +363,19 @@ static int do_obsd_open(struct wif * wi, char * iface)
+ 
+       /* set iface up and promisc */
+       memset(&ifr, 0, sizeof(ifr));
+-      strncpy(ifr.ifr_name, iface, IFNAMSIZ);
++      memcpy(ifr.ifr_name, iface, IFNAMSIZ);
+       if (ioctl(s, SIOCGIFFLAGS, &ifr) == -1) goto close_sock;
+ 
+       flags = ifr.ifr_flags;
+       flags |= IFF_UP | IFF_PROMISC;
+       memset(&ifr, 0, sizeof(ifr));
+-      strncpy(ifr.ifr_name, iface, IFNAMSIZ);
++      memcpy(ifr.ifr_name, iface, IFNAMSIZ);
+       ifr.ifr_flags = flags & 0xffff;
+       if (ioctl(s, SIOCSIFFLAGS, &ifr) == -1) goto close_sock;
+ 
+       /* monitor mode */
+       memset(&ifmr, 0, sizeof(ifmr));
+-      strncpy(ifmr.ifm_name, iface, IFNAMSIZ);
++      memcpy(ifmr.ifm_name, iface, IFNAMSIZ);
+       if (ioctl(s, SIOCGIFMEDIA, &ifmr) == -1) goto close_sock;
+ 
+       assert(ifmr.ifm_count != 0);
+@@ -392,15 +391,15 @@ static int do_obsd_open(struct wif * wi, char * iface)
+       free(mwords);
+ 
+       memset(&ifr, 0, sizeof(ifr));
+-      strncpy(ifr.ifr_name, iface, IFNAMSIZ);
++      memcpy(ifr.ifr_name, iface, IFNAMSIZ);
+       ifr.ifr_media = ifmr.ifm_current | IFM_IEEE80211_MONITOR;
+       if (ioctl(s, SIOCSIFMEDIA, &ifr) == -1) goto close_sock;
+ 
+       /* setup ifreq for chan that may be used in future */
+-      strncpy(po->po_ireq.i_name, iface, IFNAMSIZ);
++      memcpy(po->po_ireq.i_name, iface, IFNAMSIZ);
+ 
+       /* same for ifreq [mac addr] */
+-      strncpy(po->po_ifr.ifr_name, iface, IFNAMSIZ);
++      memcpy(po->po_ifr.ifr_name, iface, IFNAMSIZ);
+ 
+       /* open bpf */
+       for (i = 0; i < 256; i++)
+@@ -421,7 +420,7 @@ static int do_obsd_open(struct wif * wi, char * iface)
+ 
+       if (ioctl(fd, BIOCSBLEN, &size) < 0) goto close_bpf;
+ 
+-      strncpy(ifr.ifr_name, iface, IFNAMSIZ);
++      memcpy(ifr.ifr_name, iface, IFNAMSIZ);
+ 
+       if (ioctl(fd, BIOCSETIF, &ifr) < 0) goto close_bpf;
+ 
Index: patches/patch-lib_osdep_openbsd_tap_c
===================================================================
RCS file: patches/patch-lib_osdep_openbsd_tap_c
diff -N patches/patch-lib_osdep_openbsd_tap_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-lib_osdep_openbsd_tap_c       23 Oct 2021 07:03:13 -0000
@@ -0,0 +1,27 @@
+$OpenBSD$
+
+- fix(osdep/openbsd_tap): use correct define for sized buffer
+- fix(osdep/openbsd_tap): fix dest buffer length
+- chore(osdep/openbsd_tap): switch to memcpy, no formatting is used
+
+Index: lib/osdep/openbsd_tap.c
+--- lib/osdep/openbsd_tap.c.orig
++++ lib/osdep/openbsd_tap.c
+@@ -41,7 +41,7 @@ struct tip_obsd
+       int to_fd;
+       int to_ioctls;
+       struct ifreq to_ifr;
+-      char to_name[MAX_IFACE_NAME];
++      char to_name[IFNAMSIZ];
+       int to_destroy;
+ };
+ 
+@@ -79,7 +79,7 @@ static int ti_do_open_obsd(struct tif * ti, char * nam
+       /* get flags */
+       ifr = &priv->to_ifr;
+       memset(ifr, 0, sizeof(*ifr));
+-      snprintf(ifr->ifr_name, sizeof(ifr->ifr_name) - 1, "%s", priv->to_name);
++      memcpy(ifr->ifr_name, priv->to_name, sizeof(ifr->ifr_name));
+       if (ioctl(s, SIOCGIFFLAGS, ifr) == -1) goto err2;
+       flags = ifr->ifr_flags;
+ 
Index: patches/patch-src_Makefile_am
===================================================================
RCS file: patches/patch-src_Makefile_am
diff -N patches/patch-src_Makefile_am
--- patches/patch-src_Makefile_am       23 Feb 2019 22:23:25 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,17 +0,0 @@
-$OpenBSD: patch-src_Makefile_am,v 1.1 2019/02/23 22:23:25 sebastia Exp $
-
-our base libtool fails finding libaircrack-util
-
-
-Index: src/Makefile.am
---- src/Makefile.am.orig
-+++ src/Makefile.am
-@@ -205,7 +205,7 @@ ivstools_LDADD = $(COMMON_LDADD) $(LIBAC_LIBS) $(LIBAI
- 
- kstats_SOURCES = kstats.c
- kstats_CFLAGS = $(LIBAC_CFLAGS) $(PTHREAD_CFLAGS)
--kstats_LDADD = $(COMMON_LDADD) $(LIBAC_LIBS)
-+kstats_LDADD = $(COMMON_LDADD) $(LIBAC_LIBS) $(LIBAIRCRACK_UTIL_LIBS)
- 
- wesside_ng_SOURCES = $(SRC_WS) $(LIBAIRCRACK_OSDEP) $(LIBAIRCRACK_UTIL)
- wesside_ng_CFLAGS = $(COMMON_CFLAGS) $(LIBNL_CFLAGS)
Index: patches/patch-src_aircrack-osdep_openbsd_c
===================================================================
RCS file: patches/patch-src_aircrack-osdep_openbsd_c
diff -N patches/patch-src_aircrack-osdep_openbsd_c
--- patches/patch-src_aircrack-osdep_openbsd_c  22 Jul 2020 12:53:31 -0000      
1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-$OpenBSD: patch-src_aircrack-osdep_openbsd_c,v 1.2 2020/07/22 12:53:31 tb Exp $
-
-Index: src/aircrack-osdep/openbsd.c
---- src/aircrack-osdep/openbsd.c.orig
-+++ src/aircrack-osdep/openbsd.c
-@@ -37,7 +37,6 @@
- #include <net80211/ieee80211_crypto.h>
- #include <frame.h>
- #include <sys/timeout.h>
--#include <machine/intr.h>
- #undef _KERNEL
- #include <net80211/ieee80211_node.h>
- #include <net80211/ieee80211_ioctl.h>
-@@ -322,7 +321,7 @@ static int do_obsd_open(struct wif * wi, char * iface)
-       int s;
-       unsigned int flags;
-       struct ifmediareq ifmr;
--      int * mwords;
-+      uint64_t * mwords;
-       struct priv_obsd * po = wi_priv(wi);
-       unsigned int size = sizeof(po->po_buf);
- 
-@@ -353,7 +352,7 @@ static int do_obsd_open(struct wif * wi, char * iface)
- 
-       assert(ifmr.ifm_count != 0);
- 
--      mwords = (int *) malloc(ifmr.ifm_count * sizeof(int));
-+      mwords = calloc(ifmr.ifm_count, sizeof(*mwords));
-       if (!mwords) goto close_sock;
-       ifmr.ifm_ulist = mwords;
-       if (ioctl(s, SIOCGIFMEDIA, &ifmr) == -1)
Index: patches/patch-src_airodump-ng_airodump-ng_c
===================================================================
RCS file: patches/patch-src_airodump-ng_airodump-ng_c
diff -N patches/patch-src_airodump-ng_airodump-ng_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_airodump-ng_airodump-ng_c 23 Oct 2021 07:03:13 -0000
@@ -0,0 +1,21 @@
+$OpenBSD$
+
+Index: src/airodump-ng/airodump-ng.c
+--- src/airodump-ng/airodump-ng.c.orig
++++ src/airodump-ng/airodump-ng.c
+@@ -92,14 +92,12 @@
+ #include "radiotap/radiotap_iter.h"
+ 
+ struct devices dev;
+-uint8_t h80211[4096] __attribute__((aligned(16)));
+-uint8_t tmpbuf[4096] __attribute__((aligned(16)));
+ 
+ static const unsigned char llcnull[] = {0, 0, 0, 0};
+ 
+ static const char * OUI_PATHS[]
+       = {"./airodump-ng-oui.txt",
+-         "/etc/aircrack-ng/airodump-ng-oui.txt",
++         "${PREFIX}/share/mac-vendor/aircrack-oui.txt",
+          "/usr/local/etc/aircrack-ng/airodump-ng-oui.txt",
+          "/usr/share/aircrack-ng/airodump-ng-oui.txt",
+          "/var/lib/misc/oui.txt",
Index: patches/patch-src_airodump-ng_h
===================================================================
RCS file: patches/patch-src_airodump-ng_h
diff -N patches/patch-src_airodump-ng_h
--- patches/patch-src_airodump-ng_h     23 Feb 2019 22:23:25 -0000      1.2
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-$OpenBSD: patch-src_airodump-ng_h,v 1.2 2019/02/23 22:23:25 sebastia Exp $
-
-use the mac-vendors OUI file
-
-Index: src/airodump-ng.h
---- src/airodump-ng.h.orig
-+++ src/airodump-ng.h
-@@ -124,7 +124,7 @@ extern const unsigned long int crc_tbl[256];
- extern const unsigned char crc_chop_tbl[256][4];
- 
- const char * OUI_PATHS[] = {"./airodump-ng-oui.txt",
--                                                      
"/etc/aircrack-ng/airodump-ng-oui.txt",
-+                                                      
"${PREFIX}/share/mac-vendor/aircrack-oui.txt",
-                                                       
"/usr/local/etc/aircrack-ng/airodump-ng-oui.txt",
-                                                       
"/usr/share/aircrack-ng/airodump-ng-oui.txt",
-                                                       "/var/lib/misc/oui.txt",
Index: patches/patch-src_wpaclean_c
===================================================================
RCS file: patches/patch-src_wpaclean_c
diff -N patches/patch-src_wpaclean_c
--- patches/patch-src_wpaclean_c        9 Mar 2019 18:02:35 -0000       1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,21 +0,0 @@
-$OpenBSD: patch-src_wpaclean_c,v 1.1 2019/03/09 18:02:35 sebastia Exp $
-
-prevent wpaclean from overwriting the outputfile
-with next capture each time a new capture is found
-in a source file
-
-Index: src/wpaclean.c
---- src/wpaclean.c.orig
-+++ src/wpaclean.c
-@@ -138,7 +138,10 @@ static void save_network(const struct network * n)
- {
-       int i;
- 
--      _outfd = open_pcap(_outfilename);
-+      if (_outfd == 0)
-+      {
-+              _outfd = open_pcap(_outfilename);
-+      }
-       write_pcap(_outfd, n->n_beacon, n->n_beaconlen);
- 
-       for (i = 0; i < 4; i++)
Index: pkg/PFRAG.arm
===================================================================
RCS file: pkg/PFRAG.arm
diff -N pkg/PFRAG.arm
--- pkg/PFRAG.arm       23 Feb 2019 22:23:25 -0000      1.1
+++ /dev/null   1 Jan 1970 00:00:00 -0000
@@ -1,4 +0,0 @@
-@comment $OpenBSD: PFRAG.arm,v 1.1 2019/02/23 22:23:25 sebastia Exp $
-lib/libaircrack-crypto-arm-neon-1.3.0.so
-lib/libaircrack-crypto-arm-neon.la
-lib/libaircrack-crypto-arm-neon.so
Index: pkg/PFRAG.x86
===================================================================
RCS file: /cvs/ports/security/aircrack-ng/pkg/PFRAG.x86,v
retrieving revision 1.1
diff -u -p -u -p -r1.1 PFRAG.x86
--- pkg/PFRAG.x86       23 Feb 2019 22:23:25 -0000      1.1
+++ pkg/PFRAG.x86       23 Oct 2021 07:03:13 -0000
@@ -1,10 +1,10 @@
 @comment $OpenBSD: PFRAG.x86,v 1.1 2019/02/23 22:23:25 sebastia Exp $
-lib/libaircrack-crypto-x86-avx-1.3.0.so
-lib/libaircrack-crypto-x86-avx.la
-lib/libaircrack-crypto-x86-avx.so
-lib/libaircrack-crypto-x86-avx2-1.3.0.so
-lib/libaircrack-crypto-x86-avx2.la
-lib/libaircrack-crypto-x86-avx2.so
-lib/libaircrack-crypto-x86-sse2-1.3.0.so
-lib/libaircrack-crypto-x86-sse2.la
-lib/libaircrack-crypto-x86-sse2.so
+@so lib/libaircrack-ce-wpa-x86-avx-1.6.0.so
+lib/libaircrack-ce-wpa-x86-avx.la
+@so lib/libaircrack-ce-wpa-x86-avx.so
+@so lib/libaircrack-ce-wpa-x86-avx2-1.6.0.so
+lib/libaircrack-ce-wpa-x86-avx2.la
+@so lib/libaircrack-ce-wpa-x86-avx2.so
+@so lib/libaircrack-ce-wpa-x86-sse2-1.6.0.so
+lib/libaircrack-ce-wpa-x86-sse2.la
+@so lib/libaircrack-ce-wpa-x86-sse2.so
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/security/aircrack-ng/pkg/PLIST,v
retrieving revision 1.5
diff -u -p -u -p -r1.5 PLIST
--- pkg/PLIST   13 Jun 2020 17:38:49 -0000      1.5
+++ pkg/PLIST   23 Oct 2021 07:03:13 -0000
@@ -8,14 +8,76 @@
 @bin bin/makeivs-ng
 @bin bin/packetforge-ng
 @bin bin/wpaclean
-lib/libaircrack-crypto-1.3.0.so
 %%x86%%
-%%arm%%
-lib/libaircrack-crypto.la
-lib/libaircrack-crypto.so
-lib/libaircrack-osdep-1.3.0.so
+include/aircrack-ng/
+include/aircrack-ng/adt/
+include/aircrack-ng/adt/avl_tree.h
+include/aircrack-ng/adt/circular_buffer.h
+include/aircrack-ng/adt/circular_queue.h
+include/aircrack-ng/aircrack-ng.h
+include/aircrack-ng/ce-wep/
+include/aircrack-ng/ce-wep/uniqueiv.h
+include/aircrack-ng/ce-wpa/
+include/aircrack-ng/ce-wpa/aligned.h
+include/aircrack-ng/ce-wpa/arch.h
+include/aircrack-ng/ce-wpa/crypto_engine.h
+include/aircrack-ng/ce-wpa/jcommon.h
+include/aircrack-ng/ce-wpa/johnswap.h
+include/aircrack-ng/ce-wpa/memdbg.h
+include/aircrack-ng/ce-wpa/memory.h
+include/aircrack-ng/ce-wpa/misc.h
+include/aircrack-ng/ce-wpa/pseudo_intrinsics.h
+include/aircrack-ng/ce-wpa/simd-intrinsics-load-flags.h
+include/aircrack-ng/ce-wpa/simd-intrinsics.h
+include/aircrack-ng/ce-wpa/wpapsk.h
+include/aircrack-ng/cowpatty/
+include/aircrack-ng/cowpatty/cowpatty.h
+include/aircrack-ng/cpu/
+include/aircrack-ng/cpu/cpuset.h
+include/aircrack-ng/cpu/simd_cpuid.h
+include/aircrack-ng/cpu/trampoline.h
+include/aircrack-ng/crypto/
+include/aircrack-ng/crypto/crctable.h
+include/aircrack-ng/crypto/crypto.h
+include/aircrack-ng/crypto/gcrypt-openssl-wrapper.h
+include/aircrack-ng/crypto/sha1-git.h
+include/aircrack-ng/crypto/sha1-sse2.h
+include/aircrack-ng/defs.h
+include/aircrack-ng/osdep/
+include/aircrack-ng/osdep/byteorder.h
+include/aircrack-ng/osdep/channel.h
+include/aircrack-ng/osdep/common.h
+include/aircrack-ng/osdep/network.h
+include/aircrack-ng/osdep/osdep.h
+include/aircrack-ng/osdep/packed.h
+include/aircrack-ng/ptw/
+include/aircrack-ng/ptw/aircrack-ptw-lib.h
+include/aircrack-ng/support/
+include/aircrack-ng/support/common.h
+include/aircrack-ng/support/communications.h
+include/aircrack-ng/support/crypto_engine_loader.h
+include/aircrack-ng/support/fragments.h
+include/aircrack-ng/support/mcs_index_rates.h
+include/aircrack-ng/support/pcap_local.h
+include/aircrack-ng/support/station.h
+include/aircrack-ng/third-party/
+include/aircrack-ng/third-party/eapol.h
+include/aircrack-ng/third-party/ethernet.h
+include/aircrack-ng/third-party/hashcat.h
+include/aircrack-ng/third-party/ieee80211.h
+include/aircrack-ng/third-party/if_arp.h
+include/aircrack-ng/third-party/if_llc.h
+include/aircrack-ng/tui/
+include/aircrack-ng/tui/console.h
+include/aircrack-ng/utf8/
+include/aircrack-ng/utf8/verifyssid.h
+include/aircrack-ng/version.h
+@so lib/libaircrack-ce-wpa-1.6.0.so
+lib/libaircrack-ce-wpa.la
+@so lib/libaircrack-ce-wpa.so
+@so lib/libaircrack-osdep-1.6.0.so
 lib/libaircrack-osdep.la
-lib/libaircrack-osdep.so
+@so lib/libaircrack-osdep.so
 @man man/man1/aircrack-ng.1
 @man man/man1/airdecap-ng.1
 @man man/man1/airdecloak-ng.1
@@ -40,5 +102,6 @@ lib/libaircrack-osdep.so
 @bin sbin/aireplay-ng
 @comment sbin/airmon-ng
 @bin sbin/airodump-ng
+sbin/airodump-ng-oui-update
 @bin sbin/airserv-ng
 @comment sbin/airtun-ng

Reply via email to