<p>Philipp Deppenwiese has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/22872">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">security/crypto: Add crypto primitives for hashing data<br><br>* Add crypto section to security directory.<br>* Add SHA1 and SHA256 hashing functionality.<br><br>Change-Id: I807084ebfffdc159fe95c45b4e5f0820bbfee5e1<br>Signed-off-by: Philipp Deppenwiese <zaolin@das-labor.org><br>---<br>M src/security/Kconfig<br>M src/security/Makefile.inc<br>A src/security/crypto/Kconfig<br>A src/security/crypto/Makefile.inc<br>A src/security/crypto/hash.h<br>A src/security/crypto/hash/hash.c<br>A src/security/crypto/hash/sha1.c<br>A src/security/crypto/hash/sha256.c<br>8 files changed, 515 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/72/22872/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/src/security/Kconfig b/src/security/Kconfig<br>index 6a334ac..9a07b5f 100644<br>--- a/src/security/Kconfig<br>+++ b/src/security/Kconfig<br>@@ -14,3 +14,4 @@<br> <br> source "src/security/vboot/Kconfig"<br> source "src/security/tpm/Kconfig"<br>+source "src/security/crypto/Kconfig"<br>diff --git a/src/security/Makefile.inc b/src/security/Makefile.inc<br>index a940b82..a941247 100644<br>--- a/src/security/Makefile.inc<br>+++ b/src/security/Makefile.inc<br>@@ -1,2 +1,3 @@<br> subdirs-y += vboot<br> subdirs-y += tpm<br>+subdirs-y += crypto<br>diff --git a/src/security/crypto/Kconfig b/src/security/crypto/Kconfig<br>new file mode 100644<br>index 0000000..5fbccd1<br>--- /dev/null<br>+++ b/src/security/crypto/Kconfig<br>@@ -0,0 +1,26 @@<br>+## This file is part of the coreboot project.<br>+##<br>+## Copyright (C) 2017 Philipp Deppenwiese, Facebook, Inc.<br>+##<br>+## This program is free software; you can redistribute it and/or modify<br>+## it under the terms of the GNU General Public License as published by<br>+## the Free Software Foundation; version 2 of the License.<br>+##<br>+## This program is distributed in the hope that it will be useful,<br>+## but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>+## GNU General Public License for more details.<br>+##<br>+<br>+menu "Cryptographic Primitives"<br>+<br>+config CRYPTO_HASH<br>+   bool "Enable hashing primitives"<br>+   default n<br>+    help<br>+   Enable this option to enable hashing support in coreboot.<br>+    SHA1 and SHA256 are currently supported.<br>+<br>+          If unsure, say N.<br>+<br>+endmenu # Cryptographic Primitives<br>diff --git a/src/security/crypto/Makefile.inc b/src/security/crypto/Makefile.inc<br>new file mode 100644<br>index 0000000..082f7b7<br>--- /dev/null<br>+++ b/src/security/crypto/Makefile.inc<br>@@ -0,0 +1,6 @@<br>+## crypto<br>+<br>+verstage-$(CONFIG_CRYPTO_HASH) += hash/hash.c hash/sha1.c hash/sha256.c<br>+romstage-$(CONFIG_CRYPTO_HASH) += hash/hash.c hash/sha1.c hash/sha256.c<br>+ramstage-$(CONFIG_CRYPTO_HASH) += hash/hash.c hash/sha1.c hash/sha256.c<br>+smm-$(CONFIG_CRYPTO_HASH) += hash/hash.c hash/sha1.c hash/sha256.c<br>diff --git a/src/security/crypto/hash.h b/src/security/crypto/hash.h<br>new file mode 100644<br>index 0000000..9a684e8<br>--- /dev/null<br>+++ b/src/security/crypto/hash.h<br>@@ -0,0 +1,36 @@<br>+/*<br>+ * This file is part of the coreboot project.<br>+ *<br>+ * Copyright 2017 Facebook Inc.<br>+ *<br>+ * This program is free software; you can redistribute it and/or modify<br>+ * it under the terms of the GNU General Public License as published by<br>+ * the Free Software Foundation; version 2 of the License.<br>+ *<br>+ * This program is distributed in the hope that it will be useful,<br>+ * but WITHOUT ANY WARRANTY; without even the implied warranty of<br>+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br>+ * GNU General Public License for more details.<br>+ */<br>+<br>+#include <stdint.h><br>+#include <stdlib.h><br>+#include <string.h><br>+<br>+#define SHA1_BLOCK_LEN 64 // In bytes<br>+#define SHA1_STATE_LEN 5  // In words<br>+<br>+#define SHA256_BLOCK_LEN 64 // In bytes<br>+#define SHA256_STATE_LEN 8  // In words<br>+<br>+#define UINT32_C(value) (value##UL)<br>+<br>+void sha1_hash(const uint8_t message[], size_t len,<br>+          uint32_t hash[static SHA1_STATE_LEN]);<br>+void sha1_compress(uint32_t state[static SHA1_STATE_LEN],<br>+               const uint8_t block[static SHA1_BLOCK_LEN]);<br>+<br>+void sha256_hash(const uint8_t message[], size_t len,<br>+            uint32_t hash[static SHA256_STATE_LEN]);<br>+void sha256_compress(uint32_t state[static SHA256_STATE_LEN],<br>+                 const uint8_t block[static SHA256_BLOCK_LEN]);<br>diff --git a/src/security/crypto/hash/hash.c b/src/security/crypto/hash/hash.c<br>new file mode 100644<br>index 0000000..32c4e27<br>--- /dev/null<br>+++ b/src/security/crypto/hash/hash.c<br>@@ -0,0 +1,93 @@<br>+/*<br>+ * SHA-1 hash in C and x86 assembly<br>+ * SHA-256 hash in C and x86 assembly<br>+ *<br>+ * Copyright (c) 2017 Project Nayuki. (MIT License)<br>+ * https://www.nayuki.io/page/fast-sha1-hash-implementation-in-x86-assembly<br>+ * https://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly<br>+ *<br>+ * Permission is hereby granted, free of charge, to any person obtaining a copy<br>+ * of this software and associated documentation files (the "Software"), to deal<br>+ * in the Software without restriction, including without limitation the rights<br>+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br>+ * copies of the Software, and to permit persons to whom the Software is<br>+ * furnished to do so, subject to the following conditions:<br>+ * - The above copyright notice and this permission notice shall be included in<br>+ *   all copies or substantial portions of the Software.<br>+ * - The Software is provided "as is", without warranty of any kind, express or<br>+ *   implied, including but not limited to the warranties of merchantability,<br>+ *   fitness for a particular purpose and noninfringement. In no event shall the<br>+ *   authors or copyright holders be liable for any claim, damages or other<br>+ *   liability, whether in an action of contract, tort or otherwise, arising<br>+ * from, out of or in connection with the Software or the use or other dealings<br>+ * in the Software.<br>+ */<br>+<br>+#include <security/crypto/hash.h><br>+<br>+#define LENGTH_SIZE 8 // In bytes<br>+<br>+void sha1_hash(const uint8_t message[], size_t len,<br>+            uint32_t hash[static SHA1_STATE_LEN])<br>+{<br>+     hash[0] = UINT32_C(0x67452301);<br>+      hash[1] = UINT32_C(0xEFCDAB89);<br>+      hash[2] = UINT32_C(0x98BADCFE);<br>+      hash[3] = UINT32_C(0x10325476);<br>+      hash[4] = UINT32_C(0xC3D2E1F0);<br>+<br>+   size_t off;<br>+  for (off = 0; len - off >= SHA1_BLOCK_LEN; off += SHA1_BLOCK_LEN)<br>+         sha1_compress(hash, &message[off]);<br>+<br>+   uint8_t block[SHA1_BLOCK_LEN] = {0};<br>+ size_t rem = len - off;<br>+      memcpy(block, &message[off], rem);<br>+<br>+    block[rem] = 0x80;<br>+   rem++;<br>+       if (SHA1_BLOCK_LEN - rem < LENGTH_SIZE) {<br>+         sha1_compress(hash, block);<br>+          memset(block, 0, sizeof(block));<br>+     }<br>+<br>+ block[SHA1_BLOCK_LEN - 1] = (uint8_t)((len & 0x1FU) << 3);<br>+ len >>= 5;<br>+     for (int i = 1; i < LENGTH_SIZE; i++, len >>= 8)<br>+            block[SHA1_BLOCK_LEN - 1 - i] = (uint8_t)(len & 0xFFU);<br>+  sha1_compress(hash, block);<br>+}<br>+<br>+void sha256_hash(const uint8_t message[], size_t len,<br>+            uint32_t hash[static SHA256_STATE_LEN])<br>+{<br>+ hash[0] = UINT32_C(0x6A09E667);<br>+      hash[1] = UINT32_C(0xBB67AE85);<br>+      hash[2] = UINT32_C(0x3C6EF372);<br>+      hash[3] = UINT32_C(0xA54FF53A);<br>+      hash[4] = UINT32_C(0x510E527F);<br>+      hash[5] = UINT32_C(0x9B05688C);<br>+      hash[6] = UINT32_C(0x1F83D9AB);<br>+      hash[7] = UINT32_C(0x5BE0CD19);<br>+<br>+   size_t off;<br>+  for (off = 0; len - off >= SHA256_BLOCK_LEN; off += SHA256_BLOCK_LEN)<br>+             sha256_compress(hash, &message[off]);<br>+<br>+ uint8_t block[SHA256_BLOCK_LEN] = {0};<br>+       size_t rem = len - off;<br>+      memcpy(block, &message[off], rem);<br>+<br>+    block[rem] = 0x80;<br>+   rem++;<br>+       if (SHA256_BLOCK_LEN - rem < LENGTH_SIZE) {<br>+               sha256_compress(hash, block);<br>+                memset(block, 0, sizeof(block));<br>+     }<br>+<br>+ block[SHA256_BLOCK_LEN - 1] = (uint8_t)((len & 0x1FU) << 3);<br>+       len >>= 5;<br>+     for (int i = 1; i < LENGTH_SIZE; i++, len >>= 8)<br>+            block[SHA256_BLOCK_LEN - 1 - i] = (uint8_t)(len & 0xFFU);<br>+        sha256_compress(hash, block);<br>+}<br>diff --git a/src/security/crypto/hash/sha1.c b/src/security/crypto/hash/sha1.c<br>new file mode 100644<br>index 0000000..3c35394<br>--- /dev/null<br>+++ b/src/security/crypto/hash/sha1.c<br>@@ -0,0 +1,153 @@<br>+/*<br>+ * SHA-1 hash in C<br>+ *<br>+ * Copyright (c) 2017 Project Nayuki. (MIT License)<br>+ * https://www.nayuki.io/page/fast-sha1-hash-implementation-in-x86-assembly<br>+ *<br>+ * Permission is hereby granted, free of charge, to any person obtaining a copy<br>+ * of this software and associated documentation files (the "Software"), to deal<br>+ * in the Software without restriction, including without limitation the rights<br>+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br>+ * copies of the Software, and to permit persons to whom the Software is<br>+ * furnished to do so, subject to the following conditions:<br>+ * - The above copyright notice and this permission notice shall be included in<br>+ *   all copies or substantial portions of the Software.<br>+ * - The Software is provided "as is", without warranty of any kind, express or<br>+ *   implied, including but not limited to the warranties of merchantability,<br>+ *   fitness for a particular purpose and noninfringement. In no event shall the<br>+ *   authors or copyright holders be liable for any claim, damages or other<br>+ *   liability, whether in an action of contract, tort or otherwise, arising<br>+ * from, out of or in connection with the Software or the use or other dealings<br>+ * in the Software.<br>+ */<br>+<br>+#include <security/crypto/hash.h><br>+<br>+#define ROTL32(x, n)                                                           \<br>+  (((0U + (x)) << (n)) |                                                 \<br>+        ((x) >> (32 - (n)))) // Assumes that x is uint32_t and 0 < n < 32<br>+<br>+#define LOADSCHEDULE(i)                                                        \<br>+ schedule[i] = (uint32_t)block[i * 4 + 0] << 24 |                       \<br>+                     (uint32_t)block[i * 4 + 1] << 16 |                       \<br>+                     (uint32_t)block[i * 4 + 2] << 8 |                        \<br>+                     (uint32_t)block[i * 4 + 3] << 0;<br>+<br>+#define SCHEDULE(i)                                                            \<br>+   temp = schedule[(i - 3) & 0xF] ^ schedule[(i - 8) & 0xF] ^             \<br>+            schedule[(i - 14) & 0xF] ^ schedule[(i - 16) & 0xF];            \<br>+     schedule[i & 0xF] = ROTL32(temp, 1);<br>+<br>+#define ROUND0a(a, b, c, d, e, i)                                              \<br>+       LOADSCHEDULE(i) ROUNDTAIL(a, b, e, ((b & c) | (~b & d)), i, 0x5A827999)<br>+#define ROUND0b(a, b, c, d, e, i)                                              \<br>+   SCHEDULE(i) ROUNDTAIL(a, b, e, ((b & c) | (~b & d)), i, 0x5A827999)<br>+#define ROUND1(a, b, c, d, e, i)                                               \<br>+       SCHEDULE(i) ROUNDTAIL(a, b, e, (b ^ c ^ d), i, 0x6ED9EBA1)<br>+#define ROUND2(a, b, c, d, e, i)                                               \<br>+        SCHEDULE(i)                                                            \<br>+     ROUNDTAIL(a, b, e, ((b & c) ^ (b & d) ^ (c & d)), i, 0x8F1BBCDC)<br>+#define ROUND3(a, b, c, d, e, i)                                               \<br>+      SCHEDULE(i) ROUNDTAIL(a, b, e, (b ^ c ^ d), i, 0xCA62C1D6)<br>+<br>+#define ROUNDTAIL(a, b, e, f, i, k)                                            \<br>+     e = 0U + e + ROTL32(a, 5) + f + UINT32_C(k) + schedule[i & 0xF];       \<br>+ b = ROTL32(b, 30);<br>+<br>+void sha1_compress(uint32_t state[static 5], const uint8_t block[static 64])<br>+{<br>+     uint32_t a = state[0];<br>+       uint32_t b = state[1];<br>+       uint32_t c = state[2];<br>+       uint32_t d = state[3];<br>+       uint32_t e = state[4];<br>+<br>+    uint32_t schedule[16];<br>+       uint32_t temp;<br>+       ROUND0a(a, b, c, d, e,  0)<br>+   ROUND0a(e, a, b, c, d,  1)<br>+   ROUND0a(d, e, a, b, c,  2)<br>+   ROUND0a(c, d, e, a, b,  3)<br>+   ROUND0a(b, c, d, e, a,  4)<br>+   ROUND0a(a, b, c, d, e,  5)<br>+   ROUND0a(e, a, b, c, d,  6)<br>+   ROUND0a(d, e, a, b, c,  7)<br>+   ROUND0a(c, d, e, a, b,  8)<br>+   ROUND0a(b, c, d, e, a,  9)<br>+   ROUND0a(a, b, c, d, e, 10)<br>+   ROUND0a(e, a, b, c, d, 11)<br>+   ROUND0a(d, e, a, b, c, 12)<br>+   ROUND0a(c, d, e, a, b, 13)<br>+   ROUND0a(b, c, d, e, a, 14)<br>+   ROUND0a(a, b, c, d, e, 15)<br>+   ROUND0b(e, a, b, c, d, 16)<br>+   ROUND0b(d, e, a, b, c, 17)<br>+   ROUND0b(c, d, e, a, b, 18)<br>+   ROUND0b(b, c, d, e, a, 19)<br>+   ROUND1(a, b, c, d, e, 20)<br>+    ROUND1(e, a, b, c, d, 21)<br>+    ROUND1(d, e, a, b, c, 22)<br>+    ROUND1(c, d, e, a, b, 23)<br>+    ROUND1(b, c, d, e, a, 24)<br>+    ROUND1(a, b, c, d, e, 25)<br>+    ROUND1(e, a, b, c, d, 26)<br>+    ROUND1(d, e, a, b, c, 27)<br>+    ROUND1(c, d, e, a, b, 28)<br>+    ROUND1(b, c, d, e, a, 29)<br>+    ROUND1(a, b, c, d, e, 30)<br>+    ROUND1(e, a, b, c, d, 31)<br>+    ROUND1(d, e, a, b, c, 32)<br>+    ROUND1(c, d, e, a, b, 33)<br>+    ROUND1(b, c, d, e, a, 34)<br>+    ROUND1(a, b, c, d, e, 35)<br>+    ROUND1(e, a, b, c, d, 36)<br>+    ROUND1(d, e, a, b, c, 37)<br>+    ROUND1(c, d, e, a, b, 38)<br>+    ROUND1(b, c, d, e, a, 39)<br>+    ROUND2(a, b, c, d, e, 40)<br>+    ROUND2(e, a, b, c, d, 41)<br>+    ROUND2(d, e, a, b, c, 42)<br>+    ROUND2(c, d, e, a, b, 43)<br>+    ROUND2(b, c, d, e, a, 44)<br>+    ROUND2(a, b, c, d, e, 45)<br>+    ROUND2(e, a, b, c, d, 46)<br>+    ROUND2(d, e, a, b, c, 47)<br>+    ROUND2(c, d, e, a, b, 48)<br>+    ROUND2(b, c, d, e, a, 49)<br>+    ROUND2(a, b, c, d, e, 50)<br>+    ROUND2(e, a, b, c, d, 51)<br>+    ROUND2(d, e, a, b, c, 52)<br>+    ROUND2(c, d, e, a, b, 53)<br>+    ROUND2(b, c, d, e, a, 54)<br>+    ROUND2(a, b, c, d, e, 55)<br>+    ROUND2(e, a, b, c, d, 56)<br>+    ROUND2(d, e, a, b, c, 57)<br>+    ROUND2(c, d, e, a, b, 58)<br>+    ROUND2(b, c, d, e, a, 59)<br>+    ROUND3(a, b, c, d, e, 60)<br>+    ROUND3(e, a, b, c, d, 61)<br>+    ROUND3(d, e, a, b, c, 62)<br>+    ROUND3(c, d, e, a, b, 63)<br>+    ROUND3(b, c, d, e, a, 64)<br>+    ROUND3(a, b, c, d, e, 65)<br>+    ROUND3(e, a, b, c, d, 66)<br>+    ROUND3(d, e, a, b, c, 67)<br>+    ROUND3(c, d, e, a, b, 68)<br>+    ROUND3(b, c, d, e, a, 69)<br>+    ROUND3(a, b, c, d, e, 70)<br>+    ROUND3(e, a, b, c, d, 71)<br>+    ROUND3(d, e, a, b, c, 72)<br>+    ROUND3(c, d, e, a, b, 73)<br>+    ROUND3(b, c, d, e, a, 74)<br>+    ROUND3(a, b, c, d, e, 75)<br>+    ROUND3(e, a, b, c, d, 76)<br>+    ROUND3(d, e, a, b, c, 77)<br>+    ROUND3(c, d, e, a, b, 78)<br>+    ROUND3(b, c, d, e, a, 79)<br>+<br>+ state[0] = 0U + state[0] + a;<br>+        state[1] = 0U + state[1] + b;<br>+        state[2] = 0U + state[2] + c;<br>+        state[3] = 0U + state[3] + d;<br>+        state[4] = 0U + state[4] + e;<br>+}<br>diff --git a/src/security/crypto/hash/sha256.c b/src/security/crypto/hash/sha256.c<br>new file mode 100644<br>index 0000000..b0a6bc8<br>--- /dev/null<br>+++ b/src/security/crypto/hash/sha256.c<br>@@ -0,0 +1,199 @@<br>+/*<br>+ * SHA-256 hash in C<br>+ *<br>+ * Copyright (c) 2017 Project Nayuki. (MIT License)<br>+ * https://www.nayuki.io/page/fast-sha2-hashes-in-x86-assembly<br>+ *<br>+ * Permission is hereby granted, free of charge, to any person obtaining a copy<br>+ * of this software and associated documentation files (the "Software"), to deal<br>+ * in the Software without restriction, including without limitation the rights<br>+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br>+ * copies of the Software, and to permit persons to whom the Software is<br>+ * furnished to do so, subject to the following conditions:<br>+ * - The above copyright notice and this permission notice shall be included in<br>+ *   all copies or substantial portions of the Software.<br>+ * - The Software is provided "as is", without warranty of any kind, express or<br>+ *   implied, including but not limited to the warranties of merchantability,<br>+ *   fitness for a particular purpose and noninfringement. In no event shall the<br>+ *   authors or copyright holders be liable for any claim, damages or other<br>+ *   liability, whether in an action of contract, tort or otherwise, arising<br>+ * from, out of or in connection with the Software or the use or other dealings<br>+ * in the Software.<br>+ */<br>+<br>+#include <security/crypto/hash.h><br>+<br>+#define ROTR32(x, n)                                                           \<br>+       (((0U + (x)) << (32 - (n))) |                                          \<br>+        ((x) >> (n))) // Assumes that x is uint32_t and 0 < n < 32<br>+<br>+#define LOADSCHEDULE(i)                                                        \<br>+        schedule[i] = (uint32_t)block[i * 4 + 0] << 24 |                       \<br>+                     (uint32_t)block[i * 4 + 1] << 16 |                       \<br>+                     (uint32_t)block[i * 4 + 2] << 8 |                        \<br>+                     (uint32_t)block[i * 4 + 3] << 0;<br>+<br>+#define SCHEDULE(i)                                                            \<br>+   schedule[i] =                                                          \<br>+         0U + schedule[i - 16] + schedule[i - 7] +                          \<br>+         (ROTR32(schedule[i - 15], 7) ^ ROTR32(schedule[i - 15], 18) ^      \<br>+          (schedule[i - 15] >> 3)) +                                        \<br>+           (ROTR32(schedule[i - 2], 17) ^ ROTR32(schedule[i - 2], 19) ^       \<br>+          (schedule[i - 2] >> 10));<br>+<br>+#define ROUND(a, b, c, d, e, f, g, h, i, k)                                    \<br>+   h = 0U + h + (ROTR32(e, 6) ^ ROTR32(e, 11) ^ ROTR32(e, 25)) +          \<br>+         (g ^ (e & (f ^ g))) + UINT32_C(k) + schedule[i];                   \<br>+ d = 0U + d + h;                                                        \<br>+     h = 0U + h + (ROTR32(a, 2) ^ ROTR32(a, 13) ^ ROTR32(a, 22)) +          \<br>+         ((a & (b | c)) | (b & c));<br>+<br>+void sha256_compress(uint32_t state[static 8], const uint8_t block[static 64])<br>+{<br>+       uint32_t schedule[64];<br>+       LOADSCHEDULE(0)<br>+      LOADSCHEDULE(1)<br>+      LOADSCHEDULE(2)<br>+      LOADSCHEDULE(3)<br>+      LOADSCHEDULE(4)<br>+      LOADSCHEDULE(5)<br>+      LOADSCHEDULE(6)<br>+      LOADSCHEDULE(7)<br>+      LOADSCHEDULE(8)<br>+      LOADSCHEDULE(9)<br>+      LOADSCHEDULE(10)<br>+     LOADSCHEDULE(11)<br>+     LOADSCHEDULE(12)<br>+     LOADSCHEDULE(13)<br>+     LOADSCHEDULE(14)<br>+     LOADSCHEDULE(15)<br>+     SCHEDULE(16)<br>+ SCHEDULE(17)<br>+ SCHEDULE(18)<br>+ SCHEDULE(19)<br>+ SCHEDULE(20)<br>+ SCHEDULE(21)<br>+ SCHEDULE(22)<br>+ SCHEDULE(23)<br>+ SCHEDULE(24)<br>+ SCHEDULE(25)<br>+ SCHEDULE(26)<br>+ SCHEDULE(27)<br>+ SCHEDULE(28)<br>+ SCHEDULE(29)<br>+ SCHEDULE(30)<br>+ SCHEDULE(31)<br>+ SCHEDULE(32)<br>+ SCHEDULE(33)<br>+ SCHEDULE(34)<br>+ SCHEDULE(35)<br>+ SCHEDULE(36)<br>+ SCHEDULE(37)<br>+ SCHEDULE(38)<br>+ SCHEDULE(39)<br>+ SCHEDULE(40)<br>+ SCHEDULE(41)<br>+ SCHEDULE(42)<br>+ SCHEDULE(43)<br>+ SCHEDULE(44)<br>+ SCHEDULE(45)<br>+ SCHEDULE(46)<br>+ SCHEDULE(47)<br>+ SCHEDULE(48)<br>+ SCHEDULE(49)<br>+ SCHEDULE(50)<br>+ SCHEDULE(51)<br>+ SCHEDULE(52)<br>+ SCHEDULE(53)<br>+ SCHEDULE(54)<br>+ SCHEDULE(55)<br>+ SCHEDULE(56)<br>+ SCHEDULE(57)<br>+ SCHEDULE(58)<br>+ SCHEDULE(59)<br>+ SCHEDULE(60)<br>+ SCHEDULE(61)<br>+ SCHEDULE(62)<br>+ SCHEDULE(63)<br>+<br>+      uint32_t a = state[0];<br>+       uint32_t b = state[1];<br>+       uint32_t c = state[2];<br>+       uint32_t d = state[3];<br>+       uint32_t e = state[4];<br>+       uint32_t f = state[5];<br>+       uint32_t g = state[6];<br>+       uint32_t h = state[7];<br>+       ROUND(a, b, c, d, e, f, g, h, 0, 0x428A2F98)<br>+ ROUND(h, a, b, c, d, e, f, g, 1, 0x71374491)<br>+ ROUND(g, h, a, b, c, d, e, f, 2, 0xB5C0FBCF)<br>+ ROUND(f, g, h, a, b, c, d, e, 3, 0xE9B5DBA5)<br>+ ROUND(e, f, g, h, a, b, c, d, 4, 0x3956C25B)<br>+ ROUND(d, e, f, g, h, a, b, c, 5, 0x59F111F1)<br>+ ROUND(c, d, e, f, g, h, a, b, 6, 0x923F82A4)<br>+ ROUND(b, c, d, e, f, g, h, a, 7, 0xAB1C5ED5)<br>+ ROUND(a, b, c, d, e, f, g, h, 8, 0xD807AA98)<br>+ ROUND(h, a, b, c, d, e, f, g, 9, 0x12835B01)<br>+ ROUND(g, h, a, b, c, d, e, f, 10, 0x243185BE)<br>+        ROUND(f, g, h, a, b, c, d, e, 11, 0x550C7DC3)<br>+        ROUND(e, f, g, h, a, b, c, d, 12, 0x72BE5D74)<br>+        ROUND(d, e, f, g, h, a, b, c, 13, 0x80DEB1FE)<br>+        ROUND(c, d, e, f, g, h, a, b, 14, 0x9BDC06A7)<br>+        ROUND(b, c, d, e, f, g, h, a, 15, 0xC19BF174)<br>+        ROUND(a, b, c, d, e, f, g, h, 16, 0xE49B69C1)<br>+        ROUND(h, a, b, c, d, e, f, g, 17, 0xEFBE4786)<br>+        ROUND(g, h, a, b, c, d, e, f, 18, 0x0FC19DC6)<br>+        ROUND(f, g, h, a, b, c, d, e, 19, 0x240CA1CC)<br>+        ROUND(e, f, g, h, a, b, c, d, 20, 0x2DE92C6F)<br>+        ROUND(d, e, f, g, h, a, b, c, 21, 0x4A7484AA)<br>+        ROUND(c, d, e, f, g, h, a, b, 22, 0x5CB0A9DC)<br>+        ROUND(b, c, d, e, f, g, h, a, 23, 0x76F988DA)<br>+        ROUND(a, b, c, d, e, f, g, h, 24, 0x983E5152)<br>+        ROUND(h, a, b, c, d, e, f, g, 25, 0xA831C66D)<br>+        ROUND(g, h, a, b, c, d, e, f, 26, 0xB00327C8)<br>+        ROUND(f, g, h, a, b, c, d, e, 27, 0xBF597FC7)<br>+        ROUND(e, f, g, h, a, b, c, d, 28, 0xC6E00BF3)<br>+        ROUND(d, e, f, g, h, a, b, c, 29, 0xD5A79147)<br>+        ROUND(c, d, e, f, g, h, a, b, 30, 0x06CA6351)<br>+        ROUND(b, c, d, e, f, g, h, a, 31, 0x14292967)<br>+        ROUND(a, b, c, d, e, f, g, h, 32, 0x27B70A85)<br>+        ROUND(h, a, b, c, d, e, f, g, 33, 0x2E1B2138)<br>+        ROUND(g, h, a, b, c, d, e, f, 34, 0x4D2C6DFC)<br>+        ROUND(f, g, h, a, b, c, d, e, 35, 0x53380D13)<br>+        ROUND(e, f, g, h, a, b, c, d, 36, 0x650A7354)<br>+        ROUND(d, e, f, g, h, a, b, c, 37, 0x766A0ABB)<br>+        ROUND(c, d, e, f, g, h, a, b, 38, 0x81C2C92E)<br>+        ROUND(b, c, d, e, f, g, h, a, 39, 0x92722C85)<br>+        ROUND(a, b, c, d, e, f, g, h, 40, 0xA2BFE8A1)<br>+        ROUND(h, a, b, c, d, e, f, g, 41, 0xA81A664B)<br>+        ROUND(g, h, a, b, c, d, e, f, 42, 0xC24B8B70)<br>+        ROUND(f, g, h, a, b, c, d, e, 43, 0xC76C51A3)<br>+        ROUND(e, f, g, h, a, b, c, d, 44, 0xD192E819)<br>+        ROUND(d, e, f, g, h, a, b, c, 45, 0xD6990624)<br>+        ROUND(c, d, e, f, g, h, a, b, 46, 0xF40E3585)<br>+        ROUND(b, c, d, e, f, g, h, a, 47, 0x106AA070)<br>+        ROUND(a, b, c, d, e, f, g, h, 48, 0x19A4C116)<br>+        ROUND(h, a, b, c, d, e, f, g, 49, 0x1E376C08)<br>+        ROUND(g, h, a, b, c, d, e, f, 50, 0x2748774C)<br>+        ROUND(f, g, h, a, b, c, d, e, 51, 0x34B0BCB5)<br>+        ROUND(e, f, g, h, a, b, c, d, 52, 0x391C0CB3)<br>+        ROUND(d, e, f, g, h, a, b, c, 53, 0x4ED8AA4A)<br>+        ROUND(c, d, e, f, g, h, a, b, 54, 0x5B9CCA4F)<br>+        ROUND(b, c, d, e, f, g, h, a, 55, 0x682E6FF3)<br>+        ROUND(a, b, c, d, e, f, g, h, 56, 0x748F82EE)<br>+        ROUND(h, a, b, c, d, e, f, g, 57, 0x78A5636F)<br>+        ROUND(g, h, a, b, c, d, e, f, 58, 0x84C87814)<br>+        ROUND(f, g, h, a, b, c, d, e, 59, 0x8CC70208)<br>+        ROUND(e, f, g, h, a, b, c, d, 60, 0x90BEFFFA)<br>+        ROUND(d, e, f, g, h, a, b, c, 61, 0xA4506CEB)<br>+        ROUND(c, d, e, f, g, h, a, b, 62, 0xBEF9A3F7)<br>+        ROUND(b, c, d, e, f, g, h, a, 63, 0xC67178F2)<br>+        state[0] = 0U + state[0] + a;<br>+        state[1] = 0U + state[1] + b;<br>+        state[2] = 0U + state[2] + c;<br>+        state[3] = 0U + state[3] + d;<br>+        state[4] = 0U + state[4] + e;<br>+        state[5] = 0U + state[5] + f;<br>+        state[6] = 0U + state[6] + g;<br>+        state[7] = 0U + state[7] + h;<br>+}<br></pre><p>To view, visit <a href="https://review.coreboot.org/22872">change 22872</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/22872"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I807084ebfffdc159fe95c45b4e5f0820bbfee5e1 </div>
<div style="display:none"> Gerrit-Change-Number: 22872 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Philipp Deppenwiese <zaolin.daisuki@gmail.com> </div>