← Commit list

e62bfbcae

Denys Vlasenko
Denys Vlasenko
2025-07-11
SUCCESS Duration: 263s

Subject

libbb/yescrypt: code shrink

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

libbb/yescrypt/alg-yescrypt-kdf.c+3 -6
@@ -106,8 +106,7 @@ do { \
#else
#define COPY(out, in) \
do { \
- for (int copyi=0; copyi<8; copyi++) \
- (out).d[copyi] = (in).d[copyi]; \
+ memcpy((out).d, (in).d, sizeof((in).d)); \
} while (0)
#endif
@@ -161,11 +160,9 @@ static void salsa20(salsa20_blk_t *restrict B,
{
uint32_t i;
salsa20_simd_shuffle(&X, Bout);
- for (i = 0; i < 16; i += 4) {
+ for (i = 0; i < 16; i++) {
+ // bbox: note: was unrolled x4
B->w[i] = Bout->w[i] += B->w[i];
- B->w[i + 1] = Bout->w[i + 1] += B->w[i + 1];
- B->w[i + 2] = Bout->w[i + 2] += B->w[i + 2];
- B->w[i + 3] = Bout->w[i + 3] += B->w[i + 3];
}
}
#if 0
libbb/yescrypt/alg-yescrypt.h+4 -4
@@ -107,14 +107,14 @@
#define YCTX_param_NROM 0
#endif
-// "Faster, or smaller code" knobs:
-// Not a size win if disabled, so keeping it 1:
-#define KDF_UNROLL_COPY 1
+// "Faster/smaller code" knobs:
+// -941 bytes:
+#define KDF_UNROLL_COPY 0
// -5324 bytes if 0:
#define KDF_UNROLL_PWXFORM_ROUND 0
// -4864 bytes if 0:
#define KDF_UNROLL_PWXFORM 0
-// both 0: -7666 bytes
+// if both this ^^^^^^^^^^ and PWXFORM_ROUND set to 0: -7666 bytes
/**
* Type and possible values for the flags argument of yescrypt_kdf(),