Skip to content

Commit 32156b2

Browse files
committed
build: assume true 64-bit target, assume SPH_64 and related macros
1 parent 489c5f0 commit 32156b2

File tree

16 files changed

+1
-1725
lines changed

16 files changed

+1
-1725
lines changed

src/crypto/x11/blake.c

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -43,25 +43,21 @@ extern "C"{
4343
#define SPH_SMALL_FOOTPRINT_BLAKE 1
4444
#endif
4545

46-
#if SPH_64 && (SPH_SMALL_FOOTPRINT_BLAKE || !SPH_64_TRUE)
46+
#if SPH_SMALL_FOOTPRINT_BLAKE
4747
#define SPH_COMPACT_BLAKE_64 1
4848
#endif
4949

5050
#ifdef _MSC_VER
5151
#pragma warning (disable: 4146)
5252
#endif
5353

54-
#if SPH_64
55-
5654
static const sph_u64 IV512[8] = {
5755
SPH_C64(0x6A09E667F3BCC908), SPH_C64(0xBB67AE8584CAA73B),
5856
SPH_C64(0x3C6EF372FE94F82B), SPH_C64(0xA54FF53A5F1D36F1),
5957
SPH_C64(0x510E527FADE682D1), SPH_C64(0x9B05688C2B3E6C1F),
6058
SPH_C64(0x1F83D9ABFB41BD6B), SPH_C64(0x5BE0CD19137E2179)
6159
};
6260

63-
#endif
64-
6561
#if SPH_COMPACT_BLAKE_64
6662

6763
static const unsigned sigma[16][16] = {
@@ -271,8 +267,6 @@ static const unsigned sigma[16][16] = {
271267
#define Mx_(n) Mx__(n)
272268
#define Mx__(n) M ## n
273269

274-
#if SPH_64
275-
276270
#define CBx(r, i) CBx_(Z ## r ## i)
277271
#define CBx_(n) CBx__(n)
278272
#define CBx__(n) CB ## n
@@ -309,10 +303,6 @@ static const sph_u64 CB[16] = {
309303

310304
#endif
311305

312-
#endif
313-
314-
#if SPH_64
315-
316306
#define GB(m0, m1, c0, c1, a, b, c, d) do { \
317307
a = SPH_T64(a + b + (m0 ^ c1)); \
318308
d = SPH_ROTR64(d ^ a, 32); \
@@ -360,10 +350,6 @@ static const sph_u64 CB[16] = {
360350

361351
#endif
362352

363-
#endif
364-
365-
#if SPH_64
366-
367353
#define DECL_STATE64 \
368354
sph_u64 H0, H1, H2, H3, H4, H5, H6, H7; \
369355
sph_u64 S0, S1, S2, S3, T0, T1;
@@ -520,10 +506,6 @@ static const sph_u64 CB[16] = {
520506

521507
#endif
522508

523-
#endif
524-
525-
#if SPH_64
526-
527509
static const sph_u64 salt_zero_big[4] = { 0, 0, 0, 0 };
528510

529511
static void
@@ -627,10 +609,6 @@ blake64_close(sph_blake_big_context *sc,
627609
sph_enc64be(out + (k << 3), sc->H[k]);
628610
}
629611

630-
#endif
631-
632-
#if SPH_64
633-
634612
/* see sph_blake.h */
635613
void
636614
sph_blake512_init(void *cc)
@@ -660,8 +638,6 @@ sph_blake512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
660638
sph_blake512_init(cc);
661639
}
662640

663-
#endif
664-
665641
#ifdef __cplusplus
666642
}
667643
#endif

src/crypto/x11/bmw.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ extern "C"{
4747
#pragma warning (disable: 4146)
4848
#endif
4949

50-
#if SPH_64
51-
5250
static const sph_u64 IV512[] = {
5351
SPH_C64(0x8081828384858687), SPH_C64(0x88898A8B8C8D8E8F),
5452
SPH_C64(0x9091929394959697), SPH_C64(0x98999A9B9C9D9E9F),
@@ -60,8 +58,6 @@ static const sph_u64 IV512[] = {
6058
SPH_C64(0xF0F1F2F3F4F5F6F7), SPH_C64(0xF8F9FAFBFCFDFEFF)
6159
};
6260

63-
#endif
64-
6561
#define XCAT(x, y) XCAT_(x, y)
6662
#define XCAT_(x, y) x ## y
6763

@@ -155,8 +151,6 @@ static const sph_u64 IV512[] = {
155151
#define expand2s_(qf, mf, hf, i16, ix, iy) \
156152
expand2s_inner LPAR qf, mf, hf, i16, ix, iy)
157153

158-
#if SPH_64
159-
160154
#define sb0(x) (((x) >> 1) ^ SPH_T64((x) << 3) \
161155
^ SPH_ROTL64(x, 4) ^ SPH_ROTL64(x, 37))
162156
#define sb1(x) (((x) >> 1) ^ SPH_T64((x) << 2) \
@@ -251,14 +245,10 @@ static const sph_u64 Kb_tab[] = {
251245

252246
#endif
253247

254-
#endif
255-
256248
#define MAKE_W(tt, i0, op01, i1, op12, i2, op23, i3, op34, i4) \
257249
tt((M(i0) ^ H(i0)) op01 (M(i1) ^ H(i1)) op12 (M(i2) ^ H(i2)) \
258250
op23 (M(i3) ^ H(i3)) op34 (M(i4) ^ H(i4)))
259251

260-
#if SPH_64
261-
262252
#define Wb0 MAKE_W(SPH_T64, 5, -, 7, +, 10, +, 13, +, 14)
263253
#define Wb1 MAKE_W(SPH_T64, 6, -, 8, +, 11, +, 14, -, 15)
264254
#define Wb2 MAKE_W(SPH_T64, 0, +, 7, +, 9, -, 12, +, 15)
@@ -364,8 +354,6 @@ static const sph_u64 Kb_tab[] = {
364354

365355
#define Qb(j) (qt[j])
366356

367-
#endif
368-
369357
#define FOLD(type, mkQ, tt, rol, mf, qf, dhf) do { \
370358
type qt[32], xl, xh; \
371359
mkQ; \
@@ -407,14 +395,8 @@ static const sph_u64 Kb_tab[] = {
407395
+ ((xl >> 2) ^ qf(22) ^ qf(15))); \
408396
} while (0)
409397

410-
#if SPH_64
411-
412398
#define FOLDb FOLD(sph_u64, MAKE_Qb, SPH_T64, SPH_ROTL64, M, Qb, dH)
413399

414-
#endif
415-
416-
#if SPH_64
417-
418400
static void
419401
compress_big(const unsigned char *data, const sph_u64 h[16], sph_u64 dh[16])
420402
{
@@ -540,10 +522,6 @@ bmw64_close(sph_bmw_big_context *sc, unsigned ub, unsigned n,
540522
sph_enc64le(out + 8 * u, h1[v]);
541523
}
542524

543-
#endif
544-
545-
#if SPH_64
546-
547525
/* see sph_bmw.h */
548526
void
549527
sph_bmw512_init(void *cc)
@@ -573,8 +551,6 @@ sph_bmw512_addbits_and_close(void *cc, unsigned ub, unsigned n, void *dst)
573551
sph_bmw512_init(cc);
574552
}
575553

576-
#endif
577-
578554
#ifdef __cplusplus
579555
}
580556
#endif

0 commit comments

Comments
 (0)