Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
scalar.h
Go to the documentation of this file.
1/***********************************************************************
2 * Copyright (c) 2014 Pieter Wuille *
3 * Distributed under the MIT software license, see the accompanying *
4 * file COPYING or https://www.opensource.org/licenses/mit-license.php.*
5 ***********************************************************************/
6
7#ifndef SECP256K1_SCALAR_H
8#define SECP256K1_SCALAR_H
9
10#include "util.h"
11
12#if defined HAVE_CONFIG_H
13#include "libsecp256k1-config.h"
14#endif
15
16#if defined(EXHAUSTIVE_TEST_ORDER)
17#include "scalar_low.h"
18#elif defined(SECP256K1_WIDEMUL_INT128)
19#include "scalar_4x64.h"
20#elif defined(SECP256K1_WIDEMUL_INT64)
21#include "scalar_8x32.h"
22#else
23#error "Please select wide multiplication implementation"
24#endif
25
27static void secp256k1_scalar_clear(secp256k1_scalar *r);
28
30static unsigned int secp256k1_scalar_get_bits(const secp256k1_scalar *a, unsigned int offset, unsigned int count);
31
33static unsigned int secp256k1_scalar_get_bits_var(const secp256k1_scalar *a, unsigned int offset, unsigned int count);
34
40static void secp256k1_scalar_set_b32(secp256k1_scalar *r, const unsigned char *bin, int *overflow);
41
44static int secp256k1_scalar_set_b32_seckey(secp256k1_scalar *r, const unsigned char *bin);
45
47static void secp256k1_scalar_set_int(secp256k1_scalar *r, unsigned int v);
48
50static void secp256k1_scalar_get_b32(unsigned char *bin, const secp256k1_scalar* a);
51
53static int secp256k1_scalar_add(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b);
54
56static void secp256k1_scalar_cadd_bit(secp256k1_scalar *r, unsigned int bit, int flag);
57
59static void secp256k1_scalar_mul(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b);
60
63static int secp256k1_scalar_shr_int(secp256k1_scalar *r, int n);
64
66static void secp256k1_scalar_inverse(secp256k1_scalar *r, const secp256k1_scalar *a);
67
69static void secp256k1_scalar_inverse_var(secp256k1_scalar *r, const secp256k1_scalar *a);
70
72static void secp256k1_scalar_negate(secp256k1_scalar *r, const secp256k1_scalar *a);
73
75static int secp256k1_scalar_is_zero(const secp256k1_scalar *a);
76
78static int secp256k1_scalar_is_one(const secp256k1_scalar *a);
79
81static int secp256k1_scalar_is_even(const secp256k1_scalar *a);
82
84static int secp256k1_scalar_is_high(const secp256k1_scalar *a);
85
88static int secp256k1_scalar_cond_negate(secp256k1_scalar *a, int flag);
89
91static int secp256k1_scalar_eq(const secp256k1_scalar *a, const secp256k1_scalar *b);
92
94static void secp256k1_scalar_split_128(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *k);
97static void secp256k1_scalar_split_lambda(secp256k1_scalar *r1, secp256k1_scalar *r2, const secp256k1_scalar *k);
98
100static void secp256k1_scalar_mul_shift_var(secp256k1_scalar *r, const secp256k1_scalar *a, const secp256k1_scalar *b, unsigned int shift);
101
103static void secp256k1_scalar_cmov(secp256k1_scalar *r, const secp256k1_scalar *a, int flag);
104
105#endif /* SECP256K1_SCALAR_H */
const mie::Vuint & r
Definition bn.cpp:28
int * count
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
Definition pointer.h:1181
int bit
Definition yubihsm.h:566
bool overflow