From: Kim Phillips Date: Mon, 4 Mar 2013 16:08:34 -0600 Subject: [U-Boot] [PATCH 1/4 v3] Exynos: Add hardware accelerated SHA 256 In-Reply-To: <1362154585-16216-2-git-send-email-akshay.s@samsung.com> References: <1362154585-16216-1-git-send-email-akshay.s@samsung.com> <1362154585-16216-2-git-send-email-akshay.s@samsung.com> Message-ID: <20130304160834.46d570a0612aa6344b3f3248@freescale.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Fri, 1 Mar 2013 11:16:22 -0500 Akshay Saraswat wrote: > SHA-256 and SHA-1 accelerated using ACE hardware. curious about the rationale: how much faster is this than software? > --- > Changes since v2: > - Added falling back to software sha256 in case length exceeds buffer limit. > - Reduced one tab at lines 533, 559 and 571 in this patch. > - Removed space after a cast at line 506 in this patch. > - Removed blank line at line 561 in this patch. > - Removed space before semicolon at line 576 in this patch. you should retain the list of changes since v1 here. Read: http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions > +/* Hash status */ > +#define ACE_HASH_BUFRDY_MASK (1 << 0) > +#define ACE_HASH_BUFRDY_OFF (0 << 0) > +#define ACE_HASH_BUFRDY_ON (1 << 0) > +#define ACE_HASH_SEEDSETTING_MASK (1 << 1) > +#define ACE_HASH_SEEDSETTING_OFF (0 << 1) > +#define ACE_HASH_SEEDSETTING_ON (1 << 1) > +#define ACE_HASH_PRNGBUSY_MASK (1 << 2) > +#define ACE_HASH_PRNGBUSY_OFF (0 << 2) > +#define ACE_HASH_PRNGBUSY_ON (1 << 2) > +#define ACE_HASH_PARTIALDONE_MASK (1 << 4) > +#define ACE_HASH_PARTIALDONE_OFF (0 << 4) > +#define ACE_HASH_PARTIALDONE_ON (1 << 4) based on the nomenclature of the above definitions, this hardware obviously has support for breaking up hash requests into multiple buffer submissions, so do that, and not this: > + } else if (buf_len > BUF_LIMIT) { > + /* > + * ACE H/W cannot compute hash value for buffer > 8 MB. > + * Falling back to software. > + */ > + if (hash_type == ACE_SHA_TYPE_SHA1) > + sha1_csum_wd(pbuf, buf_len, pout, CHUNKSZ_SHA1); > + else > + sha256_csum_wd(pbuf, buf_len, pout, CHUNKSZ_SHA256); > + return 0; > + } Kim