ring/crypto/limbs/limbs.h
Brian Smith ff71d521ff Use "GFp/" instead of "openssl/" for #includes.
Avoid any potential conflicts with OpenSSL header files by using a
different namespace.
2017-04-19 14:56:44 -10:00

42 lines
1.5 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 <GFp/bn.h>
#include <stddef.h>
typedef BN_ULONG Limb;
#define LIMB_BITS BN_BITS2
#define LIMB_HIGH_BIT ((Limb)(1) << (LIMB_BITS - 1))
Limb LIMBS_are_zero(const Limb a[], size_t num_limbs);
Limb LIMBS_equal(const Limb a[], const 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);
#endif /* RING_LIMBS_H */