Wed Jul 15 19:51:19 2020 UTC ()
www/firefox: Add NetBSD support for U2F/FIDO2 security keys.

Patch submitted upstream:
https://github.com/mozilla/authenticator-rs/pull/116


(riastradh)
diff -r1.438 -r1.439 pkgsrc/www/firefox/Makefile
diff -r1.403 -r1.404 pkgsrc/www/firefox/distinfo
diff -r0 -r1.1 pkgsrc/www/firefox/patches/patch-third__party_rust_authenticator_.cargo-checksum.json
diff -r0 -r1.1 pkgsrc/www/firefox/patches/patch-third__party_rust_authenticator_src_lib.rs
diff -r0 -r1.1 pkgsrc/www/firefox/patches/patch-third__party_rust_authenticator_src_netbsd_device.rs
diff -r0 -r1.1 pkgsrc/www/firefox/patches/patch-third__party_rust_authenticator_src_netbsd_fd.rs
diff -r0 -r1.1 pkgsrc/www/firefox/patches/patch-third__party_rust_authenticator_src_netbsd_mod.rs
diff -r0 -r1.1 pkgsrc/www/firefox/patches/patch-third__party_rust_authenticator_src_netbsd_monitor.rs
diff -r0 -r1.1 pkgsrc/www/firefox/patches/patch-third__party_rust_authenticator_src_netbsd_transaction.rs
diff -r0 -r1.1 pkgsrc/www/firefox/patches/patch-third__party_rust_authenticator_src_netbsd_uhid.rs

cvs diff -r1.438 -r1.439 pkgsrc/www/firefox/Makefile (expand / switch to unified diff)

--- pkgsrc/www/firefox/Makefile 2020/07/12 01:37:50 1.438
+++ pkgsrc/www/firefox/Makefile 2020/07/15 19:51:18 1.439
@@ -1,18 +1,19 @@ @@ -1,18 +1,19 @@
1# $NetBSD: Makefile,v 1.438 2020/07/12 01:37:50 ryoon Exp $ 1# $NetBSD: Makefile,v 1.439 2020/07/15 19:51:18 riastradh Exp $
2 2
3FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR} 3FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
4MOZ_BRANCH= 78.0 4MOZ_BRANCH= 78.0
5MOZ_BRANCH_MINOR= .2 5MOZ_BRANCH_MINOR= .2
 6PKGREVISION= 1
