Dash Core Source Documentation (0.16.0.1)

Find detailed information regarding the Dash Core source code.

num_gmp_impl.h File Reference
#include <string.h>
#include <stdlib.h>
#include <gmp.h>
#include "util.h"
#include "num.h"
+ Include dependency graph for num_gmp_impl.h:

Go to the source code of this file.

Macros

#define secp256k1_num_sanity(a)   do { } while(0)
 

Functions

static void secp256k1_num_copy (secp256k1_num *r, const secp256k1_num *a)
 
static void secp256k1_num_get_bin (unsigned char *r, unsigned int rlen, const secp256k1_num *a)
 
static void secp256k1_num_set_bin (secp256k1_num *r, const unsigned char *a, unsigned int alen)
 
static void secp256k1_num_add_abs (secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b)
 
static void secp256k1_num_sub_abs (secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b)
 
static void secp256k1_num_mod (secp256k1_num *r, const secp256k1_num *m)
 
static void secp256k1_num_mod_inverse (secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *m)
 
static int secp256k1_num_jacobi (const secp256k1_num *a, const secp256k1_num *b)
 
static int secp256k1_num_is_one (const secp256k1_num *a)
 
static int secp256k1_num_is_zero (const secp256k1_num *a)
 
static int secp256k1_num_is_neg (const secp256k1_num *a)
 
static int secp256k1_num_cmp (const secp256k1_num *a, const secp256k1_num *b)
 
static int secp256k1_num_eq (const secp256k1_num *a, const secp256k1_num *b)
 
static void secp256k1_num_subadd (secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b, int bneg)
 
static void secp256k1_num_add (secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b)
 
static void secp256k1_num_sub (secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b)
 
static void secp256k1_num_mul (secp256k1_num *r, const secp256k1_num *a, const secp256k1_num *b)
 
static void secp256k1_num_shift (secp256k1_num *r, int bits)
 
static void secp256k1_num_negate (secp256k1_num *r)
 

Macro Definition Documentation

◆ secp256k1_num_sanity

#define secp256k1_num_sanity (   a)    do { } while(0)

Function Documentation

◆ secp256k1_num_add()

static void secp256k1_num_add ( secp256k1_num r,
const secp256k1_num a,
const secp256k1_num b 
)
static

Definition at line 223 of file num_gmp_impl.h.

References secp256k1_num_sanity, and secp256k1_num_subadd().

◆ secp256k1_num_add_abs()

static void secp256k1_num_add_abs ( secp256k1_num r,
const secp256k1_num a,
const secp256k1_num b 
)
static

Definition at line 62 of file num_gmp_impl.h.

References secp256k1_num::data, secp256k1_num::limbs, NUM_LIMBS, and VERIFY_CHECK.

Referenced by secp256k1_num_subadd().

◆ secp256k1_num_cmp()

static int secp256k1_num_cmp ( const secp256k1_num a,
const secp256k1_num b 
)
static

Definition at line 181 of file num_gmp_impl.h.

References secp256k1_num::data, and secp256k1_num::limbs.

Referenced by secp256k1_num_subadd().

◆ secp256k1_num_copy()

static void secp256k1_num_copy ( secp256k1_num r,
const secp256k1_num a 
)
static

Definition at line 25 of file num_gmp_impl.h.

◆ secp256k1_num_eq()

static int secp256k1_num_eq ( const secp256k1_num a,
const secp256k1_num b 
)
static

◆ secp256k1_num_get_bin()

static void secp256k1_num_get_bin ( unsigned char *  r,
unsigned int  rlen,
const secp256k1_num a 
)
static

Definition at line 29 of file num_gmp_impl.h.

References secp256k1_num::data, secp256k1_num::limbs, memcpy(), and VERIFY_CHECK.

◆ secp256k1_num_is_neg()

static int secp256k1_num_is_neg ( const secp256k1_num a)
static

Definition at line 177 of file num_gmp_impl.h.

References secp256k1_num::data, secp256k1_num::limbs, and secp256k1_num::neg.

◆ secp256k1_num_is_one()

static int secp256k1_num_is_one ( const secp256k1_num a)
static

Definition at line 169 of file num_gmp_impl.h.

References secp256k1_num::data, and secp256k1_num::limbs.

◆ secp256k1_num_is_zero()

static int secp256k1_num_is_zero ( const secp256k1_num a)
static

Definition at line 173 of file num_gmp_impl.h.

References secp256k1_num::data, and secp256k1_num::limbs.

Referenced by secp256k1_num_eq().

◆ secp256k1_num_jacobi()

static int secp256k1_num_jacobi ( const secp256k1_num a,
const secp256k1_num b 
)
static

◆ secp256k1_num_mod()

static void secp256k1_num_mod ( secp256k1_num r,
const secp256k1_num m 
)
static

◆ secp256k1_num_mod_inverse()

static void secp256k1_num_mod_inverse ( secp256k1_num r,
const secp256k1_num a,
const secp256k1_num m 
)
static

mpn_gcdext computes: (G,S) = gcdext(U,V), where

  • G = gcd(U,V)
  • G = U*S + V*T
  • U has equal or more limbs than V, and V has no padding If we set U to be (a padded version of) a, and V = m: G = a*S + m*T G = a*S mod m Assuming G=1: S = 1/a mod m

Definition at line 101 of file num_gmp_impl.h.

References secp256k1_num::data, secp256k1_num::limbs, secp256k1_num::neg, NUM_LIMBS, secp256k1_num_sanity, and VERIFY_CHECK.

◆ secp256k1_num_mul()

static void secp256k1_num_mul ( secp256k1_num r,
const secp256k1_num a,
const secp256k1_num b 
)
static

◆ secp256k1_num_negate()

static void secp256k1_num_negate ( secp256k1_num r)
static

Definition at line 284 of file num_gmp_impl.h.

References secp256k1_num::neg.

◆ secp256k1_num_set_bin()

static void secp256k1_num_set_bin ( secp256k1_num r,
const unsigned char *  a,
unsigned int  alen 
)
static

◆ secp256k1_num_shift()

static void secp256k1_num_shift ( secp256k1_num r,
int  bits 
)
static

◆ secp256k1_num_sub()

static void secp256k1_num_sub ( secp256k1_num r,
const secp256k1_num a,
const secp256k1_num b 
)
static

Definition at line 229 of file num_gmp_impl.h.

References secp256k1_num_sanity, and secp256k1_num_subadd().

◆ secp256k1_num_sub_abs()

static void secp256k1_num_sub_abs ( secp256k1_num r,
const secp256k1_num a,
const secp256k1_num b 
)
static

Definition at line 71 of file num_gmp_impl.h.

References secp256k1_num::data, secp256k1_num::limbs, and VERIFY_CHECK.

Referenced by secp256k1_num_mod(), and secp256k1_num_subadd().

◆ secp256k1_num_subadd()

static void secp256k1_num_subadd ( secp256k1_num r,
const secp256k1_num a,
const secp256k1_num b,
int  bneg 
)
static
Released under the MIT license