mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-27 08:22:31 +00:00
41 lines
1.7 KiB
C
41 lines
1.7 KiB
C
/* Copyright 2016 Brian Smith.
|
|
*
|
|
* Permission to use, copy, modify, and/or distribute this software for any
|
|
* purpose with or without fee is hereby granted, provided that the above
|
|
* copyright notice and this permission notice appear in all copies.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
|
|
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
|
|
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
|
|
|
|
#ifndef RING_LIMBS_H
|
|
#define RING_LIMBS_H
|
|
|
|
#include <GFp/base.h>
|
|
|
|
#include "../internal.h"
|
|
|
|
typedef crypto_word Limb;
|
|
|
|
#define LIMB_BITS CRYPTO_WORD_BITS
|
|
#define LIMB_HIGH_BIT ((Limb)(1) << (LIMB_BITS - 1))
|
|
|
|
|
|
Limb LIMBS_are_zero(const Limb a[], size_t num_limbs);
|
|
Limb LIMBS_are_even(const Limb a[], size_t num_limbs);
|
|
Limb LIMBS_equal(const Limb a[], const Limb b[], size_t num_limbs);
|
|
Limb LIMBS_equal_limb(const Limb a[], Limb b, size_t num_limbs);
|
|
void LIMBS_reduce_once(Limb r[], const Limb m[], size_t num_limbs);
|
|
void LIMBS_add_mod(Limb r[], const Limb a[], const Limb b[], const Limb m[],
|
|
size_t num_limbs);
|
|
void LIMBS_sub_mod(Limb r[], const Limb a[], const Limb b[], const Limb m[],
|
|
size_t num_limbs);
|
|
void LIMBS_shl_mod(Limb r[], const Limb a[], const Limb m[], size_t num_limbs);
|
|
Limb GFp_limbs_mul_add_limb(Limb r[], const Limb a[], Limb b, size_t num_limbs);
|
|
|
|
#endif /* RING_LIMBS_H */
|