Dash Core  0.12.2.1
P2P Digital Currency
field.h
Go to the documentation of this file.
1 /**********************************************************************
2  * Copyright (c) 2013, 2014 Pieter Wuille *
3  * Distributed under the MIT software license, see the accompanying *
4  * file COPYING or http://www.opensource.org/licenses/mit-license.php.*
5  **********************************************************************/
6 
7 #ifndef _SECP256K1_FIELD_
8 #define _SECP256K1_FIELD_
9 
21 #if defined HAVE_CONFIG_H
22 #include "libsecp256k1-config.h"
23 #endif
24 
25 #if defined(USE_FIELD_10X26)
26 #include "field_10x26.h"
27 #elif defined(USE_FIELD_5X52)
28 #include "field_5x52.h"
29 #else
30 #error "Please select field implementation"
31 #endif
32 
34 static void secp256k1_fe_normalize(secp256k1_fe *r);
35 
38 
41 
45 
49 
51 static void secp256k1_fe_set_int(secp256k1_fe *r, int a);
52 
54 static int secp256k1_fe_is_zero(const secp256k1_fe *a);
55 
57 static int secp256k1_fe_is_odd(const secp256k1_fe *a);
58 
60 static int secp256k1_fe_equal_var(const secp256k1_fe *a, const secp256k1_fe *b);
61 
63 static int secp256k1_fe_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b);
64 
66 static int secp256k1_fe_set_b32(secp256k1_fe *r, const unsigned char *a);
67 
69 static void secp256k1_fe_get_b32(unsigned char *r, const secp256k1_fe *a);
70 
73 static void secp256k1_fe_negate(secp256k1_fe *r, const secp256k1_fe *a, int m);
74 
77 static void secp256k1_fe_mul_int(secp256k1_fe *r, int a);
78 
80 static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a);
81 
84 static void secp256k1_fe_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe * SECP256K1_RESTRICT b);
85 
88 static void secp256k1_fe_sqr(secp256k1_fe *r, const secp256k1_fe *a);
89 
95 static int secp256k1_fe_sqrt_var(secp256k1_fe *r, const secp256k1_fe *a);
96 
99 static void secp256k1_fe_inv(secp256k1_fe *r, const secp256k1_fe *a);
100 
102 static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *a);
103 
107 static void secp256k1_fe_inv_all_var(size_t len, secp256k1_fe *r, const secp256k1_fe *a);
108 
111 
114 
116 static void secp256k1_fe_storage_cmov(secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag);
117 
119 static void secp256k1_fe_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag);
120 
121 #endif
static int secp256k1_fe_is_zero(const secp256k1_fe *a)
static void secp256k1_fe_mul(secp256k1_fe *r, const secp256k1_fe *a, const secp256k1_fe *SECP256K1_RESTRICT b)
static void secp256k1_fe_normalize_var(secp256k1_fe *r)
static void secp256k1_fe_negate(secp256k1_fe *r, const secp256k1_fe *a, int m)
static void secp256k1_fe_from_storage(secp256k1_fe *r, const secp256k1_fe_storage *a)
static void secp256k1_fe_storage_cmov(secp256k1_fe_storage *r, const secp256k1_fe_storage *a, int flag)
static void secp256k1_fe_cmov(secp256k1_fe *r, const secp256k1_fe *a, int flag)
static void secp256k1_fe_set_int(secp256k1_fe *r, int a)
static void secp256k1_fe_to_storage(secp256k1_fe_storage *r, const secp256k1_fe *a)
static void secp256k1_fe_add(secp256k1_fe *r, const secp256k1_fe *a)
static void secp256k1_fe_mul_int(secp256k1_fe *r, int a)
static int secp256k1_fe_is_odd(const secp256k1_fe *a)
#define SECP256K1_RESTRICT
Definition: util.h:86
static int secp256k1_fe_sqrt_var(secp256k1_fe *r, const secp256k1_fe *a)
static void secp256k1_fe_inv_all_var(size_t len, secp256k1_fe *r, const secp256k1_fe *a)
static void secp256k1_fe_normalize_weak(secp256k1_fe *r)
static int secp256k1_fe_normalizes_to_zero(secp256k1_fe *r)
static void secp256k1_fe_sqr(secp256k1_fe *r, const secp256k1_fe *a)
static int secp256k1_fe_set_b32(secp256k1_fe *r, const unsigned char *a)
static int secp256k1_fe_cmp_var(const secp256k1_fe *a, const secp256k1_fe *b)
static int secp256k1_fe_equal_var(const secp256k1_fe *a, const secp256k1_fe *b)
static void secp256k1_fe_normalize(secp256k1_fe *r)
static void secp256k1_fe_get_b32(unsigned char *r, const secp256k1_fe *a)
static void secp256k1_fe_inv_var(secp256k1_fe *r, const secp256k1_fe *a)
static void secp256k1_fe_inv(secp256k1_fe *r, const secp256k1_fe *a)
static int secp256k1_fe_normalizes_to_zero_var(secp256k1_fe *r)