diff --git a/Makefile b/Makefile index 49a1e3f..3efda9d 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ else CC = gcc endif LD = $(CC) +ASM ?= $(CC) ifneq (,$(findstring x86_64,$(MACHINE))) ARCH ?= arch_x86_64 @@ -99,7 +100,7 @@ build/timestamp: touch $@ build/%.o: build/%.s - $(CC) $(ASFLAGS) -c -o $@ $< + $(ASM) $(ASFLAGS) -c -o $@ $< build/%.s: src/%.c $(HEADERS) $(CC) $(CFLAGS) -S -c -o $@ $< diff --git a/src/arch_x86_64/p448.h b/src/arch_x86_64/p448.h index 2e2fbed..02acaf9 100644 --- a/src/arch_x86_64/p448.h +++ b/src/arch_x86_64/p448.h @@ -187,7 +187,7 @@ p448_cond_swap ( ) { big_register_t *aa = (big_register_t*)a; big_register_t *bb = (big_register_t*)b; - big_register_t m = doswap; + big_register_t m = br_set_to_mask(doswap); unsigned int i; for (i=0; iblock + fill, 0, 112-fill); - *((uint64_t *)&ctx->block[112]) = 0; - *((uint64_t *)&ctx->block[120]) = htobe64((ctx->nbytes * 8)); + memset(ctx->block + fill, 0, 120-fill); + uint64_t size = htobe64((ctx->nbytes * 8)); + memcpy(&ctx->block[120], &size, sizeof(size)); sha512_process_block(ctx); for (i=0; i<8; i++) { ctx->chain[i] = htobe64(ctx->chain[i]);