diff --git a/src/per_field/f_field.tmpl.h b/src/per_field/f_field.tmpl.h index 4faf9b8..271b28c 100644 --- a/src/per_field/f_field.tmpl.h +++ b/src/per_field/f_field.tmpl.h @@ -80,9 +80,7 @@ mask_t gf_deserialize (gf x, const uint8_t serial[SER_BYTES],int with_highbit); #define P_MOD_8 $(modulus % 8) #if P_MOD_8 == 5 - static const gf SQRT_MINUS_ONE = {FIELD_LITERAL( /* TODO make not static */ - $(ser(msqrt(-1,modulus),gf_lit_limb_bits) if modulus % 4 == 1 else "/* NOPE */") - )}; + extern const gf SQRT_MINUS_ONE; #endif #ifndef LIMBPERM diff --git a/src/per_field/f_generic.tmpl.c b/src/per_field/f_generic.tmpl.c index 111e76f..d5aab8b 100644 --- a/src/per_field/f_generic.tmpl.c +++ b/src/per_field/f_generic.tmpl.c @@ -1,18 +1,16 @@ -/** - * @cond internal - * @file per_field.c - * @copyright - * Copyright (c) 2015-2016 Cryptography Research, Inc. \n - * Released under the MIT License. See LICENSE.txt for license information. - * @author Mike Hamburg - * @brief Generic arithmetic which has to be compiled per field. - */ +/** @brief Generic arithmetic which has to be compiled per field. */ #include "field.h" static const gf MODULUS = {FIELD_LITERAL( $(ser(modulus,gf_lit_limb_bits)) )}; + +#if P_MOD_8 == 5 + const gf SQRT_MINUS_ONE = {FIELD_LITERAL( + $(ser(msqrt(-1,modulus),gf_lit_limb_bits) if modulus % 4 == 1 else "/* NOPE */") + )}; +#endif /** Serialize to wire format. */ void gf_serialize (uint8_t serial[SER_BYTES], const gf x, int with_hibit) {