.gear/42-pn5xx_i2c.rules | 1 + .gear/libnfc-nci.spec | 116 +++++++++++++++++++++ .gear/rules | 4 + .../tags/884e5b686322a5881114cfcd646bc4a4445b8639 | 6 ++ .gear/tags/list | 1 + configure.ac | 18 ++-- src/halimpl/pn54x/tml/i2c/phTmlNfc.c | 2 +- src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.h | 2 +- .../pn54x/tml/lpcusbsio/phTmlNfc_lpcusbsio.h | 2 +- src/libnfc-nci/nfc/cipher/cipher.c | 3 + src/libnfc-nci/nfc/include/cipher.h | 4 +- src/libnfc-nci/nfc/int/llcp_int.h | 2 +- src/libnfc-nci/nfc/llcp/llcp_api.c | 4 + src/libnfc-nci/nfc/llcp/llcp_dlc.c | 4 + src/libnfc-nci/nfc/llcp/llcp_link.c | 2 + src/service/extns/src/phNxpExtns.c | 2 +- 16 files changed, 157 insertions(+), 16 deletions(-) diff --git a/.gear/42-pn5xx_i2c.rules b/.gear/42-pn5xx_i2c.rules new file mode 100644 index 0000000..6c38d3a --- /dev/null +++ b/.gear/42-pn5xx_i2c.rules @@ -0,0 +1 @@ +ACTION=="add", KERNEL=="pn544", TAG+="uaccess" diff --git a/.gear/libnfc-nci.spec b/.gear/libnfc-nci.spec new file mode 100644 index 0000000..4c96de4 --- /dev/null +++ b/.gear/libnfc-nci.spec @@ -0,0 +1,116 @@ +%define _unpackaged_files_terminate_build 1 +%def_with secure_P2P +%def_without debug + +Name: libnfc-nci +Version: 2.4.1 +Release: alt1 + +Summary: Linux NFC stack for NCI based NXP NFC Controllers. +License: Apache-2.0 +Group: System/Libraries + +Url: https://www.nxp.com/docs/en/application-note/AN11697.pdf +# Git: https://github.com/NXPNFCLinux/linux_libnfc-nci +Source: %name-%version.tar +Source1: 42-pn5xx_i2c.rules + +Patch0: %name-%version-%release.patch + +# Automatically added by buildreq on Thu Jul 25 2019 +# optimized out: glibc-kernheaders-generic glibc-kernheaders-x86 gnu-config libstdc++-devel perl pkg-config python-base python-modules sh4 +BuildRequires: gcc-c++ + +%if_with secure_P2P +Buildrequires: libssl-devel +%endif + +%description +Linux NFC stack for NCI based NXP NFC Controllers. + +%package devel +Summary: Development libraries for libnfc-nci +Group: Development/C +Requires: %name = %version-%release +Requires: pkgconfig + +%description devel +The libnfc-nci-devel package contains header files necessary for +developing programs using libnfc-nci. + +%package example +Summary: Example using libnfc-nci +Group: System/Libraries +Requires: %name = %version-%release + +%description example +The libnfc-nci-example package contains example demonstrating the functionality +of libnfc-nci. + +%prep +%setup +%patch0 -p1 + +%build +./bootstrap + +%if_with secure_P2P +# use system openssl and therefore treat the path respectively +sed -i 's|-L\$(openssldir)/lib|-L\$(openssldir)/lib%_libsuff|g' Makefile.am +export openssldir=%_prefix +%endif + +%ifarch %e2k +# -std=c++03 by default as of lcc 1.23.20 +%add_optflags -std=c++11 +%endif + +export exec_prefix=%_prefix +%configure \ + --disable-static \ +%if_with debug + --enable-debug \ +%endif +%if_with secure_P2P + --enable-llcp1_3 \ +%endif + --enable-i2c + +%make_build + +%install +%makeinstall_std +find %buildroot -name '*.la' -delete +mv %buildroot%_sbindir %buildroot%_bindir +install -pDm644 %SOURCE1 %buildroot%_udevrulesdir/42-pn5xx_i2c.rules + +%files +%doc README.md LICENSE.txt +%config(noreplace) %_sysconfdir/libnfc-n*.conf +%_libdir/libnfc_nci_linux-1.so.* + +%files devel +%_libdir/libnfc_nci_linux.so +%_includedir/* +%_libdir/pkgconfig/*.pc +%doc doc/* + +%files example +%_bindir/* +# bring udev rule for NFC chip device node user access only for test purposes +%_udevrulesdir/*.rules + +%changelog +* Mon Dec 07 2020 Nikolai Kostrigin 2.4.1-alt1 +- fix FTBFS by GCC10 with default -fno-common +- switch to build from tag R2.4.1 which is exactly the same as R2.4+git20190613 +- fix license tag + +* Thu Nov 07 2019 Michael Shigorin 2.4-alt2.dev.git20190613 +- E2K: explicit -std=c++11 +- minor spec cleanup + +* Thu Jul 25 2019 Nikolai Kostrigin 2.4-alt1.dev.git20190613 +- initial build for OS ALT + + diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 0000000..22817ef --- /dev/null +++ b/.gear/rules @@ -0,0 +1,4 @@ +spec: .gear/libnfc-nci.spec +tar: R@version@:. +diff: R@version@:. . +copy?: .gear/*.rules diff --git a/.gear/tags/884e5b686322a5881114cfcd646bc4a4445b8639 b/.gear/tags/884e5b686322a5881114cfcd646bc4a4445b8639 new file mode 100644 index 0000000..5f70383 --- /dev/null +++ b/.gear/tags/884e5b686322a5881114cfcd646bc4a4445b8639 @@ -0,0 +1,6 @@ +object e035bc23782dd0a202211a0d7b30463c560b0caa +type commit +tag R2.4.1 +tagger Jeremy Geslin 1567755012 +0200 + +Intermediate release diff --git a/.gear/tags/list b/.gear/tags/list new file mode 100644 index 0000000..fd7c2eb --- /dev/null +++ b/.gear/tags/list @@ -0,0 +1 @@ +884e5b686322a5881114cfcd646bc4a4445b8639 R2.4.1 diff --git a/configure.ac b/configure.ac index 39a8d9a..14b6a61 100644 --- a/configure.ac +++ b/configure.ac @@ -59,13 +59,13 @@ AC_ARG_ENABLE([debug], if test "x$enable_debug" = xyes; then dnl Remove all optimization flags from CFLAGS changequote({,}) - CFLAGS=`echo "$CFLAGS" | $SED -e 's/-O[0-9s]*//g'` - CPPFLAGS=`echo "$CPPFLAGS" | $SED -e 's/-O[0-9s]*//g'` - CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-O[0-9s]*//g'` + CFLAGS=`echo "$CFLAGS" | $SED -e 's/[[:space:]]-O[0-9s]*//g'` + CPPFLAGS=`echo "$CPPFLAGS" | $SED -e 's/[[:space:]]-O[0-9s]*//g'` + CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/[[:space:]]-O[0-9s]*//g'` - CFLAGS=`echo "$CFLAGS" | $SED -e 's/-g[0-9]*//g'` - CPPFLAGS=`echo "$CPPFLAGS" | $SED -e 's/-g[0-9]*//g'` - CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-g[0-9]*//g'` + CFLAGS=`echo "$CFLAGS" | $SED -e 's/[[:space:]]-g[0-9]*//g'` + CPPFLAGS=`echo "$CPPFLAGS" | $SED -e 's/[[:space:]]-g[0-9]*//g'` + CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/[[:space:]]-g[0-9]*//g'` changequote([,]) CFLAGS="$CFLAGS -g -O0" @@ -75,9 +75,9 @@ if test "x$enable_debug" = xyes; then CXXFLAGS="$CXXFLAGS -g -O0" else changequote({,}) - CFLAGS=`echo "$CFLAGS" | $SED -e 's/-g[0-9]*//g'` - CPPFLAGS=`echo "$CPPFLAGS" | $SED -e 's/-g[0-9]*//g'` - CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/-g[0-9]*//g'` + CFLAGS=`echo "$CFLAGS" | $SED -e 's/[[:space:]]-g[0-9]*//g'` + CPPFLAGS=`echo "$CPPFLAGS" | $SED -e 's/[[:space:]]-g[0-9]*//g'` + CXXFLAGS=`echo "$CXXFLAGS" | $SED -e 's/[[:space:]]-g[0-9]*//g'` changequote([,]) fi diff --git a/src/halimpl/pn54x/tml/i2c/phTmlNfc.c b/src/halimpl/pn54x/tml/i2c/phTmlNfc.c index ef87c50..f102cad 100755 --- a/src/halimpl/pn54x/tml/i2c/phTmlNfc.c +++ b/src/halimpl/pn54x/tml/i2c/phTmlNfc.c @@ -45,7 +45,7 @@ static uint8_t bCurrentRetryCount = (2000 / PHTMLNFC_MAXTIME_RETRANSMIT) + 1; /* Initialize Context structure pointer used to access context structure */ phTmlNfc_Context_t *gpphTmlNfc_Context = NULL; -extern phTmlNfc_i2cfragmentation_t fragmentation_enabled = I2C_FRAGMENATATION_DISABLED; +phTmlNfc_i2cfragmentation_t fragmentation_enabled = I2C_FRAGMENATATION_DISABLED; /* Local Function prototypes */ static NFCSTATUS phTmlNfc_StartThread(void); static void phTmlNfc_CleanUp(void); diff --git a/src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.h b/src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.h index 724a2bd..dd1ed8f 100644 --- a/src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.h +++ b/src/halimpl/pn54x/tml/i2c/phTmlNfc_i2c.h @@ -29,4 +29,4 @@ int phTmlNfc_i2c_read(void *pDevHandle, uint8_t * pBuffer, int nNbBytesToRead); int phTmlNfc_i2c_write(void *pDevHandle,uint8_t * pBuffer, int nNbBytesToWrite); int phTmlNfc_i2c_reset(void *pDevHandle,long level); bool_t getDownloadFlag(void); -phTmlNfc_i2cfragmentation_t fragmentation_enabled; +extern phTmlNfc_i2cfragmentation_t fragmentation_enabled; diff --git a/src/halimpl/pn54x/tml/lpcusbsio/phTmlNfc_lpcusbsio.h b/src/halimpl/pn54x/tml/lpcusbsio/phTmlNfc_lpcusbsio.h index 724a2bd..dd1ed8f 100644 --- a/src/halimpl/pn54x/tml/lpcusbsio/phTmlNfc_lpcusbsio.h +++ b/src/halimpl/pn54x/tml/lpcusbsio/phTmlNfc_lpcusbsio.h @@ -29,4 +29,4 @@ int phTmlNfc_i2c_read(void *pDevHandle, uint8_t * pBuffer, int nNbBytesToRead); int phTmlNfc_i2c_write(void *pDevHandle,uint8_t * pBuffer, int nNbBytesToWrite); int phTmlNfc_i2c_reset(void *pDevHandle,long level); bool_t getDownloadFlag(void); -phTmlNfc_i2cfragmentation_t fragmentation_enabled; +extern phTmlNfc_i2cfragmentation_t fragmentation_enabled; diff --git a/src/libnfc-nci/nfc/cipher/cipher.c b/src/libnfc-nci/nfc/cipher/cipher.c index 899fc34..39cd6eb 100644 --- a/src/libnfc-nci/nfc/cipher/cipher.c +++ b/src/libnfc-nci/nfc/cipher/cipher.c @@ -31,6 +31,9 @@ #if(NFC_NXP_LLCP_SECURED_P2P == TRUE) #include "cipher.h" +tCIPHER_SUITE cipher_suite; +tECDH_KEY ecdh_key; + void cipher_init() { diff --git a/src/libnfc-nci/nfc/include/cipher.h b/src/libnfc-nci/nfc/include/cipher.h index 5167de2..87b7187 100644 --- a/src/libnfc-nci/nfc/include/cipher.h +++ b/src/libnfc-nci/nfc/include/cipher.h @@ -79,7 +79,7 @@ typedef struct { UINT32 packet_counter_recv; } tCIPHER_SUITE; -tCIPHER_SUITE cipher_suite; +extern tCIPHER_SUITE cipher_suite; typedef struct { EC_KEY* privKey_local; @@ -96,7 +96,7 @@ typedef struct { CMAC_CTX* cctx; EVP_CIPHER_CTX* ccmctx; }tECDH_KEY; -tECDH_KEY ecdh_key; +extern tECDH_KEY ecdh_key; void cipher_init(void); void cipher_deinit(void); diff --git a/src/libnfc-nci/nfc/int/llcp_int.h b/src/libnfc-nci/nfc/int/llcp_int.h index 379e1f0..ae75f3e 100644 --- a/src/libnfc-nci/nfc/int/llcp_int.h +++ b/src/libnfc-nci/nfc/int/llcp_int.h @@ -74,7 +74,7 @@ typedef struct { BOOLEAN p2p_flag; /* p2p flag */ BT_HDR *dps_msg; /* dps message */ } tLLCP_SECURED; -tLLCP_SECURED llcp_secured; +extern tLLCP_SECURED llcp_secured; #endif diff --git a/src/libnfc-nci/nfc/llcp/llcp_api.c b/src/libnfc-nci/nfc/llcp/llcp_api.c index 70cb03f..82fe74b 100644 --- a/src/libnfc-nci/nfc/llcp/llcp_api.c +++ b/src/libnfc-nci/nfc/llcp/llcp_api.c @@ -50,6 +50,10 @@ #include "llcp_int.h" #include "llcp_defs.h" +#if(NFC_NXP_LLCP_SECURED_P2P == TRUE) +tLLCP_SECURED llcp_secured; +#endif + #if (LLCP_TEST_INCLUDED == TRUE) /* this is for LLCP testing */ tLLCP_TEST_PARAMS llcp_test_params = diff --git a/src/libnfc-nci/nfc/llcp/llcp_dlc.c b/src/libnfc-nci/nfc/llcp/llcp_dlc.c index 9091679..9ad4503 100644 --- a/src/libnfc-nci/nfc/llcp/llcp_dlc.c +++ b/src/libnfc-nci/nfc/llcp/llcp_dlc.c @@ -31,6 +31,10 @@ #include "llcp_defs.h" #include "nfc_int.h" +#if (NFC_NXP_LLCP_SECURED_P2P == TRUE) +extern tLLCP_SECURED llcp_secured; +#endif + static tLLCP_STATUS llcp_dlsm_idle (tLLCP_DLCB *p_dlcb, tLLCP_DLC_EVENT event, void *p_data); static tLLCP_STATUS llcp_dlsm_w4_remote_resp (tLLCP_DLCB *p_dlcb, tLLCP_DLC_EVENT event, void *p_data); static tLLCP_STATUS llcp_dlsm_w4_local_resp (tLLCP_DLCB *p_dlcb, tLLCP_DLC_EVENT event, void *p_data); diff --git a/src/libnfc-nci/nfc/llcp/llcp_link.c b/src/libnfc-nci/nfc/llcp/llcp_link.c index f6fba0f..d78b137 100644 --- a/src/libnfc-nci/nfc/llcp/llcp_link.c +++ b/src/libnfc-nci/nfc/llcp/llcp_link.c @@ -153,6 +153,8 @@ static void llcp_link_stop_inactivity_timer (void) } #if(NFC_NXP_LLCP_SECURED_P2P == TRUE) + +extern tLLCP_SECURED llcp_secured; /******************************************************************************* ** ** Function llcp_link_start_dpspdu_timer diff --git a/src/service/extns/src/phNxpExtns.c b/src/service/extns/src/phNxpExtns.c index 3ceae90..30c2272 100644 --- a/src/service/extns/src/phNxpExtns.c +++ b/src/service/extns/src/phNxpExtns.c @@ -25,7 +25,7 @@ #include #include -phNxpExtns_Context_t gphNxpExtns_Context; +extern phNxpExtns_Context_t gphNxpExtns_Context; extern phFriNfc_NdefMap_t *NdefMap; extern phNci_mfc_auth_cmd_t gAuthCmdBuf;