mirror of
https://github.com/linuxboot/heads.git
synced 2024-12-18 20:47:55 +00:00
28fedf9a7e
Modeled after modules/tpmtotp, use a specific git commit hash for module libremkey-hotp-verification. Add hidapi as a submodule with dummy/placeholder in modules (like coreboot-blobs), also specified by git commit hash. Adjust libremkey-hotp-verification patch file name so patch applied properly. Addresses issue #640 Test: build Librem 13v4 Signed-off-by: Matt DeVillier <matt.devillier@puri.sm>
74 lines
2.6 KiB
Diff
74 lines
2.6 KiB
Diff
--- nitrokey-hotp-verification-a/Toolchain-heads.cmake 2018-05-22 09:55:46.907209235 -0700
|
|
+++ nitrokey-hotp-verification-b/Toolchain-heads.cmake 2018-05-22 09:55:26.659371966 -0700
|
|
@@ -0,0 +1,27 @@
|
|
+SET(CMAKE_SYSTEM_NAME Linux)
|
|
+SET(CMAKE_SYSTEM_VERSION 1)
|
|
+
|
|
+# Specify the cross compiler
|
|
+SET(CMAKE_C_COMPILER $ENV{CROSS}gcc)
|
|
+SET(CMAKE_CXX_COMPILER $ENV{CROSS}gcc)
|
|
+
|
|
+#sysroot location
|
|
+set(MYSYSROOT $ENV{INSTALL})
|
|
+
|
|
+# compiler/linker flags
|
|
+set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE)
|
|
+set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE)
|
|
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE)
|
|
+set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} --sysroot=${MYSYSROOT}" CACHE INTERNAL "" FORCE)
|
|
+
|
|
+# Where is the target environment
|
|
+SET(CMAKE_FIND_ROOT_PATH "${MYSYSROOT}")
|
|
+
|
|
+# Search for programs only in the build host directories
|
|
+SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
|
+
|
|
+# Search for libraries and headers only in the target directories
|
|
+SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
|
+SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
+
|
|
+INCLUDE_DIRECTORIES(hidapi)
|
|
--- libremkey-hotp-verification/device.c 2018-06-20 16:13:36.417804210 -0700
|
|
+++ libremkey-hotp-verification-b/device.c 2018-06-20 16:14:34.532367723 -0700
|
|
@@ -34,7 +34,7 @@
|
|
const unsigned short m_vid = 0x20a0;
|
|
const unsigned short m_pid = 0x4108;
|
|
|
|
-static const int CONNECTION_ATTEMPTS_COUNT = 80;
|
|
+static const int CONNECTION_ATTEMPTS_COUNT = 2;
|
|
|
|
static const int CONNECTION_ATTEMPT_DELAY_MICRO_SECONDS = 1000*1000/2;
|
|
|
|
--- libremkey-hotp-verification/libremkey_hotp_initialize
|
|
+++ libremkey-hotp-verification-b/libremkey_hotp_initialize
|
|
@@ -14,9 +14,9 @@ fi
|
|
PIN=$1
|
|
SECRET=$2
|
|
COUNTER=$3
|
|
-SECRET_B32=$(echo -n $SECRET | base32)
|
|
+SECRET_B32=$(cat $SECRET | base32)
|
|
|
|
-libremkey_hotp_verification set $SECRET_B32 $PIN
|
|
+libremkey_hotp_verification set $SECRET_B32 "$PIN"
|
|
if [ $? -ne 0 ]; then
|
|
echo "ERROR: Setting HOTP secret on Librem Key failed!"
|
|
exit 1
|
|
@@ -25,7 +25,7 @@ fi
|
|
i=9
|
|
while [ "$i" -lt "$COUNTER" ]; do
|
|
echo "Updating counter to $i"
|
|
- HOTP_CODE=$(echo $SECRET | hotp $i)
|
|
+ HOTP_CODE=$(hotp $i < $SECRET)
|
|
libremkey_hotp_verification check $HOTP_CODE > /dev/null
|
|
if [ $? -ne 0 ]; then
|
|
echo "HOTP check failed for counter=$i, code=$HOTP_CODE"
|
|
@@ -34,7 +34,7 @@ while [ "$i" -lt "$COUNTER" ]; do
|
|
let "i += 10"
|
|
done
|
|
|
|
-HOTP_CODE=$(echo $SECRET | hotp $COUNTER)
|
|
+HOTP_CODE=$(hotp $COUNTER < $SECRET)
|
|
libremkey_hotp_verification check $HOTP_CODE > /dev/null
|
|
if [ $? -ne 0 ]; then
|
|
echo "HOTP check failed for counter=$COUNTER, code=$HOTP_CODE"
|