6 7
7DISTNAME= firefox-${FIREFOX_VER}.source 8DISTNAME= firefox-${FIREFOX_VER}.source
8PKGNAME= ${DISTNAME:S/.source//:S/b/beta/:S/esr//} 9PKGNAME= ${DISTNAME:S/.source//:S/b/beta/:S/esr//}
9CATEGORIES= www 10CATEGORIES= www
10MASTER_SITES+= ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/} 11MASTER_SITES+= ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/}
11EXTRACT_SUFX= .tar.xz 12EXTRACT_SUFX= .tar.xz
12 13
13MAINTAINER= ryoon@NetBSD.org 14MAINTAINER= ryoon@NetBSD.org
14HOMEPAGE= https://www.mozilla.org/en-US/firefox/ 15HOMEPAGE= https://www.mozilla.org/en-US/firefox/
15COMMENT= Web browser with support for extensions (version ${FIREFOX_VER:tu:C/\\.[[:digit:]\.]*//}) 16COMMENT= Web browser with support for extensions (version ${FIREFOX_VER:tu:C/\\.[[:digit:]\.]*//})
16LICENSE= mpl-1.1 17LICENSE= mpl-1.1
17 18
18UNLIMIT_RESOURCES+= datasize virtualsize 19UNLIMIT_RESOURCES+= datasize virtualsize

cvs diff -r1.403 -r1.404 pkgsrc/www/firefox/distinfo (expand / switch to unified diff)

--- pkgsrc/www/firefox/distinfo 2020/07/12 01:37:50 1.403
+++ pkgsrc/www/firefox/distinfo 2020/07/15 19:51:18 1.404
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1$NetBSD: distinfo,v 1.403 2020/07/12 01:37:50 ryoon Exp $ 1$NetBSD: distinfo,v 1.404 2020/07/15 19:51:18 riastradh Exp $
2 2
3SHA1 (firefox-78.0.2.source.tar.xz) = 6dd99fc08df3f479fa3a8ff7a3ab527fbeeb4f61 3SHA1 (firefox-78.0.2.source.tar.xz) = 6dd99fc08df3f479fa3a8ff7a3ab527fbeeb4f61
4RMD160 (firefox-78.0.2.source.tar.xz) = 94efd51d47add86fe41ed50ba55ff901994e1a9e 4RMD160 (firefox-78.0.2.source.tar.xz) = 94efd51d47add86fe41ed50ba55ff901994e1a9e
5SHA512 (firefox-78.0.2.source.tar.xz) = 4aa753fb51459301379d186f3c93e15755530e5e1ea17795d620cc9da56eb5e76cce483ca57f4af339b6f17e47101dff772ca01fb1b469201a09283f14f567be 5SHA512 (firefox-78.0.2.source.tar.xz) = 4aa753fb51459301379d186f3c93e15755530e5e1ea17795d620cc9da56eb5e76cce483ca57f4af339b6f17e47101dff772ca01fb1b469201a09283f14f567be
6Size (firefox-78.0.2.source.tar.xz) = 334406116 bytes 6Size (firefox-78.0.2.source.tar.xz) = 334406116 bytes
7SHA1 (patch-aa) = 11060461fdaca5661e89651b8ded4a59d2abc4d7 7SHA1 (patch-aa) = 11060461fdaca5661e89651b8ded4a59d2abc4d7
8SHA1 (patch-browser_app_profile_firefox.js) = 89cea0a66457c96ad0b94aaa524aa5942ad781d0 8SHA1 (patch-browser_app_profile_firefox.js) = 89cea0a66457c96ad0b94aaa524aa5942ad781d0
9SHA1 (patch-build_moz.configure_rust.configure) = ee9e207e67709f3c9455b4d22f5f254890e99ca8 9SHA1 (patch-build_moz.configure_rust.configure) = ee9e207e67709f3c9455b4d22f5f254890e99ca8
10SHA1 (patch-config_gcc-stl-wrapper.template.h) = 781a063fa6ab345face53fd88404ead11ab335b2 10SHA1 (patch-config_gcc-stl-wrapper.template.h) = 781a063fa6ab345face53fd88404ead11ab335b2
11SHA1 (patch-config_makefiles_rust.mk) = 8637cd3f56774648fd586c7ad8dd49e269b9eb2a 11SHA1 (patch-config_makefiles_rust.mk) = 8637cd3f56774648fd586c7ad8dd49e269b9eb2a
12SHA1 (patch-configure.in) = b40651b008dcecc49664660ac376df2bd7c2c6be 12SHA1 (patch-configure.in) = b40651b008dcecc49664660ac376df2bd7c2c6be
13SHA1 (patch-dom_base_nsAttrName.h) = ac7ba441a3b27df2855cf2673eea36b1cb44ad49 13SHA1 (patch-dom_base_nsAttrName.h) = ac7ba441a3b27df2855cf2673eea36b1cb44ad49
14SHA1 (patch-dom_media_CubebUtils.cpp) = 226821d961039ae5c9c50d8615757b73c6bcd80a 14SHA1 (patch-dom_media_CubebUtils.cpp) = 226821d961039ae5c9c50d8615757b73c6bcd80a
@@ -21,22 +21,30 @@ SHA1 (patch-ipc_chromium_src_base_messag @@ -21,22 +21,30 @@ SHA1 (patch-ipc_chromium_src_base_messag
21SHA1 (patch-ipc_chromium_src_base_platform__thread__posix.cc) = 35d20981d33ccdb1d8ffb8039e48798777f11658 21SHA1 (patch-ipc_chromium_src_base_platform__thread__posix.cc) = 35d20981d33ccdb1d8ffb8039e48798777f11658
22SHA1 (patch-ipc_glue_GeckoChildProcessHost.cpp) = 260c29bacd8bf265951b7a412f850bf2b292c836 22SHA1 (patch-ipc_glue_GeckoChildProcessHost.cpp) = 260c29bacd8bf265951b7a412f850bf2b292c836
23SHA1 (patch-js_src_jsfriendapi.h) = 6bbb895b882ee24929f011751c42732215e153a2 23SHA1 (patch-js_src_jsfriendapi.h) = 6bbb895b882ee24929f011751c42732215e153a2
24SHA1 (patch-js_src_util_NativeStack.cpp) = a0a16d8d8d78d3cc3f4d2a508586f1a7821f7dba 24SHA1 (patch-js_src_util_NativeStack.cpp) = a0a16d8d8d78d3cc3f4d2a508586f1a7821f7dba
25SHA1 (patch-media_ffvpx_libavutil_arm_bswap.h) = de58daa0fd23d4fec50426602b65c9ea5862558a 25SHA1 (patch-media_ffvpx_libavutil_arm_bswap.h) = de58daa0fd23d4fec50426602b65c9ea5862558a
26SHA1 (patch-media_libcubeb_src_cubeb__alsa.c) = 31536f36cb33f16da309527b50eda9b721608115 26SHA1 (patch-media_libcubeb_src_cubeb__alsa.c) = 31536f36cb33f16da309527b50eda9b721608115
27SHA1 (patch-media_libcubeb_src_moz.build) = e4e64a1135cf4157ae5b6f7c1710ebd076953479 27SHA1 (patch-media_libcubeb_src_moz.build) = e4e64a1135cf4157ae5b6f7c1710ebd076953479
28SHA1 (patch-media_libpng_pngpriv.h) = c8084332560017cd7c9b519b61d125fa28af0dbc 28SHA1 (patch-media_libpng_pngpriv.h) = c8084332560017cd7c9b519b61d125fa28af0dbc
29SHA1 (patch-media_libtheora_lib_info.c) = f6dbf536d73859a1ff78304c2e9f6a6f74dac01f 29SHA1 (patch-media_libtheora_lib_info.c) = f6dbf536d73859a1ff78304c2e9f6a6f74dac01f
30SHA1 (patch-media_libvorbis_lib_vorbis__info.c) = b6b1a84a095db8459bdff24c04f4d56886ddbe45 30SHA1 (patch-media_libvorbis_lib_vorbis__info.c) = b6b1a84a095db8459bdff24c04f4d56886ddbe45
31SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc) = 2eda6a0adab376cd9b41514dac4a811d7fcf599c 31SHA1 (patch-media_webrtc_trunk_webrtc_modules_video__capture_linux_device__info__linux.cc) = 2eda6a0adab376cd9b41514dac4a811d7fcf599c
32SHA1 (patch-nsprpub_pr_src_pthreads_ptsynch.c) = 13e512c7ee9fa1e14ba415d62fa853e5fbfc91c0 32SHA1 (patch-nsprpub_pr_src_pthreads_ptsynch.c) = 13e512c7ee9fa1e14ba415d62fa853e5fbfc91c0
33SHA1 (patch-security_nss_lib_freebl_mpi_mpi.c) = a7cd867916524770609d1c307a65b315b88456f4 33SHA1 (patch-security_nss_lib_freebl_mpi_mpi.c) = a7cd867916524770609d1c307a65b315b88456f4
 34SHA1 (patch-third__party_rust_authenticator_.cargo-checksum.json) = 19af4323fbab4c9ec9f41e3f0029fb5c90b8f08c
 35SHA1 (patch-third__party_rust_authenticator_src_lib.rs) = 0edc6533c22f039e8a3845a4f35b3d6a8b5f086f
 36SHA1 (patch-third__party_rust_authenticator_src_netbsd_device.rs) = 476566aab6487aa909f0edc2166db0506f0d9d52
 37SHA1 (patch-third__party_rust_authenticator_src_netbsd_fd.rs) = a1927d417e8d8d37095b835f3ec7cd32b08c7224
 38SHA1 (patch-third__party_rust_authenticator_src_netbsd_mod.rs) = 5217cd940127601569c656934286c0c850c217f0
 39SHA1 (patch-third__party_rust_authenticator_src_netbsd_monitor.rs) = c7142fa41f946fe9d06d4cf4f5ca3c6bcec65fe6
 40SHA1 (patch-third__party_rust_authenticator_src_netbsd_transaction.rs) = 73cce27ccfcd762874ad8e004f619ebddb02811b
 41SHA1 (patch-third__party_rust_authenticator_src_netbsd_uhid.rs) = a5a8f9cede72602bc4a0a214bff1612b35ddfe28
34SHA1 (patch-third__party_rust_getrandom_src_lib.rs) = 2ad80d10ebfeef0dc27435fc2c16be7b5e5d444a 42SHA1 (patch-third__party_rust_getrandom_src_lib.rs) = 2ad80d10ebfeef0dc27435fc2c16be7b5e5d444a
35SHA1 (patch-third__party_rust_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs) = 3755f32fea84900cc0f00af3d9f53ed5fcfb0b4b 43SHA1 (patch-third__party_rust_libc_src_unix_bsd_netbsdlike_netbsd_mod.rs) = 3755f32fea84900cc0f00af3d9f53ed5fcfb0b4b
36SHA1 (patch-toolkit_components_terminator_nsTerminator.cpp) = 5a516d377d491e0504aaf2d7aed04bb9ebeccc56 44SHA1 (patch-toolkit_components_terminator_nsTerminator.cpp) = 5a516d377d491e0504aaf2d7aed04bb9ebeccc56
37SHA1 (patch-toolkit_modules_subprocess_subprocess__shared__unix.js) = 22a39e54e042ab2270a3cb54e4e307c8900cad12 45SHA1 (patch-toolkit_modules_subprocess_subprocess__shared__unix.js) = 22a39e54e042ab2270a3cb54e4e307c8900cad12
38SHA1 (patch-toolkit_moz.configure) = 40ee147cc1d2c62dd6c83b3f67ce9e61f758ea57 46SHA1 (patch-toolkit_moz.configure) = 40ee147cc1d2c62dd6c83b3f67ce9e61f758ea57
39SHA1 (patch-toolkit_mozapps_installer_packager.mk) = 706635b76a7b525794aba95e95544f09e18bb662 47SHA1 (patch-toolkit_mozapps_installer_packager.mk) = 706635b76a7b525794aba95e95544f09e18bb662
40SHA1 (patch-widget_gtk_WaylandDMABufSurface.cpp) = 3c556b9321a5045363a1d567ea271c520f585850 48SHA1 (patch-widget_gtk_WaylandDMABufSurface.cpp) = 3c556b9321a5045363a1d567ea271c520f585850
41SHA1 (patch-xpcom_base_nscore.h) = 1ac4d34d3c9e80bc1ac966c6c84cb320bc0fa1ec 49SHA1 (patch-xpcom_base_nscore.h) = 1ac4d34d3c9e80bc1ac966c6c84cb320bc0fa1ec
42SHA1 (patch-xpcom_reflect_xptcall_md_unix_moz.build) = 6956c90d4c74c71e7e9a5882e4840ba2673160fa 50SHA1 (patch-xpcom_reflect_xptcall_md_unix_moz.build) = 6956c90d4c74c71e7e9a5882e4840ba2673160fa

File Added: pkgsrc/www/firefox/patches/Attic/patch-third__party_rust_authenticator_.cargo-checksum.json
$NetBSD: patch-third__party_rust_authenticator_.cargo-checksum.json,v 1.1 2020/07/15 19:51:19 riastradh Exp $

Add NetBSD support for U2F.

--- third_party/rust/authenticator/.cargo-checksum.json.orig	2020-07-08 21:55:03.000000000 +0000
+++ third_party/rust/authenticator/.cargo-checksum.json
@@ -1 +1 @@
-{"files":{"Cargo.lock":"4e90be1a6ead1f94b74ab22da0ad669e69bb7c112849d0e43e8942b83ca5ba7b","Cargo.toml":"31b25c3aadc79a147603253dee37c7fcd74e1a20bb62dd3d3b506e097b555fa2","LICENSE":"e866c8f5864d4cacfe403820e722e9dc03fe3c7565efa5e4dad9051d827bb92a","README.md":"f7b1f971632873f3d3c322c2f5cf980fbcd0116786efb580b89fe6ddac07fc07","build.rs":"bc308b771ae9741d775370e3efe45e9cca166fd1d0335f4214b00497042ccc55","examples/main.rs":"7af9e288b1836fb9362589b6bf54c1f1d277bdf64df60c1caccef98c1bfe792c","rustfmt.toml":"de4e1daab481c1572805aed3e51e72c5dc1b3e5af757bc675e1717b251c6e922","src/capi.rs":"99f0d0742bf102451698c7e32db0fc4941b8ac10bec2fb309f41e7e5d99b05bd","src/consts.rs":"4c34980f94d1017e5e75e29b26750c1678e0609c9227296951ffbb9e180a5adf","src/freebsd/device.rs":"914ac446ff24cc3fc050732372e286e1fedf8341a8d4754e392bc9f38393b142","src/freebsd/mod.rs":"42dcb57fbeb00140003a8ad39acac9b547062b8f281a3fa5deb5f92a6169dde6","src/freebsd/monitor.rs":"3683370931b15f05403d240a788a87b1bea801284ee74b849e1f330a4a231dd0","src/freebsd/transaction.rs":"e3615cfdd7f23e9a80a53c32e0fa2a5ae290a432b009bed2b2e74e0df77f8266","src/freebsd/uhid.rs":"d19ade6e808e63981ba5f93d482d676ffa9dff29cb2b7011486591f69ddbbdcd","src/hidproto.rs":"9de8d86509d706e3a0ade2b5a57eec7730afd4073d9cdd99aa8ca1376be37f83","src/lib.rs":"4b43ad18b4eae9356ba6d7954542a38f3015ab8a72ab1fde28169aaf343721d8","src/linux/device.rs":"2271fbb8d176ec01f83a899c0c8194a954465fdd8670a9b136ab88baaba2ee48","src/linux/hidraw.rs":"0d5804d1cd99e7c30c8bde3089f8ed98d7d683d3cd487821e29b133b1ee90228","src/linux/hidwrapper.h":"72785db3a9b27ea72b6cf13a958fee032af54304522d002f56322473978a20f9","src/linux/hidwrapper.rs":"4be65676cf3220929700bf4906938dcbd1538ba53d40c60b08f9ba8890c910f6","src/linux/ioctl_aarch64le.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/ioctl_armle.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/ioctl_mips64le.rs":"fbda309934ad8bda689cd4fb5c0ca696fe26dedb493fe9d5a5322c3047d474fd","src/linux/ioctl_powerpc64be.rs":"fbda309934ad8bda689cd4fb5c0ca696fe26dedb493fe9d5a5322c3047d474fd","src/linux/ioctl_powerpc64le.rs":"0d50afd0bf094b5146d65d263544cba141ff248e487d90d6c03559e9b3c2fd55","src/linux/ioctl_powerpcbe.rs":"0d50afd0bf094b5146d65d263544cba141ff248e487d90d6c03559e9b3c2fd55","src/linux/ioctl_s390xbe.rs":"2d8b265cd39a9f46816f83d5a5df0701c13eb842bc609325bad42ce50add3bf0","src/linux/ioctl_x86.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/ioctl_x86_64.rs":"f482a967c8006d0c34c03e9f2aeca4c4f426c5c27f7f930f3230129caf176060","src/linux/mod.rs":"446e435126d2a58f167f648dd95cba28e8ac9c17f1f799e1eaeab80ea800fc57","src/linux/monitor.rs":"57890c5f000829c5c0f44032fe5364126e60451605d517c79ba4d4fe4fd6c94b","src/linux/transaction.rs":"92b47d064c1fa5fe2674f65d06c519601480fc1c2b03667ade19a186a6ec9d13","src/macos/device.rs":"29863c88f851a957ec754f16aae6f789b300b00fcfe9a6c198a7cdcf1c9fcfe4","src/macos/iokit.rs":"a0fd818224718e96ad5d106dfc235f4bc9218a59f5114b9f9825abe3ee62bce7","src/macos/mod.rs":"333e561554fc901d4f6092f6e4c85823e2b0c4ff31c9188d0e6d542b71a0a07c","src/macos/monitor.rs":"d3a1dadfbfb5bfd665d75493d72bfbca3da9c43692262230f10d5feadb928e62","src/macos/transaction.rs":"cf2e67530401b0ef18e978557f470aa2661b3a5f4ef64cd3053d6e11f2f19b2b","src/manager.rs":"7428fc23038b004841936d8f27f8dc33234d5c06361efa75b73c7a5c035dae75","src/openbsd/device.rs":"b5de51a8b3ae0e542373a2064cff1ae6e1f91ac78e1406805d9ca8a05ce758c9","src/openbsd/mod.rs":"514274d414042ff84b3667a41a736e78581e22fda87ccc97c2bc05617e381a30","src/openbsd/monitor.rs":"953800ab8fd6adf5d70633059b20d2cf0f5a2701d92e58a06d1ec33208983bc4","src/openbsd/transaction.rs":"10be1ce983c72513fec57baaa6869ef02b9cdbd8ea66bb2dfe24d857faf054f5","src/statemachine.rs":"28477fba601f5086b85e911da1e4f04af3f0060329e6e0e1172b960f9c52fd41","src/stub/device.rs":"32e134fc8826667d16b02fe32831fc29f4d52d0a7a065d7d649c4a1c5faa0dcc","src/stub/mod.rs":"6a7fec504a52d403b0241b18cd8b95088a31807571f4c0a67e4055afc74f4453","src/stub/transaction.rs":"8655bc37b69c318ff0bc69a62fcb31820eb6ad7921a53e0cecffa15e80d97630","src/u2fhid-capi.h":"fc2575f720ab8f6bc0c523c57310f35c464576bd5150c3c2b1873d3abde5909b","src/u2fprotocol.rs":"77b6d5005d8b3d98cd96e480013c1e97155da5df3cf5e19819ee82ac8e3b6c7d","src/u2ftypes.rs":"cf972d805b15a95f4c18d556aa01660ce451f1d3bce1516b0ce73d17e73199aa","src/util.rs":"c517750c9bf00f44fb63cada8c40d0227a4d3765488499a1f4d3c0f01daa67a7","src/windows/device.rs":"86a6ecc239608977a963f375336780746e90e95c3eb9ff303347beb983c40ab6","src/windows/mod.rs":"218e7f2fe91ecb390c12bba5a5ffdad2c1f0b22861c937f4d386262e5b3dd617","src/windows/monitor.rs":"d8e8316e5bd9fc6ebed737bd8d6e0713c99287aca04f392f6319cdfd8576f754","src/windows/transaction.rs":"1b9a5af866048911ccaec8c94b698b28ae1b80e3d4842f9d6ed38462f459c796","src/windows/winapi.rs":"a4286fd5e8dcb178e37df512ba7752b2a3c38fe30e1176022767d2c05c242bf8"},"package":"ff593fb4dd388fe452c5e63d4d668699466bd46b571c4b852dfbca4bac8f0706"}
\ No newline at end of file
+{"files":{},"package":"ff593fb4dd388fe452c5e63d4d668699466bd46b571c4b852dfbca4bac8f0706"}
\ No newline at end of file

File Added: pkgsrc/www/firefox/patches/Attic/patch-third__party_rust_authenticator_src_lib.rs
$NetBSD: patch-third__party_rust_authenticator_src_lib.rs,v 1.1 2020/07/15 19:51:19 riastradh Exp $

Add NetBSD support for U2F.

--- third_party/rust/authenticator/src/lib.rs.orig	2020-07-08 19:27:16.000000000 +0000
+++ third_party/rust/authenticator/src/lib.rs
@@ -5,7 +5,7 @@
 #[macro_use]
 mod util;
 
-#[cfg(any(target_os = "linux", target_os = "freebsd"))]
+#[cfg(any(target_os = "linux", target_os = "freebsd", target_os = "netbsd"))]
 pub mod hidproto;
 
 #[cfg(any(target_os = "linux"))]
@@ -22,6 +22,10 @@ extern crate devd_rs;
 #[path = "freebsd/mod.rs"]
 pub mod platform;
 
+#[cfg(any(target_os = "netbsd"))]
+#[path = "netbsd/mod.rs"]
+pub mod platform;
+
 #[cfg(any(target_os = "openbsd"))]
 #[path = "openbsd/mod.rs"]
 pub mod platform;
@@ -41,6 +45,7 @@ pub mod platform;
     target_os = "linux",
     target_os = "freebsd",
     target_os = "openbsd",
+    target_os = "netbsd",
     target_os = "macos",
     target_os = "windows"
 )))]

