|
|
@@ -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) { |
|
|
|