• Home
  • Raw
  • Download

Lines Matching +full:a +full:- +full:h

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * SHA-256, as specified in
4 * http://csrc.nist.gov/groups/STM/cavp/documents/shs/sha256-384-512.pdf
6 * SHA-256 code by Jean-Luc Cooke <jlcooke@certainkey.com>.
8 * Copyright (c) Jean-Luc Cooke <jlcooke@certainkey.com>
14 #include <linux/bitops.h>
15 #include <linux/export.h>
16 #include <linux/module.h>
17 #include <linux/string.h>
18 #include <crypto/sha.h>
19 #include <asm/unaligned.h>
43 W[I] = s1(W[I-2]) + W[I-7] + s0(W[I-15]) + W[I-16]; in BLEND_OP()
48 u32 a, b, c, d, e, f, g, h, t1, t2; in sha256_transform() local
61 a = state[0]; b = state[1]; c = state[2]; d = state[3]; in sha256_transform()
62 e = state[4]; f = state[5]; g = state[6]; h = state[7]; in sha256_transform()
65 t1 = h + e1(e) + Ch(e, f, g) + 0x428a2f98 + W[0]; in sha256_transform()
66 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1 + t2; in sha256_transform()
68 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1 + t2; in sha256_transform()
70 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1 + t2; in sha256_transform()
72 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1 + t2; in sha256_transform()
73 t1 = d + e1(a) + Ch(a, b, c) + 0x3956c25b + W[4]; in sha256_transform()
74 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1 + t2; in sha256_transform()
75 t1 = c + e1(h) + Ch(h, a, b) + 0x59f111f1 + W[5]; in sha256_transform()
77 t1 = b + e1(g) + Ch(g, h, a) + 0x923f82a4 + W[6]; in sha256_transform()
79 t1 = a + e1(f) + Ch(f, g, h) + 0xab1c5ed5 + W[7]; in sha256_transform()
80 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1 + t2; in sha256_transform()
82 t1 = h + e1(e) + Ch(e, f, g) + 0xd807aa98 + W[8]; in sha256_transform()
83 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1 + t2; in sha256_transform()
85 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1 + t2; in sha256_transform()
87 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1 + t2; in sha256_transform()
89 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1 + t2; in sha256_transform()
90 t1 = d + e1(a) + Ch(a, b, c) + 0x72be5d74 + W[12]; in sha256_transform()
91 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1 + t2; in sha256_transform()
92 t1 = c + e1(h) + Ch(h, a, b) + 0x80deb1fe + W[13]; in sha256_transform()
94 t1 = b + e1(g) + Ch(g, h, a) + 0x9bdc06a7 + W[14]; in sha256_transform()
96 t1 = a + e1(f) + Ch(f, g, h) + 0xc19bf174 + W[15]; in sha256_transform()
97 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1 + t2; in sha256_transform()
99 t1 = h + e1(e) + Ch(e, f, g) + 0xe49b69c1 + W[16]; in sha256_transform()
100 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1 + t2; in sha256_transform()
102 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1 + t2; in sha256_transform()
104 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1 + t2; in sha256_transform()
106 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1 + t2; in sha256_transform()
107 t1 = d + e1(a) + Ch(a, b, c) + 0x2de92c6f + W[20]; in sha256_transform()
108 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1 + t2; in sha256_transform()
109 t1 = c + e1(h) + Ch(h, a, b) + 0x4a7484aa + W[21]; in sha256_transform()
111 t1 = b + e1(g) + Ch(g, h, a) + 0x5cb0a9dc + W[22]; in sha256_transform()
113 t1 = a + e1(f) + Ch(f, g, h) + 0x76f988da + W[23]; in sha256_transform()
114 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1 + t2; in sha256_transform()
116 t1 = h + e1(e) + Ch(e, f, g) + 0x983e5152 + W[24]; in sha256_transform()
117 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1 + t2; in sha256_transform()
119 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1 + t2; in sha256_transform()
121 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1 + t2; in sha256_transform()
123 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1 + t2; in sha256_transform()
124 t1 = d + e1(a) + Ch(a, b, c) + 0xc6e00bf3 + W[28]; in sha256_transform()
125 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1 + t2; in sha256_transform()
126 t1 = c + e1(h) + Ch(h, a, b) + 0xd5a79147 + W[29]; in sha256_transform()
128 t1 = b + e1(g) + Ch(g, h, a) + 0x06ca6351 + W[30]; in sha256_transform()
130 t1 = a + e1(f) + Ch(f, g, h) + 0x14292967 + W[31]; in sha256_transform()
131 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1 + t2; in sha256_transform()
133 t1 = h + e1(e) + Ch(e, f, g) + 0x27b70a85 + W[32]; in sha256_transform()
134 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1 + t2; in sha256_transform()
136 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1 + t2; in sha256_transform()
138 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1 + t2; in sha256_transform()
140 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1 + t2; in sha256_transform()
141 t1 = d + e1(a) + Ch(a, b, c) + 0x650a7354 + W[36]; in sha256_transform()
142 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1 + t2; in sha256_transform()
143 t1 = c + e1(h) + Ch(h, a, b) + 0x766a0abb + W[37]; in sha256_transform()
145 t1 = b + e1(g) + Ch(g, h, a) + 0x81c2c92e + W[38]; in sha256_transform()
147 t1 = a + e1(f) + Ch(f, g, h) + 0x92722c85 + W[39]; in sha256_transform()
148 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1 + t2; in sha256_transform()
150 t1 = h + e1(e) + Ch(e, f, g) + 0xa2bfe8a1 + W[40]; in sha256_transform()
151 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1 + t2; in sha256_transform()
153 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1 + t2; in sha256_transform()
155 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1 + t2; in sha256_transform()
157 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1 + t2; in sha256_transform()
158 t1 = d + e1(a) + Ch(a, b, c) + 0xd192e819 + W[44]; in sha256_transform()
159 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1 + t2; in sha256_transform()
160 t1 = c + e1(h) + Ch(h, a, b) + 0xd6990624 + W[45]; in sha256_transform()
162 t1 = b + e1(g) + Ch(g, h, a) + 0xf40e3585 + W[46]; in sha256_transform()
164 t1 = a + e1(f) + Ch(f, g, h) + 0x106aa070 + W[47]; in sha256_transform()
165 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1 + t2; in sha256_transform()
167 t1 = h + e1(e) + Ch(e, f, g) + 0x19a4c116 + W[48]; in sha256_transform()
168 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1 + t2; in sha256_transform()
170 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1 + t2; in sha256_transform()
172 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1 + t2; in sha256_transform()
174 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1 + t2; in sha256_transform()
175 t1 = d + e1(a) + Ch(a, b, c) + 0x391c0cb3 + W[52]; in sha256_transform()
176 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1 + t2; in sha256_transform()
177 t1 = c + e1(h) + Ch(h, a, b) + 0x4ed8aa4a + W[53]; in sha256_transform()
179 t1 = b + e1(g) + Ch(g, h, a) + 0x5b9cca4f + W[54]; in sha256_transform()
181 t1 = a + e1(f) + Ch(f, g, h) + 0x682e6ff3 + W[55]; in sha256_transform()
182 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1 + t2; in sha256_transform()
184 t1 = h + e1(e) + Ch(e, f, g) + 0x748f82ee + W[56]; in sha256_transform()
185 t2 = e0(a) + Maj(a, b, c); d += t1; h = t1 + t2; in sha256_transform()
187 t2 = e0(h) + Maj(h, a, b); c += t1; g = t1 + t2; in sha256_transform()
189 t2 = e0(g) + Maj(g, h, a); b += t1; f = t1 + t2; in sha256_transform()
191 t2 = e0(f) + Maj(f, g, h); a += t1; e = t1 + t2; in sha256_transform()
192 t1 = d + e1(a) + Ch(a, b, c) + 0x90befffa + W[60]; in sha256_transform()
193 t2 = e0(e) + Maj(e, f, g); h += t1; d = t1 + t2; in sha256_transform()
194 t1 = c + e1(h) + Ch(h, a, b) + 0xa4506ceb + W[61]; in sha256_transform()
196 t1 = b + e1(g) + Ch(g, h, a) + 0xbef9a3f7 + W[62]; in sha256_transform()
198 t1 = a + e1(f) + Ch(f, g, h) + 0xc67178f2 + W[63]; in sha256_transform()
199 t2 = e0(b) + Maj(b, c, d); e += t1; a = t1 + t2; in sha256_transform()
201 state[0] += a; state[1] += b; state[2] += c; state[3] += d; in sha256_transform()
202 state[4] += e; state[5] += f; state[6] += g; state[7] += h; in sha256_transform()
205 a = b = c = d = e = f = g = h = t1 = t2 = 0; in sha256_transform()
214 partial = sctx->count & 0x3f; in sha256_update()
215 sctx->count += len; in sha256_update()
221 done = -partial; in sha256_update()
222 memcpy(sctx->buf + partial, data, done + 64); in sha256_update()
223 src = sctx->buf; in sha256_update()
227 sha256_transform(sctx->state, src); in sha256_update()
234 memcpy(sctx->buf + partial, src, len - done); in sha256_update()
253 bits = cpu_to_be64(sctx->count << 3); in __sha256_final()
256 index = sctx->count & 0x3f; in __sha256_final()
257 pad_len = (index < 56) ? (56 - index) : ((64+56) - index); in __sha256_final()
265 put_unaligned_be32(sctx->state[i], &dst[i]); in __sha256_final()