File Added: pkgsrc/www/firefox/patches/Attic/patch-third__party_rust_authenticator_src_netbsd_device.rs
$NetBSD: patch-third__party_rust_authenticator_src_netbsd_device.rs,v 1.1 2020/07/15 19:51:19 riastradh Exp $

Add NetBSD support for U2F.

--- third_party/rust/authenticator/src/netbsd/device.rs.orig	2020-07-15 16:29:34.208835297 +0000
+++ third_party/rust/authenticator/src/netbsd/device.rs
@@ -0,0 +1,134 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+extern crate libc;
+
+use std::mem;
+use std::io::Read;
+use std::io::Write;
+use std::io;
+
+use consts::CID_BROADCAST;
+use consts::HID_RPT_SIZE;
+use platform::fd::Fd;
+use platform::uhid;
+use u2ftypes::U2FDevice;
+use util::io_err;
+
+#[derive(Debug)]
+pub struct Device {
+    fd: Fd,
+    cid: [u8; 4],
+}
+
+impl Device {
+    pub fn new(fd: Fd) -> io::Result<Self> {
+        Ok(Self { fd, cid: CID_BROADCAST })
+    }
+
+    pub fn is_u2f(&mut self) -> bool {
+        if !uhid::is_u2f_device(&self.fd) {
+            return false;
+        }
+        // This step is not strictly necessary -- NetBSD puts fido
+        // devices into raw mode automatically by default, but in
+        // principle that might change, and this serves as a test to
+        // verify that we're running on a kernel with support for raw
+        // mode at all so we don't get confused issuing writes that try
+        // to set the report descriptor rather than transfer data on
+        // the output interrupt pipe as we need.
+        match uhid::hid_set_raw(&self.fd, true) {
+            Ok(_) => (),
+            Err(_) => return false,
+        }
+        if let Err(_) = self.ping() {
+            return false;
+        }
+        true
+    }
+
+    fn ping(&mut self) -> io::Result<()> {
+        for i in 0..10 {
+            let mut buf = vec![0u8; 1 + HID_RPT_SIZE];
+
+            buf[0] = 0;         // report number
+            buf[1] = 0xff;      // CID_BROADCAST
+            buf[2] = 0xff;
+            buf[3] = 0xff;
+            buf[4] = 0xff;
+            buf[5] = 0x81;      // ping
+            buf[6] = 0;
+            buf[7] = 1;         // one byte
+
+            self.write(&buf[..])?;
+
+            // Wait for response
+            let mut pfd: libc::pollfd = unsafe { mem::zeroed() };
+            pfd.fd = self.fd.fileno;
+            pfd.events = libc::POLLIN;
+            let nfds = unsafe { libc::poll(&mut pfd, 1, 100) };
+            if nfds == -1 {
+                return Err(io::Error::last_os_error());
+            }
+            if nfds == 0 {
+                debug!("device timeout {}", i);
+                continue;
+            }
+
+            // Read response
+            self.read(&mut buf[..])?;
+
+            return Ok(());
+        }
+
+        Err(io_err("no response from device"))
+    }
+}
+
+impl PartialEq for Device {
+    fn eq(&self, other: &Device) -> bool {
+        self.fd == other.fd
+    }
+}
+
+impl Read for Device {
+    fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
+        let bufp = buf.as_mut_ptr() as *mut libc::c_void;
+        let nread = unsafe { libc::read(self.fd.fileno, bufp, buf.len()) };
+        if nread == -1 {
+            return Err(io::Error::last_os_error());
+        }
+        Ok(nread as usize)
+    }
+}
+
+impl Write for Device {
+    fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
+        // Always skip the first byte (report number)
+        let data = &buf[1..];
+        let data_ptr = data.as_ptr() as *const libc::c_void;
+        let nwrit = unsafe {
+            libc::write(self.fd.fileno, data_ptr, data.len())
+        };
+        if nwrit == -1 {
+            return Err(io::Error::last_os_error());
+        }
+        // Pretend we wrote the report number byte
+        Ok(nwrit as usize + 1)
+    }
+
+    fn flush(&mut self) -> io::Result<()> {
+        Ok(())
+    }
+}
+
+impl U2FDevice for Device {
+    fn get_cid<'a>(&'a self) -> &'a [u8; 4] {
+        &self.cid
+    }
+
+    fn set_cid(&mut self, cid: [u8; 4]) {
+        self.cid = cid;
+    }
+}

