| author | |
| committer | |
| log | 0423f0f7d8afc24e48926849515f60a8a3a1e470 |
| tree | 1868e101f582c5f26ecaae4d163ee83fb7b86b89 |
| parent | b959029f88fa033e54e72e42004bc261baada1f1 |
These functions are not used by anything yet, but run the last
round only once.2 files changed, 4 insertions(+), 16 deletions(-)
lib/std/crypto/aes/aesni.zig+2-8| ... | @@ -313,10 +313,7 @@ pub fn AesEncryptCtx(comptime Aes: type) type { | ... | @@ -313,10 +313,7 @@ pub fn AesEncryptCtx(comptime Aes: type) type { |
| 313 | inline while (i < rounds) : (i += 1) { | 313 | inline while (i < rounds) : (i += 1) { |
| 314 | ts = Block.parallel.encryptWide(count, ts, round_keys[i]); | 314 | ts = Block.parallel.encryptWide(count, ts, round_keys[i]); |
| 315 | } | 315 | } |
| 316 | i = 1; | 316 | ts = Block.parallel.encryptLastWide(count, ts, round_keys[i]); |
| 317 | inline while (i < count) : (i += 1) { | ||
| 318 | ts = Block.parallel.encryptLastWide(count, ts, round_keys[i]); | ||
| 319 | } | ||
| 320 | j = 0; | 317 | j = 0; |
| 321 | inline while (j < count) : (j += 1) { | 318 | inline while (j < count) : (j += 1) { |
| 322 | dst[16 * j .. 16 * j + 16].* = ts[j].toBytes(); | 319 | dst[16 * j .. 16 * j + 16].* = ts[j].toBytes(); |
| ... | @@ -392,10 +389,7 @@ pub fn AesDecryptCtx(comptime Aes: type) type { | ... | @@ -392,10 +389,7 @@ pub fn AesDecryptCtx(comptime Aes: type) type { |
| 392 | inline while (i < rounds) : (i += 1) { | 389 | inline while (i < rounds) : (i += 1) { |
| 393 | ts = Block.parallel.decryptWide(count, ts, inv_round_keys[i]); | 390 | ts = Block.parallel.decryptWide(count, ts, inv_round_keys[i]); |
| 394 | } | 391 | } |
| 395 | i = 1; | 392 | ts = Block.parallel.decryptLastWide(count, ts, inv_round_keys[i]); |
| 396 | inline while (i < count) : (i += 1) { | ||
| 397 | ts = Block.parallel.decryptLastWide(count, ts, inv_round_keys[i]); | ||
| 398 | } | ||
| 399 | j = 0; | 393 | j = 0; |
| 400 | inline while (j < count) : (j += 1) { | 394 | inline while (j < count) : (j += 1) { |
| 401 | dst[16 * j .. 16 * j + 16].* = ts[j].toBytes(); | 395 | dst[16 * j .. 16 * j + 16].* = ts[j].toBytes(); |
lib/std/crypto/aes/armcrypto.zig+2-8| ... | @@ -364,10 +364,7 @@ pub fn AesEncryptCtx(comptime Aes: type) type { | ... | @@ -364,10 +364,7 @@ pub fn AesEncryptCtx(comptime Aes: type) type { |
| 364 | inline while (i < rounds) : (i += 1) { | 364 | inline while (i < rounds) : (i += 1) { |
| 365 | ts = Block.parallel.encryptWide(count, ts, round_keys[i]); | 365 | ts = Block.parallel.encryptWide(count, ts, round_keys[i]); |
| 366 | } | 366 | } |
| 367 | i = 1; | 367 | ts = Block.parallel.encryptLastWide(count, ts, round_keys[i]); |
| 368 | inline while (i < count) : (i += 1) { | ||
| 369 | ts = Block.parallel.encryptLastWide(count, ts, round_keys[i]); | ||
| 370 | } | ||
| 371 | j = 0; | 368 | j = 0; |
| 372 | inline while (j < count) : (j += 1) { | 369 | inline while (j < count) : (j += 1) { |
| 373 | dst[16 * j .. 16 * j + 16].* = ts[j].toBytes(); | 370 | dst[16 * j .. 16 * j + 16].* = ts[j].toBytes(); |
| ... | @@ -443,10 +440,7 @@ pub fn AesDecryptCtx(comptime Aes: type) type { | ... | @@ -443,10 +440,7 @@ pub fn AesDecryptCtx(comptime Aes: type) type { |
| 443 | inline while (i < rounds) : (i += 1) { | 440 | inline while (i < rounds) : (i += 1) { |
| 444 | ts = Block.parallel.decryptWide(count, ts, inv_round_keys[i]); | 441 | ts = Block.parallel.decryptWide(count, ts, inv_round_keys[i]); |
| 445 | } | 442 | } |
| 446 | i = 1; | 443 | ts = Block.parallel.decryptLastWide(count, ts, inv_round_keys[i]); |
| 447 | inline while (i < count) : (i += 1) { | ||
| 448 | ts = Block.parallel.decryptLastWide(count, ts, inv_round_keys[i]); | ||
| 449 | } | ||
| 450 | j = 0; | 444 | j = 0; |
| 451 | inline while (j < count) : (j += 1) { | 445 | inline while (j < count) : (j += 1) { |
| 452 | dst[16 * j .. 16 * j + 16].* = ts[j].toBytes(); | 446 | dst[16 * j .. 16 * j + 16].* = ts[j].toBytes(); |