Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend FIDO2 BLE support also for Linux #700

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Extend FIDO2 BLE support also for Linux
For Windows it was already added via gh#336,
so let's also add it for Linux.
Unpaired devices are ignored, the user has to pair independently
of libfido use using the bluetooth manager provided by the desktop
environment.
akemnade committed Jul 7, 2023
commit d3250c22b831ccc84d6eaba15987e1285a5d3999
2 changes: 1 addition & 1 deletion .github/workflows/alpine_builds.yml
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ jobs:
apk -q update
apk add build-base clang clang-analyzer cmake coreutils eudev-dev
apk add git linux-headers openssl-dev sudo zlib-dev pcsc-lite-dev \
libcbor-dev
libcbor-dev elogind-dev
- name: fix permissions on workdir
run: chown root:wheel "${GITHUB_WORKSPACE}"
- name: checkout libfido2
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ jobs:
run: |
sudo apt -q update
sudo apt install -q -y libcbor-dev libudev-dev libz-dev original-awk \
libpcsclite-dev
libpcsclite-dev libsystemd-dev
./.actions/build-linux-gcc
- name: perform codeql analysis
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
@@ -38,7 +38,7 @@ jobs:
run: |
sudo apt -q update
sudo apt install -q -y libcbor-dev libudev-dev libz-dev \
original-awk mandoc libpcsclite-dev
original-awk mandoc libpcsclite-dev libsystemd-dev
- name: compiler
env:
CC: ${{ matrix.cc }}
2 changes: 1 addition & 1 deletion .github/workflows/linux_fuzz.yml
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ jobs:
- name: dependencies
run: |
sudo apt -q update
sudo apt install -q -y libudev-dev libpcsclite-dev
sudo apt install -q -y libudev-dev libpcsclite-dev libsystemd-dev
- name: compiler
env:
CC: ${{ matrix.cc }}
2 changes: 1 addition & 1 deletion .github/workflows/openssl3.yml
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ jobs:
run: |
sudo apt -q update
sudo apt install -q -y libcbor-dev libudev-dev libz-dev \
original-awk mandoc libpcsclite-dev
original-awk mandoc libpcsclite-dev libsystemd-dev
sudo apt remove -y libssl-dev
if [ "${CC%-*}" == "clang" ]; then
sudo ./.actions/setup_clang "${CC}"
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ option(USE_HIDAPI "Use hidapi as the HID backend" OFF)
option(USE_PCSC "Enable experimental PCSC support" ON)
option(USE_WINHELLO "Abstract Windows Hello as a FIDO device" ON)
option(NFC_LINUX "Enable NFC support on Linux" ON)
option(BLE_LINUX "Enable Bluetooth support on Linux" ON)

add_definitions(-D_FIDO_MAJOR=${FIDO_MAJOR})
add_definitions(-D_FIDO_MINOR=${FIDO_MINOR})
@@ -216,6 +217,7 @@ if(MSVC)
add_definitions(-DUSE_WINHELLO)
endif()
set(NFC_LINUX OFF)
set(BLE_LINUX OFF)
else()
include(FindPkgConfig)
pkg_search_module(CBOR libcbor)
@@ -255,6 +257,7 @@ else()
endif()
else()
set(NFC_LINUX OFF)
set(BLE_LINUX OFF)
endif()

if(MINGW)
@@ -285,6 +288,11 @@ else()
add_definitions(-DUSE_NFC)
endif()

if(BLE_LINUX)
add_definitions(-DUSE_BLE)
pkg_search_module(BLE libsystemd REQUIRED)
endif()

if(WIN32)
if(USE_WINHELLO)
add_definitions(-DUSE_WINHELLO)
@@ -392,13 +400,15 @@ include_directories(${PROJECT_SOURCE_DIR}/src)
include_directories(${CBOR_INCLUDE_DIRS})
include_directories(${CRYPTO_INCLUDE_DIRS})
include_directories(${HIDAPI_INCLUDE_DIRS})
include_directories(${BLE_INCLUDE_DIRS})
include_directories(${PCSC_INCLUDE_DIRS})
include_directories(${UDEV_INCLUDE_DIRS})
include_directories(${ZLIB_INCLUDE_DIRS})

link_directories(${CBOR_LIBRARY_DIRS})
link_directories(${CRYPTO_LIBRARY_DIRS})
link_directories(${HIDAPI_LIBRARY_DIRS})
link_directories(${BLE_LIBRARY_DIRS})
link_directories(${PCSC_LIBRARY_DIRS})
link_directories(${UDEV_LIBRARY_DIRS})
link_directories(${ZLIB_LIBRARY_DIRS})
@@ -468,6 +478,7 @@ message(STATUS "USE_HIDAPI: ${USE_HIDAPI}")
message(STATUS "USE_PCSC: ${USE_PCSC}")
message(STATUS "USE_WINHELLO: ${USE_WINHELLO}")
message(STATUS "NFC_LINUX: ${NFC_LINUX}")
message(STATUS "BLE_LINUX: ${BLE_LINUX}")

if(BUILD_TESTS)
enable_testing()
5 changes: 5 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -51,6 +51,10 @@ if(FUZZ)
list(APPEND FIDO_SOURCES ../fuzz/wrap.c)
endif()

if(BLE_LINUX)
list(APPEND FIDO_SOURCES ble.c ble_linux.c)
endif()

if(NFC_LINUX)
list(APPEND FIDO_SOURCES netlink.c nfc.c nfc_linux.c)
endif()
@@ -123,6 +127,7 @@ list(APPEND TARGET_LIBRARIES
${HIDAPI_LIBRARIES}
${ZLIB_LIBRARIES}
${PCSC_LIBRARIES}
${BLE_LIBRARIES}
)

# static library
Loading