<?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>Is there an example of how to use hardware cc310 on nrf52840 for sha-1</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43637/is-there-an-example-of-how-to-use-hardware-cc310-on-nrf52840-for-sha-1</link><description>I&amp;#39;m trying to get the code below to compile. One question is how to fill in the nrf_crypto_hash_info_t structure. Another issue is that the nrf crypto includes don&amp;#39;t compile using Crossworks gcc because malloc.h can&amp;#39;t be found (I don&amp;#39;t think malloc.h</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 14 Feb 2019 16:01:39 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43637/is-there-an-example-of-how-to-use-hardware-cc310-on-nrf52840-for-sha-1" /><item><title>RE: Is there an example of how to use hardware cc310 on nrf52840 for sha-1</title><link>https://devzone.nordicsemi.com/thread/171207?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 16:01:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3f5d3f80-477b-40e9-8ae9-46c0d4a85688</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;I missed that. &amp;nbsp;That did the trick! &amp;nbsp;Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an example of how to use hardware cc310 on nrf52840 for sha-1</title><link>https://devzone.nordicsemi.com/thread/171185?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 14:56:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ed8d4ba4-c304-422d-9325-e8eb342b6fc4</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Have you added &amp;#39;NVIC_EnableIRQ(CRYPTOCELL_IRQn);&amp;#39; anywhere before you enable the cryptocell? I see this is done in&amp;nbsp;integration_tests_setup() in the example in the SDK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an example of how to use hardware cc310 on nrf52840 for sha-1</title><link>https://devzone.nordicsemi.com/thread/170963?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 16:46:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6f0fa9b8-029e-4fa2-9b1b-076b0e317d05</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;Getting closer. &amp;nbsp;SaSi_LibInit and CRYS_HASH_Init return success. &amp;nbsp;Then the first call to&amp;nbsp;CRYS_HASH_Update appears to hang in&amp;nbsp;SaSi_HalWaitInterrupt according to the debugger. &amp;nbsp;Any idea why that might be?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;void fd_sha_initialize(void) {
    NRF_CRYPTOCELL-&amp;gt;ENABLE = 1;
    SA_SilibRetCode_t ret = SaSi_LibInit();
    fd_log_assert(ret == SA_SILIB_RET_OK);
}

void fd_sha1(fd_sha_source_t source, uint32_t address, uint32_t length, uint8_t *hash) {
    CRYS_HASHUserContext_t context;
    CRYSError_t ret = CRYS_HASH_Init(&amp;amp;context, CRYS_HASH_SHA1_mode);
    fd_log_assert(ret == CRYS_OK);
    uint8_t data[FD_SHA_BLOCK_SIZE];
    uint32_t remaining = length;
    while (remaining &amp;gt; 0) {
        uint32_t n = FD_SHA_BLOCK_SIZE;
        if (remaining &amp;lt; n) {
            n = remaining;
        }
        (*source)(address, data, n);
        ret = CRYS_HASH_Update(&amp;amp;context, data, n);
        fd_log_assert(ret == CRYS_OK);
        remaining -= n;
        address += n;
    }
    CRYS_HASH_Result_t result;
    ret = CRYS_HASH_Finish(&amp;amp;context, result);
    fd_log_assert(ret == CRYS_OK);
    memcpy(hash, result, FD_SHA_HASH_SIZE);
}&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an example of how to use hardware cc310 on nrf52840 for sha-1</title><link>https://devzone.nordicsemi.com/thread/170956?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 15:55:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2fde1af6-5b36-46e7-8285-81c5992f18e9</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;Removed more includes and can compile now. &amp;nbsp;Looks like I need to link with&lt;/p&gt;
&lt;p&gt;&lt;span&gt;external/nrf_cc310/lib/libnrf_cc310_0.9.10.a and I should be there.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an example of how to use hardware cc310 on nrf52840 for sha-1</title><link>https://devzone.nordicsemi.com/thread/170953?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 15:47:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c35acfe-570a-4830-81d5-b1695a577367</guid><dc:creator>denis</dc:creator><description>&lt;p&gt;Thanks for that info. &amp;nbsp;I&amp;#39;ve updated my code to use the CrypoCell API and it compiles now. &amp;nbsp;However, when including those headers it still seems to want to include the nrf_crypto apis and ends up with an error trying to include malloc.h. &amp;nbsp;Any ideas on how to not include that?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;pre&gt;void fd_sha_initialize(void) {
    SA_SilibRetCode_t ret = SaSi_LibInit();
    fd_log_assert(ret == SA_SILIB_RET_OK);
}

void fd_sha1(fd_sha1_source_t source, uint32_t address, uint32_t length, uint8_t *hash) {
    CRYS_HASHUserContext_t context;
    CRYSError_t ret = CRYS_HASH_Init(&amp;amp;context, CRYS_HASH_SHA1_mode);
    fd_log_assert(ret == CRYS_OK);
    uint8_t data[FD_SHA_BLOCK_SIZE];
    uint32_t remaining = length;
    while (remaining &amp;gt; 0) {
        uint32_t n = FD_SHA_BLOCK_SIZE;
        if (remaining &amp;lt; n) {
            n = remaining;
        }
        (*source)(address, data, n);
        ret = CRYS_HASH_Update(&amp;amp;context, data, n);
        fd_log_assert(ret == CRYS_OK);
        remaining -= n;
        address += n;
    }
    CRYS_HASH_Result_t result;
    ret = CRYS_HASH_Finish(&amp;amp;context, result);
    fd_log_assert(ret == CRYS_OK);
    memcpy(hash, result, FD_SHA_HASH_SIZE);
}&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Is there an example of how to use hardware cc310 on nrf52840 for sha-1</title><link>https://devzone.nordicsemi.com/thread/170815?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 10:09:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bbd11631-70cf-4c89-b865-ecd227442a5c</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Unfortunately, &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/lib_crypto?425#lib_crypto_intro_family_hash_support"&gt;SHA-1 hash is not supported in the nrf_crypto library&lt;/a&gt;, only SHA-256 and SHA-512 is supported. SHA-1 is old and not as secure as SHA-2, limiting its number of use-cases.&lt;/p&gt;
&lt;p&gt;If you want to do SHA-1, you need to use the CC310 API directly. See&amp;nbsp;&lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/group__crys__hash"&gt;CryptoCell HASH APIs&lt;/a&gt;&amp;nbsp;and&amp;nbsp;&lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/cryptocell_example"&gt;CryptoCell Integration Tests&lt;/a&gt;&amp;nbsp;examples.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>