aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2025-07-15 05:47:18 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2025-07-15 05:47:18 +0200
commitabe0b45cd7098f0f83f727d4d4c4c09dc2b172f7 (patch)
treeb56e9cfbf600e3765d831b92b6dae61677416964
parente62bfbcaed051146b83a096e778b5822069c160b (diff)
downloadbusybox-w32-abe0b45cd7098f0f83f727d4d4c4c09dc2b172f7.tar.gz
busybox-w32-abe0b45cd7098f0f83f727d4d4c4c09dc2b172f7.tar.bz2
busybox-w32-abe0b45cd7098f0f83f727d4d4c4c09dc2b172f7.zip
libbb/yescrypt: code shrink
function old new delta blockmix_xor 1177 702 -475 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--libbb/yescrypt/alg-yescrypt-kdf.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/libbb/yescrypt/alg-yescrypt-kdf.c b/libbb/yescrypt/alg-yescrypt-kdf.c
index 1c254e2e2..f75361d96 100644
--- a/libbb/yescrypt/alg-yescrypt-kdf.c
+++ b/libbb/yescrypt/alg-yescrypt-kdf.c
@@ -421,26 +421,19 @@ static uint32_t blockmix_xor(const salsa20_blk_t *Bin1,
421 421
422 i = 0; 422 i = 0;
423 r--; 423 r--;
424 do { 424 for (;;) {
425 XOR_X(Bin1[i]); 425 XOR_X(Bin1[i]);
426 XOR_X(Bin2[i]); 426 XOR_X(Bin2[i]);
427 PWXFORM; 427 PWXFORM;
428 WRITE_X(Bout[i]); 428 if (unlikely(i > r))
429
430 XOR_X(Bin1[i + 1]);
431 XOR_X(Bin2[i + 1]);
432 PWXFORM;
433
434 if (unlikely(i >= r))
435 break; 429 break;
430 WRITE_X(Bout[i]);
431 i++;
432 }
436 433
437 WRITE_X(Bout[i + 1]); 434 ctx->S0 = S0;
438 435 ctx->S1 = S1;
439 i += 2; 436 ctx->S2 = S2;
440 } while (1);
441 i++;
442
443 ctx->S0 = S0; ctx->S1 = S1; ctx->S2 = S2;
444 ctx->w = w; 437 ctx->w = w;
445 438
446 SALSA20_2(Bout[i]); 439 SALSA20_2(Bout[i]);