Skip to content

Commit 5ae287b

Browse files
committed
Revert "CI: Pacify ASan vs. memcpy(), fully upgrade to actions/checkout@v5"
This reverts commit 5d9397e.
1 parent 6612f2a commit 5ae287b

File tree

3 files changed

+11
-24
lines changed

3 files changed

+11
-24
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
CC: gcc
1919
TARGET: x86_64
2020
steps:
21-
- uses: actions/checkout@v5
21+
- uses: actions/checkout@v4
2222
- name: install dependencies
2323
run: .ci/install-dependencies.sh
2424
- name: build check

src/blake2b_plug.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -406,30 +406,29 @@ int blake2b_long(void *pout, size_t outlen, const void *in, size_t inlen) {
406406
TRY(blake2b_final(&blake_state, out, outlen));
407407
} else {
408408
uint32_t toproduce;
409-
struct {
410-
uint8_t b[BLAKE2B_OUTBYTES];
411-
} out_buffer, in_buffer;
409+
uint8_t out_buffer[BLAKE2B_OUTBYTES];
410+
uint8_t in_buffer[BLAKE2B_OUTBYTES];
412411
TRY(blake2b_init(&blake_state, BLAKE2B_OUTBYTES));
413412
TRY(blake2b_update(&blake_state, outlen_bytes, sizeof(outlen_bytes)));
414413
TRY(blake2b_update(&blake_state, in, inlen));
415-
TRY(blake2b_final(&blake_state, out_buffer.b, BLAKE2B_OUTBYTES));
416-
memcpy(out, out_buffer.b, BLAKE2B_OUTBYTES / 2);
414+
TRY(blake2b_final(&blake_state, out_buffer, BLAKE2B_OUTBYTES));
415+
memcpy(out, out_buffer, BLAKE2B_OUTBYTES / 2);
417416
out += BLAKE2B_OUTBYTES / 2;
418417
toproduce = (uint32_t)outlen - BLAKE2B_OUTBYTES / 2;
419418

420419
while (toproduce > BLAKE2B_OUTBYTES) {
421-
in_buffer = out_buffer;
422-
TRY(blake2b(out_buffer.b, BLAKE2B_OUTBYTES, in_buffer.b,
420+
memcpy(in_buffer, out_buffer, BLAKE2B_OUTBYTES);
421+
TRY(blake2b(out_buffer, BLAKE2B_OUTBYTES, in_buffer,
423422
BLAKE2B_OUTBYTES, NULL, 0));
424-
memcpy(out, out_buffer.b, BLAKE2B_OUTBYTES / 2);
423+
memcpy(out, out_buffer, BLAKE2B_OUTBYTES / 2);
425424
out += BLAKE2B_OUTBYTES / 2;
426425
toproduce -= BLAKE2B_OUTBYTES / 2;
427426
}
428427

429-
in_buffer = out_buffer;
430-
TRY(blake2b(out_buffer.b, toproduce, in_buffer.b, BLAKE2B_OUTBYTES, NULL,
428+
memcpy(in_buffer, out_buffer, BLAKE2B_OUTBYTES);
429+
TRY(blake2b(out_buffer, toproduce, in_buffer, BLAKE2B_OUTBYTES, NULL,
431430
0));
432-
memcpy(out, out_buffer.b, toproduce);
431+
memcpy(out, out_buffer, toproduce);
433432
}
434433
fail:
435434
secure_zero_memory(&blake_state, sizeof(blake_state));

src/secp256k1/secp256k1.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -119,13 +119,7 @@ static int secp256k1_pubkey_load(const secp256k1_context* ctx, secp256k1_ge* ge,
119119
* representation inside secp256k1_pubkey, as conversion is very fast.
120120
* Note that secp256k1_pubkey_save must use the same representation. */
121121
secp256k1_ge_storage s;
122-
#ifdef __SANITIZE_ADDRESS__
123-
/* Workaround ASan false positives seen in GitHub's Ubuntu 24.04 runner */
124-
memcpy(&s, &pubkey->data[0], 32);
125-
memcpy((uint8_t *)&s + 32, &pubkey->data[32], 32);
126-
#else
127122
memcpy(&s, &pubkey->data[0], 64);
128-
#endif
129123
secp256k1_ge_from_storage(ge, &s);
130124
} else {
131125
/* Otherwise, fall back to 32-byte big endian for X and Y. */
@@ -142,13 +136,7 @@ static void secp256k1_pubkey_save(secp256k1_pubkey* pubkey, secp256k1_ge* ge) {
142136
if (sizeof(secp256k1_ge_storage) == 64) {
143137
secp256k1_ge_storage s;
144138
secp256k1_ge_to_storage(&s, ge);
145-
#ifdef __SANITIZE_ADDRESS__
146-
/* Workaround ASan false positives seen in GitHub's Ubuntu 24.04 runner */
147-
memcpy(&pubkey->data[0], &s, 32);
148-
memcpy(&pubkey->data[32], (uint8_t *)&s + 32, 32);
149-
#else
150139
memcpy(&pubkey->data[0], &s, 64);
151-
#endif
152140
} else {
153141
VERIFY_CHECK(!secp256k1_ge_is_infinity(ge));
154142
secp256k1_fe_normalize_var(&ge->x);

0 commit comments

Comments
 (0)