File Added: pkgsrc/www/firefox/patches/Attic/patch-third__party_rust_authenticator_src_netbsd_fd.rs
$NetBSD: patch-third__party_rust_authenticator_src_netbsd_fd.rs,v 1.1 2020/07/15 19:51:19 riastradh Exp $

Add NetBSD support for U2F.

--- third_party/rust/authenticator/src/netbsd/fd.rs.orig	2020-07-15 16:29:34.209237373 +0000
+++ third_party/rust/authenticator/src/netbsd/fd.rs
@@ -0,0 +1,47 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+extern crate libc;
+
+use std::ffi::CString;
+use std::io;
+use std::mem;
+use std::os::raw::c_int;
+use std::os::unix::io::RawFd;
+
+#[derive(Debug)]
+pub struct Fd {
+    pub fileno: RawFd,
+}
+
+impl Fd {
+    pub fn open(path: &str, flags: c_int) -> io::Result<Fd> {
+        let cpath = CString::new(path.as_bytes())?;
+        let rv = unsafe { libc::open(cpath.as_ptr(), flags) };
+        if rv == -1 {
+            return Err(io::Error::last_os_error());
+        }
+        Ok(Fd { fileno: rv })
+    }
+}
+
+impl Drop for Fd {
+    fn drop(&mut self) {
+        unsafe { libc::close(self.fileno) };
+    }
+}
+
+impl PartialEq for Fd {
+    fn eq(&self, other: &Fd) -> bool {
+        let mut st: libc::stat = unsafe { mem::zeroed() };
+        let mut sto: libc::stat = unsafe { mem::zeroed() };
+        if unsafe { libc::fstat(self.fileno, &mut st) } == -1 {
+            return false;
+        }
+        if unsafe { libc::fstat(other.fileno, &mut sto) } == -1 {
+            return false;
+        }
+        (st.st_dev == sto.st_dev) & (st.st_ino == sto.st_ino)
+    }
+}

