<?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>How do you check &amp;quot;App completes DHKey calculation&amp;quot;?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/80571/how-do-you-check-app-completes-dhkey-calculation</link><description>Hi, 
 We are using SDK13 and nrf52832. 
 I will use BLE security mode 1 level 4. 
 It is in progress referring to &amp;quot;ble_app_multirole_lesc&amp;quot;. 
 
 How do you check &amp;quot;App completes DHKey calculation&amp;quot;? 
 TIMEOUT occurs because that part cannot be identified</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 12 Oct 2021 11:57:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/80571/how-do-you-check-app-completes-dhkey-calculation" /><item><title>RE: How do you check "App completes DHKey calculation"?</title><link>https://devzone.nordicsemi.com/thread/333723?ContentTypeID=1</link><pubDate>Tue, 12 Oct 2021 11:57:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c5449741-cfa1-4f52-af64-efb2eb3dfc6d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Referring to the ble_app_multirole_lesc example in SDK 13 this happens in the handling of the&amp;nbsp;BLE_GAP_EVT_LESC_DHKEY_REQUEST event.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;        case BLE_GAP_EVT_LESC_DHKEY_REQUEST:
            NRF_LOG_INFO(&amp;quot;%s: BLE_GAP_EVT_LESC_DHKEY_REQUEST\r\n&amp;quot;, nrf_log_push(roles_str[role]));

            static nrf_value_length_t peer_public_key_raw = {0};

            peer_public_key_raw.p_value = &amp;amp;p_ble_evt-&amp;gt;evt.gap_evt.params.lesc_dhkey_request.p_pk_peer-&amp;gt;pk[0];
            peer_public_key_raw.length = BLE_GAP_LESC_P256_PK_LEN;

            err_code = nrf_crypto_ecc_public_key_from_raw(NRF_CRYPTO_BLE_ECDH_CURVE_INFO,
                                                          &amp;amp;peer_public_key_raw,
                                                          &amp;amp;m_peer_public_key);
            APP_ERROR_CHECK(err_code);

            err_code = nrf_crypto_ecdh_shared_secret_compute(NRF_CRYPTO_BLE_ECDH_CURVE_INFO,
                                                            &amp;amp;m_private_key,
                                                            &amp;amp;m_peer_public_key,
                                                            &amp;amp;m_dh_key);
            APP_ERROR_CHECK(err_code);

            err_code = sd_ble_gap_lesc_dhkey_reply(conn_handle, &amp;amp;m_lesc_dh_key);
            APP_ERROR_CHECK(err_code);
            break;
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Do you miss this in your implementation?&lt;/p&gt;
&lt;p&gt;By the way, note that this was changed in later SDK versions as it is a time consuming operation, and it makes sense to do this in the main loop rather than in an interrupt (which is the case in the SDK 13 example).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>