<?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>Loaded malformed certificates and now bsdlib_init returns error on every boot</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/54338/loaded-malformed-certificates-and-now-bsdlib_init-returns-error-on-every-boot</link><description>We have possibly discovered a serious loophole that can brick a nRF9160 and will require JTAG to recover it. 
 We were loading a full set of certificates (CA, private, and cert), but due to a bug in our code accidentally provided a single-byte buffer</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Nov 2019 08:39:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/54338/loaded-malformed-certificates-and-now-bsdlib_init-returns-error-on-every-boot" /><item><title>RE: Loaded malformed certificates and now bsdlib_init returns error on every boot</title><link>https://devzone.nordicsemi.com/thread/220004?ContentTypeID=1</link><pubDate>Thu, 14 Nov 2019 08:39:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f410eac-88e3-4788-a175-d437f3da8737</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;First of all; thank you very much for evaluating the issue and reporting this back to us with this level of detail.&lt;/p&gt;
&lt;p&gt;I agree with you, this is frustrating, especially when the error is reported, but voided by the startup routine.&amp;nbsp; I&amp;#39;ll report this internally and have the bsdlib team evaluate what can be done in this scenario.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Loaded malformed certificates and now bsdlib_init returns error on every boot</title><link>https://devzone.nordicsemi.com/thread/219934?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 17:00:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc3d6516-c1f0-46ad-bc58-bd8a644f22a2</guid><dc:creator>jbrzozoski</dc:creator><description>&lt;p&gt;So, the error is less imposing than expected, but still frustrating.&lt;/p&gt;
&lt;p&gt;The modem still seems to be functional even though bsd_init() returns an error on boot.&amp;nbsp; If I ignore that result, all other functionality seems okay as long as I don&amp;#39;t try to use the bad credentials.&amp;nbsp; I can even use good credentials in security slots and use TLS connections.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t seem able to erase the bad credentials with nrf_inbuilt_key_delete, as it returns a result code of 5 (NRF_EIO), AT%CMNG is still able to do the job.&lt;/p&gt;
&lt;p&gt;And once I erase the bad certificates I am able to reboot and bsd_init will succeed.&lt;/p&gt;
&lt;p&gt;I think there needs to be some clarifications around which situation bsd_init can return failures and what functionality may or may not be usable at that point.&amp;nbsp; I also think the modem firmware might want to self-correct by deleting malformed certificates so that a subsequent reboot will not show the failure, or perhaps succeed at boot time but just refuse to use the bad certificate.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Loaded malformed certificates and now bsdlib_init returns error on every boot</title><link>https://devzone.nordicsemi.com/thread/219932?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 16:40:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dba8bdcf-7b2c-4deb-ad97-fd2d67aeeac4</guid><dc:creator>jbrzozoski</dc:creator><description>&lt;p&gt;at_client boots since it uses CONFIG_BSD_LIBRARY_SYS_INIT=y, and that &lt;strong&gt;ignores&lt;/strong&gt; the result code from bsd_init:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;	err = bsd_init();

	if (IS_ENABLED(CONFIG_BSD_LIBRARY_SYS_INIT)) {
		/* bsd_init() returns values from a different namespace
		 * than Zephyr&amp;#39;s. Make sure to return something in Zephyr&amp;#39;s
		 * namespace, in this case 0, when called during SYS_INIT.
		 * Non-zero values in SYS_INIT are currently ignored.
		 */
		return 0;
	}

	return err;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;So ... it appears the modem is actually running &amp;quot;well enough&amp;quot; even when bsd_init returns an error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Loaded malformed certificates and now bsdlib_init returns error on every boot</title><link>https://devzone.nordicsemi.com/thread/219931?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 16:31:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:275a36a1-146f-440e-a11e-0a08ebe3f2b6</guid><dc:creator>jbrzozoski</dc:creator><description>&lt;p&gt;Yeah, I can definitely re-create this by loading the malformed buffer.&amp;nbsp; (I thought I couldn&amp;#39;t briefly, but I had made a typo in my debug code.)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Loaded malformed certificates and now bsdlib_init returns error on every boot</title><link>https://devzone.nordicsemi.com/thread/219928?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 16:10:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef820c39-e353-4e61-a1ef-9e2f952d991b</guid><dc:creator>jbrzozoski</dc:creator><description>&lt;p&gt;For some reason I don&amp;#39;t understand yet, the at_client sample was able to get past bsd initialization okay, and I was able to remove the bad certificate store using AT%CMNG commands, and then reload my application and it is working again.&lt;/p&gt;
&lt;p&gt;Device un-bricked!&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not sure what&amp;#39;s different about how at_client calls bsd_init, and this still required JTAG on the board to recover.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m continuing to investigate...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Loaded malformed certificates and now bsdlib_init returns error on every boot</title><link>https://devzone.nordicsemi.com/thread/219927?ContentTypeID=1</link><pubDate>Wed, 13 Nov 2019 16:00:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b37e3d74-b191-4f69-ba8f-5dc4076fe3eb</guid><dc:creator>jbrzozoski</dc:creator><description>&lt;p&gt;I can&amp;#39;t recover my modem.&lt;/p&gt;
&lt;p&gt;I was able to reload mfwnrf9160101.zip just fine, but that didn&amp;#39;t resolve the issue.&lt;/p&gt;
&lt;p&gt;I then tried to load the special-built mfw_nrf9160_corrupt_fix.zip provided to me a while back, but that failed to load. I&amp;#39;m guessing that failed since it looks like a downgrade.&lt;/p&gt;
&lt;p&gt;Can I please get a corrupt_fix that will load on top of 1.0.1?&lt;/p&gt;
&lt;p&gt;Oh yeah, the initial issue was while running modem firmware v1.0.1.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>