File Added: pkgsrc/www/firefox/patches/Attic/patch-third__party_rust_authenticator_src_netbsd_mod.rs
$NetBSD: patch-third__party_rust_authenticator_src_netbsd_mod.rs,v 1.1 2020/07/15 19:51:19 riastradh Exp $

Add NetBSD support for U2F.

--- third_party/rust/authenticator/src/netbsd/mod.rs.orig	2020-07-15 16:29:34.210141360 +0000
+++ third_party/rust/authenticator/src/netbsd/mod.rs
@@ -0,0 +1,10 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+pub mod device;
+pub mod transaction;
+
+mod fd;
+mod monitor;
+mod uhid;

File Added: pkgsrc/www/firefox/patches/Attic/patch-third__party_rust_authenticator_src_netbsd_monitor.rs
$NetBSD: patch-third__party_rust_authenticator_src_netbsd_monitor.rs,v 1.1 2020/07/15 19:51:19 riastradh Exp $

Add NetBSD support for U2F.

--- third_party/rust/authenticator/src/netbsd/monitor.rs.orig	2020-07-15 16:29:34.210607689 +0000
+++ third_party/rust/authenticator/src/netbsd/monitor.rs
@@ -0,0 +1,89 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use std::collections::HashMap;
+use std::ffi::OsString;
+use std::io;
+use std::sync::Arc;
+use std::thread;
+use std::time::Duration;
+
+use runloop::RunLoop;
+
+use platform::fd::Fd;
+
+// XXX Should use drvctl, but it doesn't do pubsub properly yet so
+// DRVGETEVENT requires write access to /dev/drvctl.  Instead, for now,
+// just poll every 500ms.
+const POLL_TIMEOUT: u64 = 500;
+
+pub struct Monitor<F>
+where
+    F: Fn(Fd, &dyn Fn() -> bool) + Send + Sync + 'static,
+{
+    runloops: HashMap<OsString, RunLoop>,
+    new_device_cb: Arc<F>,
+}
+
+impl<F> Monitor<F>
+where
+    F: Fn(Fd, &dyn Fn() -> bool) + Send + Sync + 'static,
+{
+    pub fn new(new_device_cb: F) -> Self {
+        Self {
+            runloops: HashMap::new(),
+            new_device_cb: Arc::new(new_device_cb),
+        }
+    }
+
+    pub fn run(&mut self, alive: &dyn Fn() -> bool) -> io::Result<()> {
+        while alive() {
+            for n in 0..100 {
+                let uhidpath = format!("/dev/uhid{}", n);
+                match Fd::open(&uhidpath, libc::O_RDWR | libc::O_CLOEXEC) {
+                    Ok(uhid) => {
+                        self.add_device(uhid, OsString::from(&uhidpath));
+                    },
+                    Err(ref err) => {
+                        match err.raw_os_error() {
+                            Some(libc::EBUSY) => continue,
+                            Some(libc::ENOENT) => break,
+                            _ => self.remove_device(OsString::from(&uhidpath)),
+                        }
+                    },
+                }
+            }
+            thread::sleep(Duration::from_millis(POLL_TIMEOUT));
+        }
+        self.remove_all_devices();
+        Ok(())
+    }
+
+    fn add_device(&mut self, fd: Fd, path: OsString) {
+        let f = self.new_device_cb.clone();
+
+        let runloop = RunLoop::new(move |alive| {
+            if alive() {
+                f(fd, alive);
+            }
+        });
+
+        if let Ok(runloop) = runloop {
+            self.runloops.insert(path.clone(), runloop);
+        }
+    }
+
+    fn remove_device(&mut self, path: OsString) {
+        if let Some(runloop) = self.runloops.remove(&path) {
+            runloop.cancel();
+        }
+    }
+
+    fn remove_all_devices(&mut self) {
+        while !self.runloops.is_empty() {
+            let path = self.runloops.keys().next().unwrap().clone();
+            self.remove_device(path);
+        }
+    }
+}

