From d889868f9912648ff45cf5086abf62b052a242dd Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 24 Jun 2019 14:01:36 +0200 Subject: Fix bugs --- Makefile | 4 +++- poly1305-hacl128.c | 19 +++++++++++-------- poly1305-hacl256.c | 20 +++++++++++--------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 5cdff55..ed9c458 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,9 @@ ifneq ($(KERNELRELEASE),) kbench9000-y := main.o poly1305-hacl32x1.o poly1305-hacl128.o poly1305-hacl256.o poly1305-hacl32.o poly1305-hacl64.o poly1305-ref.o poly1305-openssl-asm.o poly1305-openssl.o poly1305-donna32.o poly1305-donna64.o obj-m := kbench9000.o -ccflags-y += -O3 -mmmx -mavx2 -mavx -msse +ccflags-y += -O3 +CFLAGS_poly1305-hacl128.o += -mmmx -mavx2 -mavx -msse +CFLAGS_poly1305-hacl256.o += -mmmx -mavx2 -mavx -msse ccflags-y += -D'pr_fmt(fmt)=KBUILD_MODNAME ": " fmt' else KERNELDIR ?= /lib/modules/$(shell uname -r)/build diff --git a/poly1305-hacl128.c b/poly1305-hacl128.c index 7248181..54ec820 100644 --- a/poly1305-hacl128.c +++ b/poly1305-hacl128.c @@ -33,7 +33,7 @@ __always_inline static uint64_t FStar_UInt64_gte_mask(uint64_t a, uint64_t b) uint32_t Hacl_Poly1305_128_blocklen = (uint32_t)16U; -void Hacl_Poly1305_128_poly1305_init(Lib_IntVector_Intrinsics_vec128 *ctx, uint8_t *key) +static void Hacl_Poly1305_128_poly1305_init(Lib_IntVector_Intrinsics_vec128 *ctx, uint8_t *key) { Lib_IntVector_Intrinsics_vec128 *acc = ctx; Lib_IntVector_Intrinsics_vec128 *pre = ctx + (uint32_t)5U; @@ -265,7 +265,7 @@ void Hacl_Poly1305_128_poly1305_init(Lib_IntVector_Intrinsics_vec128 *ctx, uint8 rn_5[4U] = Lib_IntVector_Intrinsics_vec128_smul64(f24, (uint64_t)5U); } -inline void +static inline void Hacl_Poly1305_128_poly1305_update( Lib_IntVector_Intrinsics_vec128 *ctx, uint32_t len1, @@ -1319,7 +1319,7 @@ Hacl_Poly1305_128_poly1305_update( } } -void +static void Hacl_Poly1305_128_poly1305_update_blocks( Lib_IntVector_Intrinsics_vec128 *ctx, uint32_t len1, @@ -1329,14 +1329,17 @@ Hacl_Poly1305_128_poly1305_update_blocks( Hacl_Poly1305_128_poly1305_update(ctx, len1, text); } -void -(*Hacl_Poly1305_128_poly1305_update_padded)( +static void +Hacl_Poly1305_128_poly1305_update_padded( Lib_IntVector_Intrinsics_vec128 *x0, uint32_t x1, uint8_t *x2 -) = Hacl_Poly1305_128_poly1305_update; +) +{ + Hacl_Poly1305_128_poly1305_update(x0, x1, x2); +} -void +static void Hacl_Poly1305_128_poly1305_update_last( Lib_IntVector_Intrinsics_vec128 *ctx, uint32_t len1, @@ -1346,7 +1349,7 @@ Hacl_Poly1305_128_poly1305_update_last( Hacl_Poly1305_128_poly1305_update(ctx, len1, text); } -void +static void Hacl_Poly1305_128_poly1305_finish( uint8_t *tag, uint8_t *key, diff --git a/poly1305-hacl256.c b/poly1305-hacl256.c index ee6d333..d946d01 100644 --- a/poly1305-hacl256.c +++ b/poly1305-hacl256.c @@ -33,7 +33,7 @@ __always_inline static uint64_t FStar_UInt64_gte_mask(uint64_t a, uint64_t b) uint32_t Hacl_Poly1305_256_blocklen = (uint32_t)16U; -void Hacl_Poly1305_256_poly1305_init(Lib_IntVector_Intrinsics_vec256 *ctx, uint8_t *key) +static void Hacl_Poly1305_256_poly1305_init(Lib_IntVector_Intrinsics_vec256 *ctx, uint8_t *key) { Lib_IntVector_Intrinsics_vec256 *acc = ctx; Lib_IntVector_Intrinsics_vec256 *pre = ctx + (uint32_t)5U; @@ -438,7 +438,7 @@ void Hacl_Poly1305_256_poly1305_init(Lib_IntVector_Intrinsics_vec256 *ctx, uint8 rn_5[4U] = Lib_IntVector_Intrinsics_vec256_smul64(f24, (uint64_t)5U); } -inline void +static inline void Hacl_Poly1305_256_poly1305_update( Lib_IntVector_Intrinsics_vec256 *ctx, uint32_t len1, @@ -1869,7 +1869,7 @@ Hacl_Poly1305_256_poly1305_update( } } -void +static void Hacl_Poly1305_256_poly1305_update_blocks( Lib_IntVector_Intrinsics_vec256 *ctx, uint32_t len1, @@ -1879,14 +1879,16 @@ Hacl_Poly1305_256_poly1305_update_blocks( Hacl_Poly1305_256_poly1305_update(ctx, len1, text); } -void -(*Hacl_Poly1305_256_poly1305_update_padded)( +static void +Hacl_Poly1305_256_poly1305_update_padded( Lib_IntVector_Intrinsics_vec256 *x0, uint32_t x1, uint8_t *x2 -) = Hacl_Poly1305_256_poly1305_update; +) { + Hacl_Poly1305_256_poly1305_update(x0, x1, x2); +} -void +static void Hacl_Poly1305_256_poly1305_update_last( Lib_IntVector_Intrinsics_vec256 *ctx, uint32_t len1, @@ -1896,7 +1898,7 @@ Hacl_Poly1305_256_poly1305_update_last( Hacl_Poly1305_256_poly1305_update(ctx, len1, text); } -void +static void Hacl_Poly1305_256_poly1305_finish( uint8_t *tag, uint8_t *key, @@ -2049,7 +2051,7 @@ Hacl_Poly1305_256_poly1305_finish( memcpy(tag, tmp, (uint32_t)16U * sizeof tmp[0U]); } -void poly1305_hacl256(uint8_t *tag, uint32_t len1, uint8_t *text, uint8_t *key) +void poly1305_hacl256(uint8_t *tag, uint8_t *text, uint32_t len1, uint8_t *key) { KRML_CHECK_SIZE(sizeof (Lib_IntVector_Intrinsics_vec256), (uint32_t)5U + (uint32_t)20U); Lib_IntVector_Intrinsics_vec256 ctx[(uint32_t)5U + (uint32_t)20U]; -- cgit v1.2.3-59-g8ed1b