<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>DHKey Check failed after public key exchange</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/92675/dhkey-check-failed-after-public-key-exchange</link><description>Hello, 
 after upgrading to SDK15 and using the new crypto functionality I experience some weird behaviour during bonding. 
 Our SW is the peripheral and I am starting the Bonding by trying to read a protected characterisitc with the nrfConnect App on</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 24 Oct 2022 13:18:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/92675/dhkey-check-failed-after-public-key-exchange" /><item><title>RE: DHKey Check failed after public key exchange</title><link>https://devzone.nordicsemi.com/thread/392175?ContentTypeID=1</link><pubDate>Mon, 24 Oct 2022 13:18:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a53ca333-854b-4b85-8a88-b427057f63fd</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;You can also use Oberon as backend, after talking with a collegue he suggested adding the following to preprocessor:&lt;/p&gt;
&lt;p&gt;uECC_ENABLE_VLI_API=0&lt;br /&gt;uECC_OPTIMIZATION_LEVEL=3&lt;br /&gt;uECC_SQUARE_FUNC=0&lt;br /&gt;uECC_SUPPORT_COMPRESSED_POINT=0&lt;br /&gt;uECC_VLI_NATIVE_LITTLE_ENDIAN=1&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1666617459421v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;He believes it is related to endieness with micro-ecc.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DHKey Check failed after public key exchange</title><link>https://devzone.nordicsemi.com/thread/392143?ContentTypeID=1</link><pubDate>Mon, 24 Oct 2022 11:55:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8f55b9f1-7d6a-4aab-8671-fba633e67bc6</guid><dc:creator>Niclas Heitz</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;We tried compiling with 4.9 but it makes no difference.&lt;/p&gt;
&lt;p&gt;The hrs example we tried with CC310(default) and micro-ecc worked with CC310 but produced the same DHKeyFailure we encountered when using micro-ecc.&lt;/p&gt;
&lt;p&gt;We will try if it is possible for us to change to CC310 in our frmware but would be gratefull if you could still look into the issue with micro-ecc since this worked in previous versions for us.&lt;/p&gt;
&lt;p&gt;Thanks and best regards,&lt;/p&gt;
&lt;p&gt;Niclas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DHKey Check failed after public key exchange</title><link>https://devzone.nordicsemi.com/thread/391987?ContentTypeID=1</link><pubDate>Sun, 23 Oct 2022 12:02:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7d681533-d0d4-4011-875a-a0e905d9bba7</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Did you have a chance to try any of the other backends?&lt;/p&gt;
&lt;p&gt;Can you confirm you are using&amp;nbsp;the specific micro-ecc library mentioned in the documentation &amp;quot;Install version 4.9-2015-q3-update of the GCC compiler toolchain for ARM.&amp;quot;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DHKey Check failed after public key exchange</title><link>https://devzone.nordicsemi.com/thread/391843?ContentTypeID=1</link><pubDate>Fri, 21 Oct 2022 10:48:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9f0436f-1570-4f44-9364-6be768dee5c0</guid><dc:creator>Niclas Heitz</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;I modified the example to use micro-ecc with the same config we are using and now we get the same error here. I hope this can help identify the problem.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Niclas&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ble_5F00_app_5F00_hrs_5F00_modified.7z"&gt;devzone.nordicsemi.com/.../ble_5F00_app_5F00_hrs_5F00_modified.7z&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DHKey Check failed after public key exchange</title><link>https://devzone.nordicsemi.com/thread/391686?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2022 13:11:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c93bec91-8122-457b-9e40-9b6f2c9def4d</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;It should be possible to use the micro ecc backend by:&lt;br /&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/1385.pastedimage1666270886809v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;(I am using the cmsis configuration wizard here:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/sdk_config.html#sdk_config_overriding"&gt;https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/sdk_config.html#sdk_config_overriding&lt;/a&gt;)&lt;/p&gt;
&lt;p&gt;The example should support LESC, but since there are no specific services/characteristics in the HRS example that actually require security level, it may be that the peer don&amp;#39;t use the highest security level. So you may consider altering&amp;nbsp;services_init() to ensure the&amp;nbsp;SEC_JUST_WORKS.&lt;/p&gt;
&lt;p&gt;I think getting this to work first with the default example is valuable to understand the problem.&lt;/p&gt;
&lt;p&gt;I will take a look at the sniffer log now.&lt;/p&gt;
&lt;p&gt;Edit: I can see that the HRS example in nRF5 SDK v15.3 doesn&amp;#39;t handle&amp;nbsp;BLE_GAP_EVT_LESC_DHKEY_REQUEST no, this is however shown in later SDK&amp;#39;s. I can find that&amp;nbsp;BLE_GAP_EVT_LESC_DHKEY_REQUEST is handled in the&amp;nbsp;\experimental\ble_app_hrs_nfc_pairing in SDK v15.3. So that one is likely better to look at here.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Edit2: The sniffer log doesn&amp;#39;t show much information other than it fails, so I suggest I suggest to try the&amp;nbsp;&lt;span&gt;\experimental\ble_app_hrs_nfc_pairing example, hopefully comparing with that will reveal the issue.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Edit3: I suggest to use the&amp;nbsp;\experimental\ble_app_hrs_nfc_pairing with the default CC310 backend by default here, only changing to micro ecc when you have verified that work first.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DHKey Check failed after public key exchange</title><link>https://devzone.nordicsemi.com/thread/391648?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2022 12:10:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:edca718e-12fd-4e95-94af-df494966b025</guid><dc:creator>Niclas Heitz</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;the hrs example from 15.3 works, so I compared it and in the example I can see no init of the lesc module at all, which seems wrong to me. If I remove all init functions for the nrf_ble_lesc module and just call nrf_ble_lesc_request_handler in the main loop like the example i just get the BLE_GAP_SEC_STATUS_AUTH_REQ error instead.&lt;/p&gt;
&lt;p&gt;Also the Example usees NRF_CRYPTO_BACKEND_CC310_ENABLED while we use micro ecc&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here is the sniffer log of the original problem. We tested with different Android phones: Google Pixel 2, OnePlus A5010, Samsung S10+. The log is with OnePlus 8 Pro.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Pairing_5F00_Bonding_5F00_Failure_5F00_19_5F00_10_5F00_2022.cfa"&gt;devzone.nordicsemi.com/.../Pairing_5F00_Bonding_5F00_Failure_5F00_19_5F00_10_5F00_2022.cfa&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DHKey Check failed after public key exchange</title><link>https://devzone.nordicsemi.com/thread/391580?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2022 08:27:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:82e65fcc-59da-4faa-a361-2ad033d60c46</guid><dc:creator>Kenneth</dc:creator><description>[quote user="Niclas Heitz"]we updated to v15.3 and v6.1.1 but the error is still the same. Updating to v17.1 is not an option.[/quote]
&lt;p&gt;Have you tried any of the examples in v15.3 or 17.1 that support LESC out of the box, such as the heart rate sensor for test/comparison? To try to narrow down if there is an issue with the SDK or it&amp;#39;s entirely on the peer (phone) side?&lt;/p&gt;
[quote user="Niclas Heitz"]As you can see in the sniffer log, the error is happening on the Master side which is nrfConnect App for Android.[/quote]
&lt;p&gt;Can you share the entire sniffer log? The nRF Connect App doesn&amp;#39;t handle the bonding procedure, this is fully handled by the OS.&lt;/p&gt;
&lt;p&gt;Is the issue you see specific to one Android phone/version, or do you see this with several phone vendors (please share any phones you have tested that fail or success)?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DHKey Check failed after public key exchange</title><link>https://devzone.nordicsemi.com/thread/391578?ContentTypeID=1</link><pubDate>Thu, 20 Oct 2022 08:04:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da5af7c3-7fd3-4896-917c-880bfe5c449d</guid><dc:creator>Niclas Heitz</dc:creator><description>&lt;p&gt;Hello Kenneth,&lt;/p&gt;
&lt;p&gt;we updated to v15.3 and v6.1.1 but the error is still the same. Updating to v17.1 is not an option.&lt;/p&gt;
&lt;p&gt;As you can see in the sniffer log, the error is happening on the Master side which is nrfConnect App for Android.&lt;/p&gt;
&lt;p&gt;According to the Message Sequence Charts in the Infocenter this is what should happen on the Central&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1666250485352v2.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;We don&amp;#39;t even get to the passkey entry so I would assume it rejects the public key.&lt;/p&gt;
&lt;p&gt;With 15.3 we now only call nrf_ble_lesc_init() which initializes crypto and rng and generates the public key so i don&amp;#39;t see how we could do something wrong there.&lt;/p&gt;
&lt;p&gt;Maybe it&amp;#39;s something with the sdk_config which in my experience often causes strange behaviour without throwing errors if configured wrong so here are the relevant settings we enabled&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;#define NRF_BLE_LESC_ENABLED 1
#define PM_LESC_ENABLED 1
#define NRF_CRYPTO_ENABLED 1
#define NRF_CRYPTO_BACKEND_MICRO_ECC_ENABLED 1
#define NRF_CRYPTO_BACKEND_MICRO_ECC_ECC_SECP256R1_ENABLED 1
#define NRF_CRYPTO_BACKEND_NRF_HW_RNG_ENABLED 1
#define NRF_CRYPTO_BACKEND_NRF_HW_RNG_MBEDTLS_CTR_DRBG_ENABLED 1
#define NRF_CRYPTO_RNG_STATIC_MEMORY_BUFFERS_ENABLED 1
#define NRF_CRYPTO_RNG_AUTO_INIT_ENABLED 1&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks and best regards,&lt;/p&gt;
&lt;p&gt;Niclas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: DHKey Check failed after public key exchange</title><link>https://devzone.nordicsemi.com/thread/389953?ContentTypeID=1</link><pubDate>Mon, 10 Oct 2022 08:58:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b70b66c2-6fa5-4e07-ae71-dc86a26c139c</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Likely an issue with&amp;nbsp;nRF5 SDK or softdevice.&lt;/p&gt;
&lt;p&gt;It should be pretty straight forward to update to nRF5 SDK v15.3 and v6.1.1 softdevice, so I suggest that as a first step. If you still have issues I suggest trying the latest nRF5 SDK v17.1 and v7.3.0. For an overview see here:&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/comp_matrix_nrf52840/COMP/nrf52840/nRF52840_ic_rev_sdk_sd_comp_matrix.html"&gt;https://infocenter.nordicsemi.com/topic/comp_matrix_nrf52840/COMP/nrf52840/nRF52840_ic_rev_sdk_sd_comp_matrix.html&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>