File Added: pkgsrc/www/firefox/patches/Attic/patch-third__party_rust_authenticator_src_netbsd_transaction.rs
$NetBSD: patch-third__party_rust_authenticator_src_netbsd_transaction.rs,v 1.1 2020/07/15 19:51:19 riastradh Exp $

Add NetBSD support for U2F.

--- third_party/rust/authenticator/src/netbsd/transaction.rs.orig	2020-07-15 16:29:34.212621486 +0000
+++ third_party/rust/authenticator/src/netbsd/transaction.rs
@@ -0,0 +1,50 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+use runloop::RunLoop;
+use util::OnceCallback;
+
+use platform::fd::Fd;
+use platform::monitor::Monitor;
+
+pub struct Transaction {
+    // Handle to the thread loop.
+    thread: Option<RunLoop>,
+}
+
+impl Transaction {
+    pub fn new<F, T>(
+        timeout: u64,
+        callback: OnceCallback<T>,
+        new_device_cb: F,
+    ) -> Result<Self, ::Error>
+    where
+        F: Fn(Fd, &dyn Fn() -> bool) + Sync + Send + 'static,
+        T: 'static,
+    {
+        let thread = RunLoop::new_with_timeout(
+            move |alive| {
+                // Create a new device monitor.
+                let mut monitor = Monitor::new(new_device_cb);
+
+                // Start polling for new devices.
+                try_or!(monitor.run(alive), |_| callback.call(Err(::Error::Unknown)));
+
+                // Send an error, if the callback wasn't called already.
+                callback.call(Err(::Error::NotAllowed));
+            },
+            timeout,
+        )
+        .map_err(|_| ::Error::Unknown)?;
+
+        Ok(Self {
+            thread: Some(thread),
+        })
+    }
+
+    pub fn cancel(&mut self) {
+        // This must never be None.
+        self.thread.take().unwrap().cancel();
+    }
+}

File Added: pkgsrc/www/firefox/patches/Attic/patch-third__party_rust_authenticator_src_netbsd_uhid.rs
$NetBSD: patch-third__party_rust_authenticator_src_netbsd_uhid.rs,v 1.1 2020/07/15 19:51:19 riastradh Exp $

Add NetBSD support for U2F.

--- third_party/rust/authenticator/src/netbsd/uhid.rs.orig	2020-07-15 16:29:34.213005315 +0000
+++ third_party/rust/authenticator/src/netbsd/uhid.rs
@@ -0,0 +1,79 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+extern crate libc;
+
+use std::io;
+use std::mem;
+use std::os::raw::c_int;
+use std::os::raw::c_uchar;
+
+use hidproto::ReportDescriptor;
+use hidproto::has_fido_usage;
+use platform::fd::Fd;
+use util::io_err;
+
+/* sys/ioccom.h */
+
+const IOCPARM_MASK: u32 = 0x1fff;
+const IOCPARM_SHIFT: u32 = 16;
+const IOCGROUP_SHIFT: u32 = 8;
+
+//const IOC_VOID: u32 = 0x20000000;
+const IOC_OUT: u32 = 0x40000000;
+const IOC_IN: u32 = 0x80000000;
+//const IOC_INOUT: u32 = IOC_IN|IOC_OUT;
+
+macro_rules! ioctl {
+    ($dir:expr, $name:ident, $group:expr, $nr:expr, $ty:ty) => {
+        unsafe fn $name(fd: libc::c_int, val: *mut $ty)
+                -> io::Result<libc::c_int> {
+            let ioc = ($dir as u32)
+                | ((mem::size_of::<$ty>() as u32 & IOCPARM_MASK)
+                   << IOCPARM_SHIFT)
+                | (($group as u32) << IOCGROUP_SHIFT)
+                | ($nr as u32);
+            let rv = libc::ioctl(fd, ioc as libc::c_ulong, val);
+            if rv == -1 {
+                return Err(io::Error::last_os_error());
+            }
+            Ok(rv)
+        }
+    };
+}
+
+#[allow(non_camel_case_types)]
+#[repr(C)]
+struct usb_ctl_report_desc {
+    ucrd_size: c_int,
+    ucrd_data: [c_uchar; 1024],
+}
+
+ioctl!(IOC_OUT, usb_get_report_desc, b'U', 21, usb_ctl_report_desc);
+
+fn read_report_descriptor(fd: &Fd) -> io::Result<ReportDescriptor> {
+    let mut desc = unsafe { mem::zeroed() };
+    unsafe { usb_get_report_desc(fd.fileno, &mut desc) }?;
+    if desc.ucrd_size < 0 {
+        return Err(io_err("negative report descriptor size"));
+    }
+    let size = desc.ucrd_size as usize;
+    let value = Vec::from(&desc.ucrd_data[..size]);
+    Ok(ReportDescriptor { value })
+}
+
+pub fn is_u2f_device(fd: &Fd) -> bool {
+    match read_report_descriptor(fd) {
+        Ok(desc) => has_fido_usage(desc),
+        Err(_) => false,
+    }
+}
+
+ioctl!(IOC_IN, usb_hid_set_raw_ioctl, b'h', 2, c_int);
+
+pub fn hid_set_raw(fd: &Fd, raw: bool) -> io::Result<()> {
+    let mut raw_int: c_int = if raw { 1 } else { 0 };
+    unsafe { usb_hid_set_raw_ioctl(fd.fileno, &mut raw_int) }?;
+    Ok(())
+}